You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

22 lines
474 B

#include <QApplication>
#include <QGraphicsView>
#include <QGraphicsScene>
#include "MyRect.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MyRect* rect = new MyRect();
rect->setRect(0,0,100,100);
rect->setFlag(QGraphicsItem::ItemIsFocusable);
rect->setFocus();
QGraphicsScene* scene = new QGraphicsScene();
scene->addItem(rect);
QGraphicsView* view = new QGraphicsView(scene);
view->show();
return a.exec();
}