I have the following code
#include <QGraphicsScene>
#include <QMessageBox>
#include "proFootballOnline.h"
//
ProFootballOnline
::ProFootballOnline( QWidget * parent, Qt
::WFlags f
) {
setupUi(this);
}
void ProFootballOnline::Init ()
{
}
void ProFootballOnline::on_initPB_clicked()
{
scene.addText("Bob");
//scene.setItemIndexMethod(QGraphicsScene::NoIndex);
//fieldGV->setBackgroundBrush(Qt::green);
fieldGV->setScene(&scene);
fieldGV->update();
}
#include <QGraphicsScene>
#include <QMessageBox>
#include "proFootballOnline.h"
//
ProFootballOnline::ProFootballOnline( QWidget * parent, Qt::WFlags f)
: QMainWindow(parent, f)
{
setupUi(this);
}
void ProFootballOnline::Init ()
{
}
void ProFootballOnline::on_initPB_clicked()
{
QGraphicsScene scene;
scene.addText("Bob");
//scene.setItemIndexMethod(QGraphicsScene::NoIndex);
//fieldGV->setBackgroundBrush(Qt::green);
fieldGV->setScene(&scene);
fieldGV->update();
}
To copy to clipboard, switch view to plain text mode
When the program runs and the initPB is clicked, the program closes a does a core dump. I ran it through a debugger and, depending on what I try to do with the scene, faults on various things (setBackground, setItemIndexMode). The fieldGV is a QGraphicsView I have on my main window. Any ideas on what is causing the crash? If I place a QMessageBox at the end of the slot, i can see the contents of fieldGV update properly but closing the box sets off the core dump.
mAx
Bookmarks