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
dridk
Posts: 91
Registered: ‎09-25-2012
My Device: bb10 alpha
My Carrier: free

Using Qt4 instead cascade from QNX momentics IDE

[ Edited ]

Today, I just realize that pure Qt is completly working on QNX Momentics IDE.... So, If you want to make an application without cascade UI and draw all by yourself , ( for games it's a good idea) , use QGraphicsView/QGraphicsScene system.

Just create a cascade project , and replace the main contain by pure Qt code... 

Capture du 2012-11-03 00:20:05.png

a lover of Qt
Please use plain text.
Developer
dridk
Posts: 91
Registered: ‎09-25-2012
My Device: bb10 alpha
My Carrier: free

Re: Using Qt4 instead cascade from QNX momentics IDE

Now, use the standard QML ... And it works !! Seriously, I was beleiving that Qt gui module was disable.. But no

 

 

Capture du 2012-11-03 00:54:00.png

 

 

Capture du 2012-11-03 00:54:33.png

a lover of Qt
Please use plain text.
New Contributor
samir22
Posts: 8
Registered: ‎02-05-2013
My Device: Dev Alpha
My Carrier: None

Re: Using Qt4 instead cascade from QNX momentics IDE

I just tried the following code:

 

#include <QtGui/QApplication>
#include<QGraphicsView>
#include<QGraphicsScene>


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QGraphicsView * view;
    QGraphicsScene * scene;

    view->setScene(scene);
    view->showFullScreen();

    return a.exec();
}

The app builds and compiles but on the Dev Alpha B device, does not launch. Any clues?

Please use plain text.
Contributor
kosh0r
Posts: 21
Registered: ‎01-22-2013
My Device: BB10 Simulator, BB10 Dev Alpha B, Playbook OS 2.1
My Carrier: asdf

Re: Using Qt4 instead cascade from QNX momentics IDE

you did not initialize the view and the scene, so you are trying to access Null-Pointers

 

QGraphicsView* view; -> QGraphicsView * view = new QGraphicsView()

Please use plain text.
Contributor
kosh0r
Posts: 21
Registered: ‎01-22-2013
My Device: BB10 Simulator, BB10 Dev Alpha B, Playbook OS 2.1
My Carrier: asdf

Re: Using Qt4 instead cascade from QNX momentics IDE

[ Edited ]

try this in ypour main-function

 

QApplicationapp(argc, argv);

 

// localization support

QTranslatortranslator;

 

QString locale_string = QLocale().name();

 

QString filename = QString( "YOUR_APP_NAME_%1" ).arg( locale_string );

 

if (translator.load(filename, "app/native/qm")) {

app.installTranslator( &translator );

}

QGraphicsView * view = newQGraphicsView();

 

QGraphicsScene * scene = newQGraphicsScene();

 

view->setScene(scene);

view->showFullScreen();

 

 

QLabel* test = newQLabel();

 

test->setText("Hello World");

scene->addWidget(test);

app.exec();

 

 

includes are:

#include<QtGui/QApplication>

#include<QtGui/QLabel>

#include<QLocale>

#include<QTranslator>

#include<Qt/qdeclarativedebug.h>

Please use plain text.