代码改变世界

QT画图

2017-09-14 20:10  nigaopeng  阅读(240)  评论(0编辑  收藏  举报
if (0)
    {
        QApplication a(argv, args);

        QGraphicsScene scene;
        scene.setSceneRect(-300,-300,600,600);
        scene.setItemIndexMethod(QGraphicsScene::NoIndex);
#if 0
        {
            QString name = "dec0";
            QGraphicsItemGroup* dec = createIPU(name, 0, 0);
            scene.addItem(dec);

            //QString name = "display";
            QGraphicsItemGroup* ids = createIPU("display", 50, 50);
            scene.addItem(ids);
        }
#endif

        QGraphicsView view(&scene);
        view.setRenderHint(QPainter::Antialiasing);
        view.setCacheMode(QGraphicsView::CacheBackground);
        view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
        view.setDragMode(QGraphicsView::ScrollHandDrag);
        view.resize(400,300);
        view.show();
        return a.exec();
    }