int main(int argc, char *argv[]) { Q_INIT_RESOURCE(embeddeddialogs); QApplication app(argc, argv); QGraphicsScene scene; scene.setStickyFocus(true); const int gridSize = 10; for (int y = 0; y < gridSize; ++y) { for (int x = 0; x < gridSize; ++x) { CustomProxy *proxy = new CustomProxy(0, Qt::Window); proxy->setWidget(new EmbeddedDialog); QRectF rect = proxy->boundingRect(); proxy->setPos(x * rect.width() * 1.05, y * rect.height() * 1.05); proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache); scene.addItem(proxy); } } scene.setSceneRect(scene.itemsBoundingRect()); QGraphicsView view(&scene); view.scale(0.5, 0.5); view.setRenderHints(view.renderHints() | QPainter::Antialiasing | QPainter::SmoothPixmapTransform); view.setBackgroundBrush(QPixmap(":/No-Ones-Laughing-3.jpg")); view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); view.show(); view.setWindowTitle("Embedded Dialogs Example"); return app.exec(); }
int main(int argc, char **argv) { QApplication a(argc, argv); QGraphicsScene scene; scene.setStickyFocus(true); for (int x = 0; x < 10; x++) { for (int y = 0; y < 4; y++) { proxy* p = new proxy(0, Qt::Window); p->setWidget(new Controller()); QRectF rect = p->boundingRect(); p->setPos(x * rect.width() * 1.05, y * rect.height() * 1.05); p->setCacheMode(QGraphicsItem::DeviceCoordinateCache); scene.addItem(p); } } scene.setSceneRect(scene.itemsBoundingRect()); QGraphicsView view(&scene); view.setRenderHints(view.renderHints()); view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); view.show(); view.setWindowTitle("More controllers for God controllers!"); return a.exec(); }