On 04/13/2011 07:55 PM, Chen, Zhang Z wrote:
Forwarding to meego-dev
*From:* [email protected]
[mailto:[email protected]] *On Behalf Of *Pai, Cary
*Sent:* Thursday, April 14, 2011 10:14 AM
*To:* [email protected]
*Subject:* [MeeGo-SDK] Can MTF application use QWidget?
Hi, All,
I have created a MTF application, but when I run the application with
the QPushButton add into MApplicationPage, it will have the
segmentation fault, why MTF can’t add the QWidget based item? The code
I wrote are as below :
int main(int argc, char *argv[])
{
MApplication a(argc, argv);
MApplicationWindow w;
MApplicationPage p;
QPushButton* but = new QPushButton("test");
p.scene()->addWidget(but);
p./appear/(&w);
w.show();
return a.exec();
}
Since the p.scene() is QGraphicsScene why it will have the error on
runtime?
Your attempting to mix QGraphics programing with QWidget programming.
It is possible to wrap a QWidget for use in a QGraphicsView, but it
comes at a cost and is usually the wrong answer.
For example... if you wanted to add button into an MTF based app, just
use MButton (or whatever the name of the associated button class is.)
I would advise sitting down and reading through all the QGraphicsView
programming documentation and tutorials that come with Qt. Once you
comprehend QGraphicsView then MTF programming will make a lot more sense.
--rusty
_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev
http://wiki.meego.com/Mailing_list_guidelines