Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 102
Registered: ‎06-03-2012
My Device: Playbook
Accepted Solution

Couple of questions coming from 'pure' QML and Symbian/Harmattan Qt Components

[ Edited ]

Hi guys,

 

today was my first day with Cascades and I'm having a couple of questions that I hope someone here can answer. I've used Qt/QML before but only on Desktop and Nokia handsets so I'm a noob regarding Blackberry and Cascades. I stumbled over those questions today while trying to port Conboy from Nokia N9 to BB10.

 

1) It looks like I cannot use plain QML elements like Rectangle in Cascades. Is that right or is there maybe a Cascades wrapper element that allows me to use plain QML elements inside? If there is no such thing, what is the equivalent to Rectangle and especially Flickable?

 

2) How can I integrate a QGraphicsItem? In pure Qt I can simply export it from C++ and use it inside QML, but that does not work with Cascades. Do I have to implement bb::cascades::Control or even bb::cascades::VisualNode?

 

3) Cascades itself is not open-source, or is it? (I was looking on how to implement my own Control)

 

4) The UI guidelines talk about a Title Bar. What's the corresponding Cascades element?

 

5) The UI guidelines suggest to place the 'delete' action on the bottom of the ActionBar-OverflowMenu. How do I do that?

 

6) How can I access icons from default actions like 'new', 'previous', 'next', 'play', 'pause', 'favorite', etc...?

 

I think that's all for the first round of questions :smileyhappy: Last thing is a feature request / suggestion: I think it would be nice if ListView would support QAbstractListModel in addition to the already supported models. Many people use it in existing Qt/QML code. It would be nice if we could at least keep our C++ code unchanged while porting from other QML enabled platforms to Blackberry. Rewriting the whole UI is already enough work :smileyhappy:


Thanks!

Conny


-----------
http://kodira.de
BB Apps: Pattern :: Plonk
Developer
Posts: 887
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha

Re: Couple of questions coming from 'pure' QML and Symbian/Harmattan Qt Components

You can not use anything like Rectangle that is a QtGUI element. On the GUI side of things you can only use Cascades elements.

 


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 102
Registered: ‎06-03-2012
My Device: Playbook

Re: Couple of questions coming from 'pure' QML and Symbian/Harmattan Qt Components

Thanks for your answer. Do you know why this is so? Any chance to overcome this issue? For example in QtQuick I can use a proxy element to display a QWidget type. Maybe it would be possible to develop a proxy to display QtQuick elements in Cascades?!
-----------
http://kodira.de
BB Apps: Pattern :: Plonk
Developer
Posts: 275
Registered: ‎02-05-2010
My Device: Blackberry Z10

Re: Couple of questions coming from 'pure' QML and Symbian/Harmattan Qt Components

At the moment we don't have anything similar to QGraphicsItem (Qt) or Graphics (java) in BB10.
Only a subset of the QT framework is available for now because it is still in beta.
Maybe the BB10 api will grow release after release...

Twitter : @LaurentKP
My apps
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Couple of questions coming from 'pure' QML and Symbian/Harmattan Qt Components

Doing the proxying thing may be difficult or impossible.

Although QtGui is included in the BB10 install (at least to judge by the Alpha), apparently QtGui and Cascades use entirely different rendering engines, and can't be mixed. If it's theoretically possible, I'm pretty sure it would at least involve some heavy hacking, and the use of a ForeignWindow in the Cascades app to display the results of whatever rendering the QtGui parts might do.

I strongly suspect it would be insanity for someone to actually attempt it, once they saw what was required. Not to dissuade anyone from trying. ;-)

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 102
Registered: ‎06-03-2012
My Device: Playbook

Re: Couple of questions coming from 'pure' QML and Symbian/Harmattan Qt Components

Thanks for the replies so far. The APIs for using QGraphicsView based items is currently included in the SDK. My code compiles fine - that not the problem.

To me the question is, what architecture is Cascades build one? QGraphicsView? Qt Scene Graph? Something else? I doesn't look like QGraphicsView, but the scene graph is only part of Qt5 (I think). Maybe they backported the scene graph to Qt 4.8?

Well, maybe I should fork this question into its own thread?! What about the rest of the questions? Someone of you knows more about it?

Thanks!
Conny
-----------
http://kodira.de
BB Apps: Pattern :: Plonk
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Couple of questions coming from 'pure' QML and Symbian/Harmattan Qt Components

connyhald, I'm not quite sure what you're asking, but Cascades is a *replacement* for QtGui, not something that builds on top of any of it. They included libQtGui.so in the BB10 device, and the SDK probably has the QtGui stuff included, but you can't use it in a Cascades app.

Basically it comes down to which application class you instantiate, I believe. You can build a QtGui QApplication, or a Cascades bb::Cascades::Application, and that determines which library is available to you.

Both inherit from QCoreApplication (with the Cascades one having an extra one in between, bb::Application) though. I think technically that makes QApplication the uncle or aunt, and bb::Cascades::Application its niece or nephew. ;-)

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 102
Registered: ‎06-03-2012
My Device: Playbook

Re: Couple of questions coming from 'pure' QML and Symbian/Harmattan Qt Components

Well, I'm not really taking about QtGui. At least to me QtGui means QtWidgets based UIs. I'm talking about QtQuick (aka QtDeclarative), QGraphicsItem and the scene graph of Qt5 (see QtQuick 2.0).

Of course it might be that Cascades is not based on any existing Qt technologies, but I highly doubt it. And if it's based on existing Qt APIs there might be a way how to integrate standard Qt stuff with the Cascades.

In my case I have a text editor widget which is implemented using QGraphicsItem and using that would save me a couple of month development work in porting my app to BB10.

In case Cascades is really something that completely reinvents the wheel I wonder why that route was chosen and why they don't build upon QtQuick.

Anyways, I'd like to do some more research on that and I think I need a better understanding of how Cascades was build and how to extend it. Are there any examples on how to implement a bb::cascades::VisualNode?

-----------
http://kodira.de
BB Apps: Pattern :: Plonk
Developer
Posts: 102
Registered: ‎06-03-2012
My Device: Playbook

Re: Couple of questions coming from 'pure' QML and Symbian/Harmattan Qt Components

Alright, after digging a bit deeper is looks like Cascades is really a complete new beast and does not share code with QtQuick or QGraphicsView. To me it looks like custom UI elements that are probably drawn using OpenGL. For convenience they have taken QML from QtQuick but only as language to script their custom elements.

Sorry peter9477 for not believing you earlier but to me this just sounded like a ridiculous idea. Why not just build on top of something stable and proven? Well, they probably have their reasons... The sad thing about this is that it makes porting my Harmattan applications to BB10 very hard or even impossible.

Anyways, there are sill a couple of questions I'm seeking answers to. Anyone can help me out please?

4) The UI guidelines talk about a Title Bar. What's the corresponding Cascades element?

5) The UI guidelines suggest to place the 'delete' action on the bottom of the ActionBar-OverflowMenu. How do I do that?

6) How can I access icons from default actions like 'new', 'previous', 'next', 'play', 'pause', 'favorite', etc...?

Thanks!
Conny
-----------
http://kodira.de
BB Apps: Pattern :: Plonk
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Couple of questions coming from 'pure' QML and Symbian/Harmattan Qt Components

connyhald, I think one of the reasons is that, because Cascades uses its own rendering thread, and all graphics stuff involves transparently passing messages to it to get that done, apps are able to achieve a consistent 60 FPS using Cascades even when they do something (in the main thread) which blocks momentarily. There are probably other reasons.

As for porting Harmattan apps, while I don't really know what that means, if it depends on QtGui I don't see what the problem is. The libQtGui.so is still present, and works, and porting regular Qt apps should be very simple, as I understand it. You just can't mix them with Cascades controls as you have to choose only one, or the other, QCoreApplication subclass for your app.

Sorry I can't answer your other questions yet.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!