Created
January 13, 2016 16:04
-
-
Save mitchcurtis/8526eb7155c589166087 to your computer and use it in GitHub Desktop.
Custom QGraphicsRectItem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QtWidgets> | |
class RectItem : public QGraphicsRectItem | |
{ | |
public: | |
RectItem() | |
{ | |
setRect(0, 0, 40, 40); | |
} | |
}; | |
int main(int argc, char *argv[]) | |
{ | |
QApplication app(argc, argv); | |
QGraphicsView view; | |
QGraphicsScene *scene = new QGraphicsScene(&view); | |
RectItem *rectItem = new RectItem; | |
scene->addItem(rectItem); | |
view.setScene(scene); | |
view.resize(400, 400); | |
view.show(); | |
return app.exec(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment