QGraphicsScene problem/bug
Taken directly from the Qt 4.5.2 documentation, in the Detailed Description of QGraphicsGridLayout:
Code:
QGraphicsWidget
*textEdit
= scene.
addWidget(new QTextEdit);
QGraphicsWidget
*pushButton
= scene.
addWidget(new QPushButton);
QGraphicsGridLayout *layout = new QGraphicsGridLayout;
layout->addItem(textEdit, 0, 0);
layout->addItem(pushButton, 0, 1);
QGraphicsWidget *form = new QGraphicsWidget;
form->setLayout(layout);
scene.addItem(form);
First problem: I don't see anything if I wrap this in a simple QApplication:
Code:
int main()
{
//the above code, with the first line:
//QGraphicsScene scene(widget);
widget->show();
return app.exec();
}
This structure is really important, but when I try to implement it in my class's constructor, it won't compile. What's wrong here? Thanks!
Re: QGraphicsScene problem/bug
..you don't see anything because you have to show the scene or set it to your widget, using layouts!
Code:
int main()
{
//the above code
scene.show();
return app.exec();
}
Re: QGraphicsScene problem/bug
It might be worth actually having a QGraphicsView somewhere...