Ok, I'm missing something simple here. For some reason, QPainter isn't displaying anything. I thought this code should simply fill the background of the scene with blue. Any ideas? This is the entirety of my code:
#include <QtGui>
int main(int argc, char **argv){
view.setScene(&scene);
QRectF sceneRect
= scene.
sceneRect();
painter.fillRect(sceneRect, Qt::blue);
view.show();
return app.exec();
}
#include <QtGui>
int main(int argc, char **argv){
QApplication app(argc, argv);
QGraphicsView view;
QGraphicsScene scene;
view.setScene(&scene);
QPainter painter;
QRectF sceneRect = scene.sceneRect();
painter.fillRect(sceneRect, Qt::blue);
view.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks