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
New Developer
adderlygonzalez
Posts: 8
Registered: ‎04-20-2012
My Device: Tablet

Insert Existing QGraphicsView into QML.

[ Edited ]

Hi Guys,

 

I've been working lately in a desktop application using QGraphicView.

 

How would i be able to import it to some qml scene?

 

I mean i can compile and run the app to my z10,only the QGraphicView, but i want access to the cascades/Qml part.

 

Is there any example for this anywhere...

 

Wating paciently.

Thanks.

Developer
BBSJdev
Posts: 6,118
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Insert Existing QGraphicsView into QML.

Have you looked at the ForeignWindowControl...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__foreignwindowcontrol.html


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
New Developer
adderlygonzalez
Posts: 8
Registered: ‎04-20-2012
My Device: Tablet

Re: Insert Existing QGraphicsView into QML.

Looks interesting, i already have a QWidget. Im not so familiar with native windows in qnx. :/
Do the events are going to be ok?
What should i implement to make it work correctly?


Developer
BBSJdev
Posts: 6,118
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Insert Existing QGraphicsView into QML.

Take a look at the Hello Foreign Window sample...

 

http://developer.blackberry.com/native/sampleapps/


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Insert Existing QGraphicsView into QML.

Hi,

 

Afaik there's no straightforward way to port QWidget based controls to Cascades.

 

Depending on type of control, using QPainter API of QImage to render and displaying it as Cascades Image can be an option, but it doesn't support font rendering (drawText will crash) and updating the control with high framerate won't be possible.

 

ForeignWindowControl is useful if you plan to reimplement the rendering using raw OpenGL. For most types of controls it's probably an overkill.

 

The easiest way would be reimplementing the control in Cascades without any custom drawing.

 

Using Qt Quick is also an option. It can be compiled and used with BB10. But mimicking the native controls behavior and getting the app certified will be hard.

 

 


Andrey Fidrya, @zmeyc on twitter
New Developer
adderlygonzalez
Posts: 8
Registered: ‎04-20-2012
My Device: Tablet

Re: Insert Existing QGraphicsView into QML.

Oh well,
I've just could get it to work, what do you think if i could have a QApplication and Application in the same file.

I mean, can i make a handler lets say i start with the Application() and then by user interaction. I killed That Application instance and Open An QApplication.

Basically in runtime switching Between QApplication And Application.

I think i should go to the Qt Forums too.

 

Thanks in advance.

Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Insert Existing QGraphicsView into QML.

Zmey, could you please elaborate on this?

>The easiest way would be reimplementing the control in Cascades without any custom drawing.

Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Insert Existing QGraphicsView into QML.

In many cases using containers (dock/stack), images, transparent text areas & scrollview as building blocks works very well.

I've implemented a spinner control this way.

Even more complex controls such as timeline can be implemented by combining scrollview with images and hiding/showing the images.

Any non-standard stuff which can't be expressed by combining images can be painted into QImage then converted to Image. This won't work for text, but text can be overlaid using Cascades components. Of course, it won't work if updating of the image contents should be done in realtime.

If the app depends heavily on custom owner-drawn controls I'd consider a Qt Quick instead with it's QQuickPaintedItem. Alas, there's no analogue in Cascades.

Andrey Fidrya, @zmeyc on twitter