I'm trying to learn Qt by developing a simple GUI. Part of what I need to do is add a rectangle to one of three QGraphicsView areas I have made. I used the following code
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow){
ui->setupUi(this);
QGraphicsRectItem rect;
rect.setRect(10,10,10,10);
ui->graphicsView->scene()->addRect(rect.rect());
}
However while this compiles just fine, my program does not run at all, in fact upon reaching the last line it immediately exits, does anyone know what the issue could be? (Apologies for formatting, first time poster)