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
Contributor
pmpascua
Posts: 11
Registered: ‎02-21-2013
My Device: BB10
My Carrier: Koodo

Unable to use Qimage and QPainter

Hi Im very new at Cascades but I have a good background in programming. I made a new project based on the sample app called "scratchpad" that uses QImage and Qpainter but when I build it I get this error

 

Could not find qmake configuration directoryCould not find qmake configuration fileUsing OS scope before setting MAKEFILE_GENERATOR../src/Paint.cpp:13:18: fatal error: QImage: No such file or directory

 and it occurs on this line

#include <QImage>
$include <QPainter>

 

which is kinda weird because I know that I incude the library called QtCore using the Project > Add library and at the Properties > C/C++ general > path and symbol and it compiles on the sample app with the same setting so it should work but it doesnt :smileysad: I've looked at the API reference of it and there is no QImage and Qpainter on the QtCore library so do I need to import something else?

Please use plain text.
Developer
kunal_one
Posts: 145
Registered: ‎12-23-2012
My Device: BB10 Dev Alpha
My Carrier: wifi

Re: Unable to use Qimage and QPainter

I assume that $ sign is just a typo ?

$include <QPainter>
Please use plain text.
Contributor
pmpascua
Posts: 11
Registered: ‎02-21-2013
My Device: BB10
My Carrier: Koodo

Re: Unable to use Qimage and QPainter

lol that was a typo on my part though that's not the source of the error cause otherwise it would be a syntax error rather than a linkage error
Please use plain text.
New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha
My Carrier: Kievstar

Re: Unable to use Qimage and QPainter

You cannot use any QtGui things in Casacades app
Qt/Symbian/Meego/BB10/Cascades developer
Please use plain text.
Developer
oliver_kranz
Posts: 216
Registered: ‎09-18-2009
My Device: Z10
My Carrier: O2

Re: Unable to use Qimage and QPainter

[ Edited ]

In QNX Momentics you can select the class you want to include and type Ctrl + Shift + N. In the popup you can select the header you want to include. For QImage and QPainter this shows for me:

 

#include <Qt/qimage.h>
#include <Qt/qpainter.h>

 

You also have to configure your .pro file correctly. There SOURCES, HEADERS and LIBS should be configured correctly.

 

SOURCES += ../src/*.cpp
HEADERS += ../src/*.hpp
LIBS += -lbb

 In the .pro file you should add the configuration according to your project.

Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Unable to use Qimage and QPainter

Hi,

Have you created the project from Cascades project template? Is the following line present in pro file?
CONFIG += qt

I was able to create QImage instance without including any headers.

Maybe SDK isn't properly configured, could you try to reinstall the latest one?

Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Contributor
pmpascua
Posts: 11
Registered: ‎02-21-2013
My Device: BB10
My Carrier: Koodo

Re: Unable to use Qimage and QPainter

Thanks for the reply and provided some good solutions for me even though I havent tried it yet. Though I think I add a line 

LIBS += -lbb

 on my .pro config though I havent tried with the inclusion yet. In the sample app, they declare the class like this

namespace Draw{
   ....
}

 so I did the same thing with Paint (the class that got the linkage error) so wouldnt be better to do it like this

class Paint: extend QObject{
}

 or something like that

Please use plain text.