void MainWindow::on_actionAdd_Items_triggered() { qreal w = ui->graphicsView->width(); qreal h = ui->graphicsView->height(); _scene.addRect(0, 0, w, h); for(int i = 0; i < 2000; i++) { addTextItem(w, h); } }
//------------------------------------------------------------------------- void MainWindow::createActions() { mSettings.mDesactiveUIElements << ADD_FROM_FILE_ACT; GraphicsSceneMainWindow::createActions(); mExportAct = new QAction(QIcon(RSC_DIR + QString("export.png")), tr("&Export...") , this); mExportAct->setShortcut( tr("Ctrl+E") ); mExportAct->setStatusTip(tr("Export the scene, an item, or use Shift+Drag&Drop to specify an export-window")); connect(mExportAct , SIGNAL(triggered()) , this , SLOT(exportToImage()) ); mAddTextAct = new QAction(QIcon(RSC_DIR + QString("addText.png")), tr("Add text item") , this); mAddTextAct->setStatusTip(tr("Add a text item to the scene")); connect(mAddTextAct , SIGNAL(triggered()) , this , SLOT(addTextItem()) ); mAddFromAnyFileAct = new QAction(QIcon(RSC_DIR + QString("addFromAnyFile.png")), tr("Add item from file...") , this); mAddFromAnyFileAct->setStatusTip("Add a new item from a file"); connect(mAddFromAnyFileAct , SIGNAL(triggered()) , this , SLOT(addItemFromAnyFile()) ); mSetPageA4PortraitAct = new QAction(tr("A4 Portrait") , this); connect(mSetPageA4PortraitAct , SIGNAL(triggered()) , this , SLOT(setPageA4Portrait()) ); mSetPageA3PortraitAct = new QAction(tr("A3 Portrait") , this); connect(mSetPageA3PortraitAct , SIGNAL(triggered()) , this , SLOT(setPageA3Portrait()) ); mSetPageA4LandscapeAct = new QAction(tr("A4 Landscape") , this); connect(mSetPageA4LandscapeAct , SIGNAL(triggered()) , this , SLOT(setPageA4Landscape()) ); mSetPageA3LandscapeAct = new QAction(tr("A3 Landscape") , this); connect(mSetPageA3LandscapeAct , SIGNAL(triggered()) , this , SLOT(setPageA3Landscape()) ); #ifdef USES_GUIDO_AR mPlayAct = new QAction(style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this); mPlayAct->setStatusTip(tr("Play selected item")); connect( mPlayAct , SIGNAL(triggered()) , this , SLOT(playItem()) ); mPauseAct = new QAction(style()->standardIcon(QStyle::SP_MediaPause), tr("Pause"), this); mPauseAct->setStatusTip(tr("Pause selected item")); connect( mPauseAct , SIGNAL(triggered()) , this , SLOT(pauseItem()) ); mStopAct = new QAction(style()->standardIcon(QStyle::SP_MediaStop), tr("Stop"), this); mStopAct->setStatusTip(tr("Stop selected item")); connect( mStopAct , SIGNAL(triggered()) , this , SLOT(stopItem()) ); #endif }