MQLEdit::MQLEdit(QWidget* parent, Qt::WindowFlags fl) : QWidget(parent, fl) { setupUi(this); if (OpenRPT::name.isEmpty()) OpenRPT::name = tr("MetaSQL Editor"); _mqlSelector = 0; _document = _text->document(); _document->setDefaultFont(QFont("Courier")); connect(_document, SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool))); connect(editFindAction, SIGNAL(triggered()), this, SLOT(editFind())); connect(fileDatabaseConnectAction, SIGNAL(triggered()), this, SLOT(fileDatabaseConnect())); connect(fileDatabaseDisconnectAction,SIGNAL(triggered()), this, SLOT(fileDatabaseDisconnect())); connect(fileDatabaseOpenAction, SIGNAL(triggered()), this, SLOT(fileDatabaseOpen())); connect(fileDatabaseSaveAsAction, SIGNAL(triggered()), this, SLOT(fileDatabaseSaveAs())); connect(fileExitAction, SIGNAL(triggered()), this, SLOT(fileExit())); connect(fileNewAction, SIGNAL(triggered()), this, SLOT(fileNew())); connect(fileOpenAction, SIGNAL(triggered()), this, SLOT(fileOpen())); connect(filePrintAction, SIGNAL(triggered()), this, SLOT(filePrint())); connect(fileSaveAction, SIGNAL(triggered()), this, SLOT(fileSave())); connect(fileSaveAsAction, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(helpAboutAction, SIGNAL(triggered()), this, SLOT(helpAbout())); connect(helpContentsAction, SIGNAL(triggered()), this, SLOT(helpContents())); connect(helpIndexAction, SIGNAL(triggered()), this, SLOT(helpIndex())); connect(searchForParametersAction, SIGNAL(triggered()), this, SLOT(populateParameterEdit())); connect(toolsExecute_QueryAction, SIGNAL(triggered()), this, SLOT(execQuery())); connect(toolsParse_QueryAction, SIGNAL(triggered()), this, SLOT(parseQuery())); connect(viewExecuted_SQLAction, SIGNAL(triggered()), this, SLOT(showExecutedSQL())); connect(viewLog_OutputAction, SIGNAL(triggered()), this, SLOT(showLog())); connect(viewParameter_ListAction, SIGNAL(triggered()), this, SLOT(showParamList())); connect(viewResultsAction, SIGNAL(triggered()), this, SLOT(showResults())); QSqlDatabase db = QSqlDatabase().database(); if(db.isValid() && db.isOpen()) OpenRPT::loggedIn = true; else { OpenRPT::loggedIn = false; db = QSqlDatabase(); } if (parent) // then must be embedded { if (DEBUG) qDebug("MQLEdit::MQLEdit(%p) OpenRPT::loggedIn = %d", parent, OpenRPT::loggedIn); fileDatabaseConnectAction->setVisible(! OpenRPT::loggedIn); fileDatabaseDisconnectAction->setVisible(! OpenRPT::loggedIn); fileExitAction->setText(tr("Close")); QToolBar *menuproxy = new QToolBar(this); menuproxy->setObjectName("menuproxy"); menuproxy->setOrientation(Qt::Horizontal); verticalLayout->insertWidget(0, menuproxy); menuproxy->addAction(fileMenu->menuAction()); menuproxy->addAction(editMenu->menuAction()); menuproxy->addAction(ViewMenu->menuAction()); menuproxy->addAction(ToolsMenu->menuAction()); menuproxy->addAction(helpMenu->menuAction()); } fileDatabaseConnectAction->setEnabled(!OpenRPT::loggedIn); fileDatabaseDisconnectAction->setEnabled(OpenRPT::loggedIn); fileDatabaseOpenAction->setEnabled(OpenRPT::loggedIn); fileDatabaseSaveAsAction->setEnabled(OpenRPT::loggedIn); _pEdit = new ParameterEdit(this, Qt::Window); _log = new LogOutput(this); _sql = new LogOutput(this); _results = new ResultsOutput(this); _highlighter = new MetaSQLHighlighter(_document); clear(); setDestType(MQLUnknown); }
bool TestWindow::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: fileNew(); break; case 1: fileOpen(); break; case 2: fileSave(); break; case 3: fileSaveAs(); break; case 4: filePrint(); break; case 5: fileExit(); break; case 6: editUndo(); break; case 7: editRedo(); break; case 8: editCut(); break; case 9: add(); break; case 10: editPaste(); break; case 11: editFind(); break; case 12: helpIndex(); break; case 13: helpContents(); break; case 14: helpAbout(); break; case 15: static_QUType_ptr.set(_o,remove()); break; case 16: begin(); break; case 17: end(); break; case 18: languageChange(); break; default: return QMainWindow::qt_invoke( _id, _o ); } return TRUE; }
vbox = new QVBoxLayout(this); vbox->setObjectName(QString::fromUtf8("hbox")); vbox->setContentsMargins(0, 0, 0, 0); vbox->setSpacing(0); vbox->addWidget(toolBar); vbox->addWidget(frame); } // setUi void CodeEditor::setConnect() { connect(plainEditor->document(), SIGNAL(modificationChanged(bool)), this, SLOT(modificationChanged(bool))); connect(plainEditor->document(), SIGNAL(modificationChanged(bool)), action_Save, SLOT(setEnabled(bool))); connect(action_New, SIGNAL(triggered()), this, SLOT(fileNew())); connect(action_Open, SIGNAL(triggered()), this, SLOT(fileOpen())); connect(action_Save, SIGNAL(triggered()), this, SLOT(fileSave())); connect(action_Save_All, SIGNAL(triggered()), this, SLOT(fileSaveAll())); connect(action_Save_As, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(plainEditor->document(), SIGNAL(undoAvailable(bool)), action_Undo, SLOT(setEnabled(bool))); connect(plainEditor->document(), SIGNAL(redoAvailable(bool)), action_Redo, SLOT(setEnabled(bool))); action_Save->setEnabled(plainEditor->document()->isModified()); action_Undo->setEnabled(plainEditor->document()->isUndoAvailable()); action_Redo->setEnabled(plainEditor->document()->isRedoAvailable()); connect(action_Undo, SIGNAL(triggered()), plainEditor, SLOT(undo()));
HtmlEditor::HtmlEditor(QWidget *parent) : QWidget(parent) , ui(new Ui_HtmlEditor) , sourceDirty(true) , highlighter(0) , ui_dialog(0) , insertHtmlDialog(0) { ui->setupUi(this); QPalette pal = ui->webView->page()->palette(); pal.setColor(QPalette::Base, Qt::gray); ui->webView->page()->setPalette(pal); ui->tabWidget->setTabText(0, tr("WYSIWYG Editor")); ui->tabWidget->setTabText(1, tr("View Source")); connect(ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(changeTab(int))); highlighter = new Highlighter(ui->plainTextEdit->document()); QWidget *spacer = new QWidget(this); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); ui->standardToolBar->insertWidget(ui->actionZoomOut, spacer); zoomLabel = new QLabel; ui->standardToolBar->insertWidget(ui->actionZoomOut, zoomLabel); zoomSlider = new QSlider(this); zoomSlider->setOrientation(Qt::Horizontal); zoomSlider->setMaximumWidth(150); zoomSlider->setRange(25, 400); zoomSlider->setSingleStep(25); zoomSlider->setPageStep(100); connect(zoomSlider, SIGNAL(valueChanged(int)), SLOT(changeZoom(int))); ui->standardToolBar->insertWidget(ui->actionZoomIn, zoomSlider); connect(ui->actionFileNew, SIGNAL(triggered()), SLOT(fileNew())); connect(ui->actionFileOpen, SIGNAL(triggered()), SLOT(fileOpen())); connect(ui->actionFileSave, SIGNAL(triggered()), SLOT(fileSave())); connect(ui->actionFileSaveAs, SIGNAL(triggered()), SLOT(fileSaveAs())); connect(ui->actionExit, SIGNAL(triggered()), SLOT(close())); connect(ui->actionInsertImage, SIGNAL(triggered()), SLOT(insertImage())); connect(ui->actionCreateLink, SIGNAL(triggered()), SLOT(createLink())); connect(ui->actionInsertHtml, SIGNAL(triggered()), SLOT(insertHtml())); connect(ui->actionZoomOut, SIGNAL(triggered()), SLOT(zoomOut())); connect(ui->actionZoomIn, SIGNAL(triggered()), SLOT(zoomIn())); // these are forward to internal QWebView FORWARD_ACTION(ui->actionEditUndo, QWebPage::Undo); FORWARD_ACTION(ui->actionEditRedo, QWebPage::Redo); FORWARD_ACTION(ui->actionEditCut, QWebPage::Cut); FORWARD_ACTION(ui->actionEditCopy, QWebPage::Copy); FORWARD_ACTION(ui->actionEditPaste, QWebPage::Paste); FORWARD_ACTION(ui->actionFormatBold, QWebPage::ToggleBold); FORWARD_ACTION(ui->actionFormatItalic, QWebPage::ToggleItalic); FORWARD_ACTION(ui->actionFormatUnderline, QWebPage::ToggleUnderline); // Qt 4.5.0 has a bug: always returns 0 for QWebPage::SelectAll connect(ui->actionEditSelectAll, SIGNAL(triggered()), SLOT(editSelectAll())); connect(ui->actionStyleParagraph, SIGNAL(triggered()), SLOT(styleParagraph())); connect(ui->actionStyleHeading1, SIGNAL(triggered()), SLOT(styleHeading1())); connect(ui->actionStyleHeading2, SIGNAL(triggered()), SLOT(styleHeading2())); connect(ui->actionStyleHeading3, SIGNAL(triggered()), SLOT(styleHeading3())); connect(ui->actionStyleHeading4, SIGNAL(triggered()), SLOT(styleHeading4())); connect(ui->actionStyleHeading5, SIGNAL(triggered()), SLOT(styleHeading5())); connect(ui->actionStyleHeading6, SIGNAL(triggered()), SLOT(styleHeading6())); connect(ui->actionStylePreformatted, SIGNAL(triggered()), SLOT(stylePreformatted())); connect(ui->actionStyleAddress, SIGNAL(triggered()), SLOT(styleAddress())); connect(ui->actionFormatFontName, SIGNAL(triggered()), SLOT(formatFontName())); connect(ui->actionFormatFontSize, SIGNAL(triggered()), SLOT(formatFontSize())); connect(ui->actionFormatTextColor, SIGNAL(triggered()), SLOT(formatTextColor())); connect(ui->actionFormatBackgroundColor, SIGNAL(triggered()), SLOT(formatBackgroundColor())); // no page action exists yet for these, so use execCommand trick connect(ui->actionFormatStrikethrough, SIGNAL(triggered()), SLOT(formatStrikeThrough())); connect(ui->actionFormatAlignLeft, SIGNAL(triggered()), SLOT(formatAlignLeft())); connect(ui->actionFormatAlignCenter, SIGNAL(triggered()), SLOT(formatAlignCenter())); connect(ui->actionFormatAlignRight, SIGNAL(triggered()), SLOT(formatAlignRight())); connect(ui->actionFormatAlignJustify, SIGNAL(triggered()), SLOT(formatAlignJustify())); connect(ui->actionFormatDecreaseIndent, SIGNAL(triggered()), SLOT(formatDecreaseIndent())); connect(ui->actionFormatIncreaseIndent, SIGNAL(triggered()), SLOT(formatIncreaseIndent())); connect(ui->actionFormatNumberedList, SIGNAL(triggered()), SLOT(formatNumberedList())); connect(ui->actionFormatBulletedList, SIGNAL(triggered()), SLOT(formatBulletedList())); // necessary to sync our actions connect(ui->webView->page(), SIGNAL(selectionChanged()), SLOT(adjustActions())); connect(ui->webView->page(), SIGNAL(contentsChanged()), SLOT(adjustSource())); ui->webView->setFocus(); setCurrentFileName(QString()); fileNew(); adjustActions(); adjustSource(); setWindowModified(false); // changeZoom(100); }
void TextEdit::setupFileActions() { QToolBar *tb = new QToolBar(this); tb->setWindowTitle(tr("File Actions")); addToolBar(tb); // QMenu *menu = new QMenu(tr("&File"), this); // menuBar()->addMenu(menu); QAction *a; QIcon newIcon = QIcon::fromTheme("document-new", QIcon(rsrcPath + "/filenew.png")); a = new QAction( newIcon, tr("&New"), this); a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::New); connect(a, SIGNAL(triggered()), this, SLOT(fileNew())); tb->addAction(a); // menu->addAction(a); a = new QAction(QIcon::fromTheme("document-open", QIcon(rsrcPath + "/fileopen.png")), tr("&Open..."), this); a->setShortcut(QKeySequence::Open); connect(a, SIGNAL(triggered()), this, SLOT(fileOpen())); tb->addAction(a); // menu->addAction(a); // menu->addSeparator(); actionSave = a = new QAction(QIcon::fromTheme("document-save", QIcon(rsrcPath + "/filesave.png")), tr("&Save"), this); a->setShortcut(QKeySequence::Save); connect(a, SIGNAL(triggered()), this, SLOT(fileSave())); a->setEnabled(false); tb->addAction(a); // menu->addAction(a); a = new QAction(tr("Save &As..."), this); a->setPriority(QAction::LowPriority); connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs())); // menu->addAction(a); // menu->addSeparator(); #ifndef QT_NO_PRINTER a = new QAction(QIcon::fromTheme("document-print", QIcon(rsrcPath + "/fileprint.png")), tr("&Print..."), this); a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Print); connect(a, SIGNAL(triggered()), this, SLOT(filePrint())); tb->addAction(a); // menu->addAction(a); a = new QAction(QIcon::fromTheme("fileprint", QIcon(rsrcPath + "/fileprint.png")), tr("Print Preview..."), this); connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview())); // menu->addAction(a); a = new QAction(QIcon::fromTheme("exportpdf", QIcon(rsrcPath + "/exportpdf.png")), tr("&Export PDF..."), this); a->setPriority(QAction::LowPriority); a->setShortcut(Qt::CTRL + Qt::Key_D); connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf())); tb->addAction(a); // menu->addAction(a); // menu->addSeparator(); #endif a = new QAction(tr("&Quit"), this); a->setShortcut(Qt::CTRL + Qt::Key_Q); connect(a, SIGNAL(triggered()), this, SLOT(close())); // menu->addAction(a); }
TextEdit::TextEdit(QWidget *parent) : QMainWindow(parent) { setToolButtonStyle(Qt::ToolButtonFollowStyle); setupFileActions(); setupEditActions(); setupTextActions(); { // QMenu *helpMenu = new QMenu(tr("Help"), this); // menuBar()->addMenu(helpMenu); // helpMenu->addAction(tr("About"), this, SLOT(about())); // helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); } textEdit = new QTextEdit(this); ////////////////////////////////////////////////// connect(textEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat))); connect(textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged())); /////////// //setCentralWidget(textEdit); //blank=new Blank(this); //setCentralWidget(blank); //create a transparent canvas and put it on the top of textEdit image =new MyCanvas(900,800,this); textEdit->setFixedSize(QSize(800,800)); textEdit->setBackgroundRole(QPalette::Light); //scrollArea对象的背景色设为Dark image->setFixedSize(QSize(800,800)); image->setStyleSheet(QString::fromUtf8("border:1px solid #000000;")); QScrollArea* scrollArea = new QScrollArea; scrollArea->setFixedSize(QSize(1800,900)); //scrollArea->setWidget(image); //将画布添加到scrollArea中 scrollArea->setBackgroundRole(QPalette::Light); //scrollArea对象的背景色设为Dark //scrollArea->setBackgroundColor(QColor::white); // QStackedLayout *stackedLayout = new QStackedLayout; // stackedLayout->addWidget(image); // stackedLayout->addWidget(textEdit); // stackedLayout->setStackingMode(QStackedLayout::StackAll); QHBoxLayout* hLayout=new QHBoxLayout(); hLayout->addWidget(textEdit); hLayout->addWidget(image); // scrollArea->setLayout(stackedLayout); scrollArea->setLayout(hLayout); //scrollArea->setGeometry(QRect(50,50,800,800)); setCentralWidget(scrollArea); //将scrollArea加入到主窗口的中心区new QPainter(this); scrollArea->setAlignment(Qt::AlignHCenter); //after canvas handle the mouse-drag event, emit it to the edittext for farther handling connect(image,SIGNAL(mouseMoveSig(QMouseEvent*)),this,SLOT(onMouseMove(QMouseEvent*))); //connect(image,SIGNAL(mouseMoveSig(QMouseEvent*)),textEdit,SLOT(mouseMoveEvent(QMouseEvent*))); //connect(image,SIGNAL(mouseMoveSig(QMouseEvent*)),textEdit,SLOT(cursorPositionChanged(QMouseEvent*))); //connect(this,SIGNAL(mouseMoveSig(QMouseEvent*)),image,SLOT(mouseMoveSlot(QMouseEvent*))); //connect(textEdit,SIGNAL(mouseMoveEvent(QMouseEvent*)),image,SLOT(mouseMoveSlot(QMouseEvent*))); // textEdit->setFocus(); setCurrentFileName(QString()); fontChanged(textEdit->font()); colorChanged(textEdit->textColor()); alignmentChanged(textEdit->alignment()); connect(textEdit->document(), SIGNAL(modificationChanged(bool)), actionSave, SLOT(setEnabled(bool))); connect(textEdit->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool))); connect(textEdit->document(), SIGNAL(undoAvailable(bool)), actionUndo, SLOT(setEnabled(bool))); connect(textEdit->document(), SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool))); setWindowModified(textEdit->document()->isModified()); actionSave->setEnabled(textEdit->document()->isModified()); actionUndo->setEnabled(textEdit->document()->isUndoAvailable()); actionRedo->setEnabled(textEdit->document()->isRedoAvailable()); connect(actionUndo, SIGNAL(triggered()), textEdit, SLOT(undo())); connect(actionRedo, SIGNAL(triggered()), textEdit, SLOT(redo())); actionCut->setEnabled(false); actionCopy->setEnabled(false); connect(actionCut, SIGNAL(triggered()), textEdit, SLOT(cut())); connect(actionCopy, SIGNAL(triggered()), textEdit, SLOT(copy())); connect(actionPaste, SIGNAL(triggered()), textEdit, SLOT(paste())); connect(textEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool))); connect(textEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool))); #ifndef QT_NO_CLIPBOARD connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); #endif //QString initialFile = ":/data/example.html"; QString initialFile = ":/data/test.txt"; const QStringList args = QCoreApplication::arguments(); if (args.count() == 2) initialFile = args.at(1); if (!load(initialFile)) fileNew(); }
void Opeke::setupActions() { KStandardAction::openNew ( this, SLOT ( fileNew() ), actionCollection() ); KStandardAction::quit ( qApp, SLOT ( quit() ), actionCollection() ); KStandardAction::save ( this, SLOT ( saveFile() ), actionCollection() ); KStandardAction::open ( this, SLOT ( openFile() ), actionCollection() ); KStandardAction::saveAs ( this, SLOT ( saveFileAs() ), actionCollection() ); KStandardAction::preferences ( this, SLOT ( optionsPreferences() ), actionCollection() ); undoAct = KStandardAction::undo (m_view, SLOT(undo()), actionCollection() ); redoAct = KStandardAction::redo (m_view, SLOT(redo()), actionCollection() ); removeAct = KStandardAction::cut (m_view, SLOT(delBrick()), actionCollection()); removeAct->setShortcut(QKeySequence(Qt::Key_Delete)); removeAct->setText( i18n ("Delete")); removeAct->setEnabled(false); // The action to start building Bricks in OGRE KAction *build = new KAction ( KIcon ( "build" ), i18n ( "Build" ), this ); build->setShortcut(QKeySequence(Qt::Key_B)); actionCollection()->addAction ( QLatin1String ( "build_action" ), build ); connect ( build, SIGNAL ( triggered ( bool ) ), m_view, SLOT ( setBuildMode() ) ); // Start select mode KAction *select = new KAction ( KIcon ( "select" ), i18n ( "S&elect" ), this ); select->setShortcut(QKeySequence(Qt::Key_E)); actionCollection()->addAction ( QLatin1String ( "select_action" ), select ); connect ( select, SIGNAL ( triggered ( bool ) ), m_view, SLOT ( setSelectMode() ) ); // Enable or disable grid KAction *grid = new KAction (KIcon ( "grid" ), i18n ("Toggle &Grid"), this); grid->setShortcut(QKeySequence(Qt::Key_G)); actionCollection()->addAction(QLatin1String("grid_action"), grid); connect (grid, SIGNAL (triggered (bool)), m_view, SLOT (flipGridEnabled() )); // Actions to choose what kind of Brick to build KAction *block = new KAction (KIcon ( "block" ), i18n ("Build B&lock"), this); block->setShortcut(QKeySequence(Qt::Key_L)); actionCollection()->addAction(QLatin1String("block_action"), block); connect (block, SIGNAL (triggered (bool)), m_view, SLOT (changeTypeBlock() )); connect (block, SIGNAL (triggered (bool)), m_view, SLOT (setBuildMode() )); KAction *roof = new KAction (KIcon ( "roof" ), i18n ("Build &Roof"), this); roof->setShortcut(QKeySequence(Qt::Key_R)); actionCollection()->addAction(QLatin1String("roof_action"), roof); connect (roof, SIGNAL (triggered (bool)), m_view, SLOT (changeTypeRoof())); connect (roof, SIGNAL (triggered (bool)), m_view, SLOT (setBuildMode() )); KAction *cylinder = new KAction (KIcon ( "cylinder" ), i18n ("Build &Cylinder"), this); cylinder->setShortcut(QKeySequence(Qt::Key_C)); actionCollection()->addAction(QLatin1String("cylinder_action"), cylinder); connect (cylinder, SIGNAL (triggered (bool)), m_view, SLOT (changeTypeCylinder() )); connect (cylinder, SIGNAL (triggered (bool)), m_view, SLOT (setBuildMode() )); KAction *invCyl = new KAction (KIcon ("invCyl"), i18n ("Build &Inverted Cylinder"), this); invCyl->setShortcut(QKeySequence(Qt::Key_I)); actionCollection()->addAction(QLatin1String("invCyl_action"), invCyl); connect (invCyl, SIGNAL (triggered (bool)), m_view, SLOT (changeTypeInvCyl() )); connect (invCyl, SIGNAL (triggered (bool)), m_view, SLOT (setBuildMode() )); KAction *sphere = new KAction (KIcon ("sphere"), i18n ("Build &Sphere"), this); sphere->setShortcut(QKeySequence(Qt::Key_S)); actionCollection()->addAction(QLatin1String("sphere_action"), sphere); connect (sphere, SIGNAL (triggered (bool)), m_view, SLOT (changeTypeSphere() )); connect (sphere, SIGNAL (triggered (bool)), m_view, SLOT (setBuildMode() )); KAction *cone = new KAction (KIcon ( "cone" ), i18n ("Build Co&ne"), this); cone->setShortcut(QKeySequence(Qt::Key_N)); actionCollection()->addAction(QLatin1String("cone_action"), cone); connect (cone, SIGNAL (triggered (bool)), m_view, SLOT (changeTypeCone() )); connect (cone, SIGNAL (triggered (bool)), m_view, SLOT (setBuildMode() )); KAction *corner = new KAction (KIcon ( "corner" ), i18n ("Build Roof C&orner"), this); corner->setShortcut(QKeySequence(Qt::Key_O)); actionCollection()->addAction(QLatin1String("corner_action"), corner); connect (corner, SIGNAL (triggered (bool)), m_view, SLOT (changeTypeCorner() )); connect (corner, SIGNAL (triggered (bool)), m_view, SLOT (setBuildMode() )); KAction *invrcor = new KAction (KIcon ( "invrcor" ), i18n ("Build In&verted Roof Corner"), this); invrcor->setShortcut(QKeySequence(Qt::Key_V)); actionCollection()->addAction(QLatin1String("invrcor_action"), invrcor); connect (invrcor, SIGNAL (triggered (bool)), m_view, SLOT (changeTypeInvCorner() )); connect (invrcor, SIGNAL (triggered (bool)), m_view, SLOT (setBuildMode() )); KAction *pyramid = new KAction (KIcon ( "pyramid" ), i18n ("Build &Pyramid"), this); pyramid->setShortcut(QKeySequence(Qt::Key_P)); actionCollection()->addAction(QLatin1String("pyramid_action"), pyramid); connect (pyramid, SIGNAL (triggered (bool)), m_view, SLOT (changeTypePyramid() )); connect (pyramid, SIGNAL (triggered (bool)), m_view, SLOT (setBuildMode() )); KAction *snapshot = new KAction (KIcon ("ksnapshot"), i18n ("&Take Screenshot"), this); snapshot->setShortcut(QKeySequence("Ctrl+T")); actionCollection()->addAction(QLatin1String("snapshot_action"), snapshot); connect (snapshot, SIGNAL(triggered(bool)), this, SLOT (saveScreen())); // Reload the field after loading a new file connect ( this, SIGNAL ( reload() ), m_view, SLOT ( update() ) ); connect ( this, SIGNAL ( clear() ), m_view, SLOT ( newScene() ) ); connect ( m_tool, SIGNAL ( colorViewed ( QColor ) ), m_view, SLOT ( viewColor ( QColor ) ) ); connect ( m_tool, SIGNAL ( colorChanged ( QColor ) ), m_view, SLOT ( setColor ( QColor ) ) ); connect ( m_tool, SIGNAL ( planeChanged ( int ) ), m_view, SLOT ( setPlaneZ ( int ) ) ); connect ( m_tool, SIGNAL ( sizeXChanged ( int ) ), m_view, SLOT ( setSizeX ( int ) ) ); connect ( m_tool, SIGNAL ( sizeYChanged ( int ) ), m_view, SLOT ( setSizeY ( int ) ) ); connect ( m_tool, SIGNAL ( sizeZChanged ( int ) ), m_view, SLOT ( setSizeZ ( int ) ) ); connect ( m_view, SIGNAL(planeChanged(int)), m_tool, SLOT(changePlaneZ(int))); connect ( m_view, SIGNAL(undoEmpty(bool)), this, SLOT(undoEnable(bool))); connect ( m_view, SIGNAL(redoEmpty(bool)), this, SLOT(redoEnable(bool))); connect ( m_view, SIGNAL(delEnable(bool)), this, SLOT(removeEnable(bool))); connect ( m_view, SIGNAL(modified()), this, SLOT(fileModified())); connect (m_tool, SIGNAL(rotX()), m_view, SLOT(rotateX())); connect (m_tool, SIGNAL(rotY()), m_view, SLOT(rotateY())); connect (m_tool, SIGNAL(rotZ()), m_view, SLOT(rotateZ())); }