[Qt-interest] How to fix the crash problem when using QGraphicsView on QMainWindow with QLineEdit
Steven Chang
steven01 at ms3.hinet.net
Tue May 4 19:26:36 CEST 2010
Dear Sir,
I created a QLineEdit in QMainWindow class as below:
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
lineEdit = new QLineEdit(this);
}
Then I created a QGraphicsView and QGraphicsScene in main.cpp and set
MainWindow as the view widget.
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
QGraphicsScene gScene;
gScene.addWidget(&w);
QGraphicsView gView;
gView.setScene(&gScene);
gView.adjustSize();
gView.show();
return a.exec();
}
But after built the App and executed it, the App would crash if I type any
character in lineEdit.
How do I fix this problem?
Best Regards,
Steven
More information about the Qt-interest-old
mailing list