这篇教程C++ undo函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中undo函数的典型用法代码示例。如果您正苦于以下问题:C++ undo函数的具体用法?C++ undo怎么用?C++ undo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了undo函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Selection_Flipzvoid Selection_Flipz (void){ UndoableCommand undo("mirrorSelected -axis z"); Select_FlipAxis(2);}
开发者ID:chrisglass,项目名称:ufoai,代码行数:5,
示例2: QWidgetQFEHelpEditorWidget::QFEHelpEditorWidget(QWidget* parent) : QWidget(parent), ui(new Ui::QFEHelpEditorWidget){ modified=false; newScript=true; ui->setupUi(this); ui->edtScript->getEditor()->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); ui->edtScript->getEditor()->setLineWrapMode(QTextEdit::WidgetWidth); connect(ui->edtScript->getEditor()->document(), SIGNAL(contentsChanged()), this, SLOT(documentWasModified())); highlighter=new QFHTMLHighlighter("", ui->edtScript->getEditor()->document()); highlighter->setUseSpecial2("$(", ")$"); highlighter->setUseSpecial1("$$", "$$"); completer = new QCompleter(ui->edtScript->getEditor()); completermodel=modelFromFile(ProgramOptions::getInstance()->getAssetsDirectory()+"/qtscript/completer.txt"); completer->setModel(completermodel); completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setWrapAround(false); ui->edtScript->getEditor()->setCompleter(completer); recentHelpFiles=new QRecentFilesMenu(this); recentHelpFiles->setUseSystemFileIcons(false); recentHelpFiles->setAlwaysEnabled(true); connect(recentHelpFiles, SIGNAL(openRecentFile(QString)), this, SLOT(openScriptNoAsk(QString))); ui->btnOpen->setMenu(recentHelpFiles); connect(ui->edtScript->getEditor(), SIGNAL(cursorPositionChanged()), this, SLOT(edtScript_cursorPositionChanged())); actLoadAutosave=new QFActionWithNoMenuRole(tr("load last autosaved file ..."), this); connect(actLoadAutosave, SIGNAL(triggered()), this, SLOT(reloadLastAutosave())); cutAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_cut.png"), tr("Cu&t"), this); cutAct->setShortcut(tr("Ctrl+X")); cutAct->setToolTip(tr("Cut the current selection's contents to the " "clipboard")); connect(cutAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(cut())); copyAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_copy.png"), tr("&Copy"), this); copyAct->setShortcut(tr("Ctrl+C")); copyAct->setToolTip(tr("Copy the current selection's contents to the " "clipboard")); connect(copyAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(copy())); pasteAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_paste.png"), tr("&Paste"), this); pasteAct->setShortcut(tr("Ctrl+V")); pasteAct->setToolTip(tr("Paste the clipboard's contents into the current " "selection")); connect(pasteAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(paste())); undoAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_undo.png"), tr("&Undo"), this); undoAct->setShortcut(tr("Ctrl+Z")); undoAct->setToolTip(tr("Undo the last change ")); connect(undoAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(undo())); redoAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_redo.png"), tr("&Redo"), this); redoAct->setShortcut(tr("Ctrl+Shift+Z")); redoAct->setToolTip(tr("Redo the last undone change ")); connect(redoAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(redo())); findAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find.png"), tr("&Find ..."), this); findAct->setShortcut(tr("Ctrl+F")); findAct->setToolTip(tr("Find a string in sequence ")); connect(findAct, SIGNAL(triggered()), this, SLOT(findFirst())); findNextAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find_next.png"), tr("Find &next"), this); findNextAct->setShortcut(tr("F3")); findNextAct->setToolTip(tr("Find the next occurence ")); connect(findNextAct, SIGNAL(triggered()), this, SLOT(findNext())); findNextAct->setEnabled(false); replaceAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find_replace.png"), tr("Find && &replace ..."), this); replaceAct->setShortcut(tr("Ctrl+R")); replaceAct->setToolTip(tr("Find a string in sequence and replace it with another string ")); connect(replaceAct, SIGNAL(triggered()), this, SLOT(replaceFirst())); commentAct = new QFActionWithNoMenuRole(tr("&Comment text"), this); commentAct->setShortcut(tr("Ctrl+B")); commentAct->setToolTip(tr("add (single line) comment at the beginning of each line ")); connect(commentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(comment())); unCommentAct = new QFActionWithNoMenuRole(tr("&Uncomment text"), this); unCommentAct->setShortcut(tr("Ctrl+Shift+B")); unCommentAct->setToolTip(tr("remove (single line) comment at the beginning of each line ")); connect(unCommentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(uncomment())); indentAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_indent.png"), tr("&Increase indention"), this); commentAct->setShortcut(tr("Ctrl+I")); indentAct->setToolTip(tr("increase indention ")); connect(indentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(indentInc())); unindentAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_unindent.png"), tr("&Decrease indention"), this); unindentAct->setShortcut(tr("Ctrl+Shift+I"));//.........这里部分代码省略.........
开发者ID:jkriege2,项目名称:QuickFit3,代码行数:101,
示例3: QActionvoid MainWindow::createActions() { m_newAction = new QAction(this); m_newAction->setText(tr("&New")); m_newAction->setShortcut(QKeySequence::New); m_newAction->setIcon(QIcon(":/images/document-new.png")); m_newAction->setStatusTip(tr("Create a new, in memory, SQLite database")); connect(m_newAction, SIGNAL(triggered()), this, SLOT(openMemoryDatabase())); m_openAction = new QAction(this); m_openAction->setText(tr("&Open")); m_openAction->setShortcut(QKeySequence::Open); m_openAction->setIcon(QIcon(":/images/document-open.png")); m_openAction->setStatusTip(tr("Open an existing SQLite database")); connect(m_openAction, SIGNAL(triggered()), this, SLOT(openDatabase())); m_saveAction = new QAction(this); m_saveAction->setText(tr("&Save")); m_saveAction->setShortcut(QKeySequence::Save); m_saveAction->setStatusTip(tr("Save the database")); connect(m_saveAction, SIGNAL(triggered()), m_dbWidget, SIGNAL(commit())); m_saveAsAction = new QAction(this); m_saveAsAction->setText(tr("Save &As...")); m_saveAsAction->setShortcut(QKeySequence::SaveAs); m_saveAsAction->setStatusTip(tr("Save this database under a new name")); connect(m_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAsDatabase())); m_closeAction = new QAction(this); m_closeAction->setText(tr("Close")); m_closeAction->setShortcut(QKeySequence::Close); m_closeAction->setStatusTip(tr("Close the currently opened database")); connect(m_closeAction, SIGNAL(triggered()), this, SLOT(closeDatabase())); for (int i = 0; i < MaxRecentFiles; ++i) { m_recentFileActions[i] = new QAction(this); m_recentFileActions[i]->setVisible(false); connect(m_recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); } m_exitAction = new QAction(this); m_exitAction->setText(tr("E&xit")); m_exitAction->setShortcut(QKeySequence::Quit); m_exitAction->setStatusTip(tr("Quits sbuilder")); connect(m_exitAction, SIGNAL(triggered()), this, SLOT(close())); m_undoAction = new QAction(this); m_undoAction->setText(tr("&Undo")); m_undoAction->setShortcut(QKeySequence::Undo); connect(m_undoAction, SIGNAL(triggered()), m_dbWidget, SLOT(undo())); m_redoAction = new QAction(this); m_redoAction->setText(tr("&Redo")); m_redoAction->setShortcut(QKeySequence::Redo); connect(m_redoAction, SIGNAL(triggered()), m_dbWidget, SLOT(redo())); m_cutAction = new QAction(this); m_cutAction->setText(tr("Cu&t")); m_cutAction->setShortcut(QKeySequence::Cut); m_cutAction->setIcon(QIcon(":/images/edit-cut.png")); connect(m_cutAction, SIGNAL(triggered()), m_dbWidget, SLOT(cut())); m_copyAction = new QAction(this); m_copyAction->setText(tr("&Copy")); m_copyAction->setShortcut(QKeySequence::Copy); m_copyAction->setIcon(QIcon(":/images/edit-copy.png")); connect(m_copyAction, SIGNAL(triggered()), m_dbWidget, SLOT(copy())); m_pasteAction = new QAction(this); m_pasteAction->setText(tr("&Paste")); m_pasteAction->setShortcut(QKeySequence::Paste); m_pasteAction->setIcon(QIcon(":/images/edit-paste.png")); connect(m_pasteAction, SIGNAL(triggered()), m_dbWidget, SLOT(paste())); m_selectAllAction = new QAction(this); m_selectAllAction->setText(tr("&Select All")); m_selectAllAction->setShortcut(QKeySequence::SelectAll); connect(m_selectAllAction, SIGNAL(triggered()), m_dbWidget, SLOT(selectAll())); m_runAction = new QAction(this); m_runAction->setText(tr("&Run")); // TODO: a better name m_runAction->setIcon(QIcon(":/images/media-playback-start.png")); m_runAction->setShortcut(QKeySequence(tr("F5"))); connect(m_runAction, SIGNAL(triggered()), m_dbWidget, SLOT(execute())); m_commitAction = new QAction(this); m_commitAction->setText(tr("&Commit")); connect(m_commitAction, SIGNAL(triggered()), m_dbWidget, SIGNAL(commit())); m_rollbackAction = new QAction(this); m_rollbackAction->setText(tr("Roll&back")); connect(m_rollbackAction, SIGNAL(triggered()), m_dbWidget, SIGNAL(rollback())); m_logAction = new QAction(this); m_logAction->setText(tr("Show Log")); connect(m_logAction, SIGNAL(triggered()), m_log, SLOT(show())); m_pragmaAction = new QAction(this); m_pragmaAction->setText(tr("Show &Pragmas"));//.........这里部分代码省略.........
开发者ID:blackberry,项目名称:SBuilder,代码行数:101,
示例4: QMainWindowEditorMainWindow::EditorMainWindow(QWidget *parent) : QMainWindow(parent){ camera_ = 0; ui.setupUi(this); QApplication::connect(ui.action_Open, SIGNAL(triggered()), this, SLOT(openRequested())); QApplication::connect(ui.action_Save, SIGNAL(triggered()), this, SLOT(saveRequested())); QApplication::connect(ui.actionDerive_map, SIGNAL(triggered()), this, SLOT(deriveMap())); QApplication::connect(ui.action_Quit, SIGNAL(triggered()), QApplication::instance(), SLOT(quit())); QApplication::connect(ui.actionZoom_In, SIGNAL(triggered()), this, SLOT(zoominRequested())); QApplication::connect(ui.actionZoom_Out, SIGNAL(triggered()), this, SLOT(zoomoutRequested())); QApplication::connect(ui.horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(horzScroll(int))); QApplication::connect(ui.verticalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(vertScroll(int))); QApplication::connect(ui.actionRotate_Left, SIGNAL(triggered()), this, SLOT(rotateLeft())); QApplication::connect(ui.actionRotate_Right, SIGNAL(triggered()), this, SLOT(rotateRight())); QApplication::connect(ui.actionTilt_Up, SIGNAL(triggered()), this, SLOT(tiltUp())); QApplication::connect(ui.actionTilt_Down, SIGNAL(triggered()), this, SLOT(tiltDown())); QApplication::connect(ui.actionUndo, SIGNAL(triggered()), this, SLOT(undo())); QApplication::connect(ui.actionRedo, SIGNAL(triggered()), this, SLOT(redo())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_S),this), SIGNAL(activated()), this, SLOT(saveRequested())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_O),this), SIGNAL(activated()), this, SLOT(openRequested())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_Z),this), SIGNAL(activated()), this, SLOT(zoominRequested())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_X),this), SIGNAL(activated()), this, SLOT(zoomoutRequested())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left),this), SIGNAL(activated()), this, SLOT(rotateLeft())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right),this), SIGNAL(activated()), this, SLOT(rotateRight())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up),this), SIGNAL(activated()), this, SLOT(tiltUp())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down),this), SIGNAL(activated()), this, SLOT(tiltDown())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_Left),this), SIGNAL(activated()), this, SLOT(panLeft())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_Right),this), SIGNAL(activated()), this, SLOT(panRight())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_Up),this), SIGNAL(activated()), this, SLOT(panUp())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_Down),this), SIGNAL(activated()), this, SLOT(panDown())); ui.action_Save->setEnabled(false); ui.editorGLWidget->setEnabled(false); QToolButton* party_button = new QToolButton(); party_button->setText("Parties"); party_button->setCheckable(true); party_button->setChecked(false); handlers_.push_back(new TerrainHandler(*this, "party", false, tool_buttons_.size())); QApplication::connect(party_button, SIGNAL(pressed()), handlers_.back(), SLOT(terrainSelected())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_P),this), SIGNAL(activated()), handlers_.back(), SLOT(terrainSelected())); ui.tilesToolBar->addWidget(party_button); tool_buttons_.push_back(party_button); QToolButton* height_button = new QToolButton(); height_button->setText("Height"); height_button->setCheckable(true); height_button->setChecked(true); handlers_.push_back(new TerrainHandler(*this, "", false, tool_buttons_.size())); QApplication::connect(height_button, SIGNAL(pressed()), handlers_.back(), SLOT(terrainSelected())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_H),this), SIGNAL(activated()), handlers_.back(), SLOT(terrainSelected())); ui.tilesToolBar->addWidget(height_button); tool_buttons_.push_back(height_button); QToolButton* picker_button = new QToolButton(); picker_button->setText("Picker"); picker_button->setCheckable(true); handlers_.push_back(new TerrainHandler(*this, "", true, tool_buttons_.size())); QApplication::connect(picker_button, SIGNAL(pressed()), handlers_.back(), SLOT(terrainSelected())); ui.tilesToolBar->addWidget(picker_button); tool_buttons_.push_back(picker_button); std::vector<std::string> terrain_ids; hex::base_terrain::get_terrain_ids(terrain_ids); for(int n = 0; n != terrain_ids.size(); ++n) { QToolButton* b = new QToolButton(); b->setText(hex::base_terrain::get(terrain_ids[n])->name().c_str()); b->setCheckable(true); handlers_.push_back(new TerrainHandler(*this, terrain_ids[n], false, tool_buttons_.size())); QApplication::connect(b, SIGNAL(pressed()), handlers_.back(), SLOT(terrainSelected())); ui.tilesToolBar->addWidget(b); tool_buttons_.push_back(b); } terrain_ids.clear(); hex::terrain_feature::get_feature_ids(terrain_ids); for(int n = 0; n != terrain_ids.size(); ++n) { QToolButton* b = new QToolButton(); b->setText(hex::terrain_feature::get(terrain_ids[n])->name().c_str()); b->setCheckable(true); handlers_.push_back(new TerrainHandler(*this, terrain_ids[n], true, tool_buttons_.size())); QApplication::connect(b, SIGNAL(pressed()), handlers_.back(), SLOT(terrainSelected())); ui.tilesToolBar->addWidget(b); tool_buttons_.push_back(b); }}
开发者ID:BrittzXD,项目名称:silvertree,代码行数:89,
示例5: p//! [0]QPushButton p("&Exit", parent); // automatic shortcut Alt+EQ3PopupMenu *fileMenu = new fileMenu(parent);fileMenu->insertItem("Undo", parent, SLOT(undo()), Qt::CTRL + Qt::Key_Z);//! [0]//! [1]accelerator->insertItem(QKeySequence("M"));//! [1]//! [2]Q3Accel *a = new Q3Accel(myWindow);a->connectItem(a->insertItem(Qt::CTRL + Qt::Key_P), myWindow, SLOT(printDoc()));//! [2]//! [3]Q3Accel *a = new Q3Accel(myWindow); // create accels for myWindowa->insertItem(CTRL + Key_P, 200); // Ctrl+P, e.g. to print documenta->insertItem(ALT + Key_X, 201); // Alt+X, e.g. to quita->insertItem(UNICODE_ACCEL + 'q', 202); // Unicode 'q', e.g. to quita->insertItem(Key_D); // gets a unique negative id < -1a->insertItem(CTRL + SHIFT + Key_P); // gets a unique negative id < -1//! [3]//! [4]
开发者ID:Fale,项目名称:qtmoko,代码行数:31,
示例6: mainvoid main(){ clrscr(); char choice; int loop; cout << "Sentence : "; cin.get(array,39); cin.ignore(100,'/n'); do { clrscr(); cout << endl << "The Sentence is : " << endl << array << endl; cout << "1=Reverse Words" << endl << "2=Reverse Letters in Words" << endl << "3=Back word to Front" << endl << "4=Front Word to Back" << endl; if(pro[0]!=null) cout << "5=Undo" << endl; if(con[0]!=null) cout << "6=Redo" << endl; cout << "7=Quit" << endl; choice=getch(); if(choice=='1') { rev_words(); con[0]=null; for(loop=29; loop>0; loop--) { pro[loop]=pro[loop-1]; } pro[0]=rw; } else if(choice=='2') { rev_letters(); con[0]=null; for(loop=29; loop>0; loop--) { pro[loop]=pro[loop-1]; } pro[0]=rl; } else if(choice=='3') { back_to_front(); con[0]=null; for(loop=29; loop>0; loop--) { pro[loop]=pro[loop-1]; } pro[0]=btf; } else if(choice=='4') { front_to_back(); con[0]=null; for(loop=29; loop>0; loop--) { pro[loop]=pro[loop-1]; } pro[0]=ftb; } else if(choice=='5' && pro[0]!=null) undo(); else if(choice=='6' && con[0]!=null) redo(); } while(choice!='7');}
开发者ID:choptastic,项目名称:OldCode-Public,代码行数:66,
示例7: connectvoid MainWindow2::createMenus(){ // ---------- File Menu ------------- connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newDocument())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openDocument())); connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(saveAsNewDocument())); connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveDocument())); connect(ui->actionPrint, SIGNAL(triggered()), editor, SLOT(print())); connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close())); /// --- Export Menu --- connect(ui->actionExport_X_sheet , SIGNAL(triggered()), editor, SLOT(exportX())); connect(ui->actionExport_Image_Sequence, SIGNAL(triggered()), editor, SLOT(exportSeq())); connect(ui->actionExport_Image, SIGNAL(triggered()), editor, SLOT(exportImage())); connect(ui->actionExport_Movie, SIGNAL(triggered()), editor, SLOT(exportMov())); //exportFlashAct = new QAction(tr("&Flash/SWF..."), this); //exportFlashAct->setShortcut(tr("Ctrl+Alt+F")); //connect(exportFlashAct, SIGNAL(triggered()), editor, SLOT(exportFlash())); connect(ui->actionExport_Palette, SIGNAL(triggered()), this, SLOT(exportPalette())); /// --- Import Menu --- connect(ui->actionExport_Svg_Image, SIGNAL(triggered()), editor, SLOT(saveSvg())); connect(ui->actionImport_Image, SIGNAL(triggered()), editor, SLOT(importImage())); connect(ui->actionImport_Image_Sequence, SIGNAL(triggered()), editor, SLOT(importImageSequence())); connect(ui->actionImport_Movie, SIGNAL(triggered()), editor, SLOT(importMov())); connect(ui->actionImport_Sound, SIGNAL(triggered()), editor, SLOT(importSound())); connect(ui->actionImport_Palette, SIGNAL(triggered()), this, SLOT(importPalette())); /// --- Edit Menu --- connect(ui->actionUndo, SIGNAL(triggered()), editor, SLOT(undo())); connect(ui->actionRedo, SIGNAL(triggered()), editor, SLOT(redo())); connect(ui->actionCut, SIGNAL(triggered()), editor, SLOT(cut())); connect(ui->actionCopy, SIGNAL(triggered()), editor, SLOT(copy())); connect(ui->actionPaste, SIGNAL(triggered()), editor, SLOT(paste())); connect(ui->actionDelete, SIGNAL(triggered()), editor, SLOT(clearCurrentFrame())); connect(ui->actionCrop, SIGNAL(triggered()), editor, SLOT(crop())); connect(ui->actionCrop_To_Selection, SIGNAL(triggered()), editor, SLOT(croptoselect())); connect(ui->actionSelect_All, SIGNAL(triggered()), editor, SIGNAL(selectAll())); connect(ui->actionDeselect_All, SIGNAL(triggered()), editor, SLOT(deselectAll())); connect(ui->actionPreference, SIGNAL(triggered()), this, SLOT(showPreferences())); ui->actionRedo->setEnabled(false); /// --- Layer Menu --- connect(ui->actionNew_Bitmap_Layer, SIGNAL(triggered()), editor, SLOT(newBitmapLayer())); connect(ui->actionNew_Vector_Layer, SIGNAL(triggered()), editor, SLOT(newVectorLayer())); connect(ui->actionNew_Sound_Layer, SIGNAL(triggered()), editor, SLOT(newSoundLayer())); connect(ui->actionNew_Camera_Layer, SIGNAL(triggered()), editor, SLOT(newCameraLayer())); connect(ui->actionDelete_Current_Layer, SIGNAL(triggered()), editor, SLOT(deleteCurrentLayer())); /// --- View Menu --- connect(ui->actionZoom_In, SIGNAL(triggered()), editor, SLOT(setzoom())); connect(ui->actionZoom_Out, SIGNAL(triggered()), editor, SLOT(setzoom1())); connect(ui->actionRotate_Clockwise, SIGNAL(triggered()), editor, SLOT(rotatecw())); connect(ui->actionRotate_Anticlosewise, SIGNAL(triggered()), editor, SLOT(rotateacw())); connect(ui->actionReset_Windows, SIGNAL(triggered()), this, SLOT(dockAllPalettes())); connect(ui->actionReset_View, SIGNAL(triggered()), editor, SLOT(resetView())); connect(ui->actionHorizontal_Flip, SIGNAL(triggered()), editor, SLOT(toggleMirror())); connect(ui->actionVertical_Flip, SIGNAL(triggered()), editor, SLOT(toggleMirrorV())); ui->actionPreview->setEnabled(false); //# connect(previewAct, SIGNAL(triggered()), editor, SLOT(getCameraLayer()));//TODO: Preview view ui->actionGrid->setEnabled(false); connect(ui->actionGrid, SIGNAL(triggered()), editor, SLOT(gridview())); //TODO: Grid view connect(ui->actionOnionPrevious, SIGNAL(triggered(bool)), editor, SIGNAL(toggleOnionPrev(bool))); connect(editor, SIGNAL(onionPrevChanged(bool)), ui->actionOnionPrevious, SLOT(setChecked(bool))); connect(ui->actionOnionNext, SIGNAL(triggered(bool)), editor, SIGNAL(toggleOnionNext(bool))); connect(editor, SIGNAL(onionNextChanged(bool)), ui->actionOnionNext, SLOT(setChecked(bool))); /// --- Animation Menu --- connect(ui->actionPlay, SIGNAL(triggered()), editor, SLOT(play())); connect(ui->actionLoop, SIGNAL(triggered(bool)), editor, SLOT(setLoop(bool))); connect(ui->actionLoop, SIGNAL(toggled(bool)), editor, SIGNAL(toggleLoop(bool))); //TODO: WTF? connect(editor, SIGNAL(loopToggled(bool)), ui->actionLoop, SLOT(setChecked(bool))); connect(ui->actionAdd_Frame, SIGNAL(triggered()), editor, SLOT(addKey())); connect(ui->actionRemove_Frame, SIGNAL(triggered()), editor, SLOT(removeKey())); connect(ui->actionNext_Frame, SIGNAL(triggered()), editor, SLOT(playNextFrame())); connect(ui->actionPrevious_Frame, SIGNAL(triggered()), editor, SLOT(playPrevFrame())); connect(ui->actionNext_Keyframe, SIGNAL(triggered()), editor, SLOT(scrubNextKeyframe())); connect(ui->actionPrev_Keyframe, SIGNAL(triggered()), editor, SLOT(scrubPreviousKeyframe())); connect(ui->actionDuplicate_Frame, SIGNAL(triggered()), editor, SLOT(duplicateKey())); /// --- Tool Menu --- connect(ui->actionClear, SIGNAL(triggered()), editor, SLOT(clearCurrentFrame())); connect(ui->actionMove, SIGNAL(triggered()), m_toolSet, SLOT(moveOn())); connect(ui->actionSelect, SIGNAL(triggered()), m_toolSet, SLOT(selectOn())); connect(ui->actionBrush, SIGNAL(triggered()), m_toolSet, SLOT(brushOn())); connect(ui->actionPolyline, SIGNAL(triggered()), m_toolSet, SLOT(polylineOn())); connect(ui->actionSmudge, SIGNAL(triggered()), m_toolSet, SLOT(smudgeOn())); connect(ui->actionPen, SIGNAL(triggered()), m_toolSet, SLOT(penOn())); connect(ui->actionHand, SIGNAL(triggered()), m_toolSet, SLOT(handOn())); connect(ui->actionPencil, SIGNAL(triggered()), m_toolSet, SLOT(pencilOn())); connect(ui->actionBucket, SIGNAL(triggered()), m_toolSet, SLOT(bucketOn()));//.........这里部分代码省略.........
开发者ID:wesen,项目名称:pencil,代码行数:101,
示例8: undoeditor_action* editor_action_unit_facing::perform(map_context& mc) const{ std::unique_ptr<editor_action> undo(new editor_action_unit_facing(loc_, old_direction_, new_direction_)); perform_without_undo(mc); return undo.release();}
开发者ID:aquileia,项目名称:wesnoth,代码行数:6,
示例9: startCmdvoid Score::write(Xml& xml, bool selectionOnly){ // if we have multi measure rests and some parts are hidden, // then some layout information is missing: // relayout with all parts set visible QList<Part*> hiddenParts; bool unhide = false; if (styleB(StyleIdx::createMultiMeasureRests)) { for (Part* part : _parts) { if (!part->show()) { if (!unhide) { startCmd(); unhide = true; } part->undoChangeProperty(P_ID::VISIBLE, true); hiddenParts.append(part); } } } if (unhide) { doLayout(); for (Part* p : hiddenParts) p->setShow(false); } xml.stag("Score"); switch(_layoutMode) { case LayoutMode::PAGE: case LayoutMode::FLOAT: case LayoutMode::SYSTEM: break; case LayoutMode::LINE: xml.tag("layoutMode", "line"); break; }#ifdef OMR if (_omr && xml.writeOmr) _omr->write(xml);#endif if (_showOmr && xml.writeOmr) xml.tag("showOmr", _showOmr); if (_audio && xml.writeOmr) { xml.tag("playMode", int(_playMode)); _audio->write(xml); } for (int i = 0; i < 32; ++i) { if (!_layerTags[i].isEmpty()) { xml.tag(QString("LayerTag id=/"%1/" tag=/"%2/"").arg(i).arg(_layerTags[i]), _layerTagComments[i]); } } int n = _layer.size(); for (int i = 1; i < n; ++i) { // dont save default variant const Layer& l = _layer[i]; xml.tagE(QString("Layer name=/"%1/" mask=/"%2/"").arg(l.name).arg(l.tags)); } xml.tag("currentLayer", _currentLayer); if (!MScore::testMode) _synthesizerState.write(xml); if (pageNumberOffset()) xml.tag("page-offset", pageNumberOffset()); xml.tag("Division", MScore::division); xml.curTrack = -1; _style.save(xml, true); // save only differences to buildin style xml.tag("showInvisible", _showInvisible); xml.tag("showUnprintable", _showUnprintable); xml.tag("showFrames", _showFrames); xml.tag("showMargins", _showPageborders); QMapIterator<QString, QString> i(_metaTags); while (i.hasNext()) { i.next(); if ((!MScore::testMode && !MScore::saveTemplateMode) || (i.key() != "platform" && i.key() != "creationDate")) xml.tag(QString("metaTag name=/"%1/"").arg(i.key().toHtmlEscaped()), i.value()); } if (!selectionOnly) { xml.stag("PageList"); foreach(Page* page, _pages) page->write(xml); xml.etag(); } xml.curTrack = 0; int staffStart; int staffEnd; MeasureBase* measureStart; MeasureBase* measureEnd; if (selectionOnly) { staffStart = _selection.staffStart(); staffEnd = _selection.staffEnd(); // make sure we select full parts//.........这里部分代码省略.........
开发者ID:JasonLil,项目名称:MuseScore,代码行数:101,
示例10: QWidgetQgsMapStylingWidget::QgsMapStylingWidget( QgsMapCanvas* canvas, QWidget *parent ) : QWidget( parent ) , mMapCanvas( canvas ) , mBlockAutoApply( false ) , mCurrentLayer( nullptr ) , mVectorStyleWidget( nullptr ){ QBoxLayout* layout = new QVBoxLayout(); layout->setContentsMargins( 0, 0, 0, 0 ); this->setLayout( layout ); mAutoApplyTimer = new QTimer( this ); mAutoApplyTimer->setSingleShot( true ); connect( mAutoApplyTimer, SIGNAL( timeout() ), this, SLOT( apply() ) ); mStackedWidget = new QStackedWidget( this ); mMapStyleTabs = new QTabWidget( this ); mMapStyleTabs->setDocumentMode( true ); mNotSupportedPage = mStackedWidget->addWidget( new QLabel( "Not supported currently" ) ); mVectorPage = mStackedWidget->addWidget( mMapStyleTabs ); // create undo widget mUndoWidget = new QgsUndoWidget( this->mMapStyleTabs, mMapCanvas ); mUndoWidget->setObjectName( "Undo Styles" ); mLayerTitleLabel = new QLabel(); mLayerTitleLabel->setAlignment( Qt::AlignHCenter ); layout->addWidget( mLayerTitleLabel ); layout->addWidget( mStackedWidget ); mButtonBox = new QDialogButtonBox( QDialogButtonBox::Apply ); mLiveApplyCheck = new QCheckBox( "Live update" ); mLiveApplyCheck->setChecked( true ); mUndoButton = new QToolButton( this ); mUndoButton->setIcon( QgsApplication::getThemeIcon( "mActionUndo.png" ) ); mRedoButton = new QToolButton( this ); mRedoButton->setIcon( QgsApplication::getThemeIcon( "mActionRedo.png" ) ); connect( mUndoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( undo() ) ); connect( mRedoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( redo() ) ); QHBoxLayout* bottomLayout = new QHBoxLayout( ); bottomLayout->addWidget( mUndoButton ); bottomLayout->addWidget( mRedoButton ); bottomLayout->addWidget( mButtonBox ); bottomLayout->addWidget( mLiveApplyCheck ); layout->addLayout( bottomLayout ); mLabelingWidget = new QgsLabelingWidget( 0, mMapCanvas, this ); mLabelingWidget->setDockMode( true ); connect( mLabelingWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) ); // Only labels for now but styles and diagrams will come later QScrollArea* stylescroll = new QScrollArea; stylescroll->setWidgetResizable( true ); stylescroll->setFrameStyle( QFrame::NoFrame ); QScrollArea* labelscroll = new QScrollArea; labelscroll->setWidgetResizable( true ); labelscroll->setFrameStyle( QFrame::NoFrame ); labelscroll->setWidget( mLabelingWidget ); mStyleTabIndex = mMapStyleTabs->addTab( stylescroll, QgsApplication::getThemeIcon( "propertyicons/symbology.png" ), "Styles" ); mLabelTabIndex = mMapStyleTabs->addTab( labelscroll, QgsApplication::getThemeIcon( "labelingSingle.svg" ), "Labeling" ); mMapStyleTabs->addTab( mUndoWidget, QgsApplication::getThemeIcon( "labelingSingle.svg" ), "History" );// int diagramTabIndex = mMapStyleTabs->addTab( new QWidget(), QgsApplication::getThemeIcon( "propertyicons/diagram.png" ), "Diagrams" );// mMapStyleTabs->setTabEnabled( styleTabIndex, false );// mMapStyleTabs->setTabEnabled( diagramTabIndex, false ); mMapStyleTabs->setCurrentIndex( mStyleTabIndex ); connect( mMapStyleTabs, SIGNAL( currentChanged( int ) ), this, SLOT( updateCurrentWidgetLayer( int ) ) ); connect( mLiveApplyCheck, SIGNAL( toggled( bool ) ), mButtonBox->button( QDialogButtonBox::Apply ), SLOT( setDisabled( bool ) ) ); connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) ); mButtonBox->button( QDialogButtonBox::Apply )->setEnabled( false );}
开发者ID:danylaksono,项目名称:QGIS,代码行数:78,
示例11: trbool Score::saveFile(){ QString suffix = info.suffix(); if (info.exists() && !info.isWritable()) { MScore::lastError = tr("The following file is locked: /n%1 /n/nTry saving to a different location.").arg(info.filePath()); return false; } // if file was already saved in this session // save but don't overwrite backup again if (saved()) { try { if (suffix == "mscx") saveFile(info); else saveCompressedFile(info, false); } catch (QString s) { MScore::lastError = s; return false; } undo()->setClean(); info.refresh(); update(); return true; } // // step 1 // save into temporary file to prevent partially overwriting // the original file in case of "disc full" // QString tempName = info.filePath() + QString(".temp"); QFile temp(tempName); if (!temp.open(QIODevice::WriteOnly)) { MScore::lastError = tr("Open Temp File/n%1/nfailed: %2").arg(tempName).arg(QString(strerror(errno))); return false; } try { if (suffix == "mscx") saveFile(&temp, false); else saveCompressedFile(&temp, info, false); } catch (QString s) { MScore::lastError = s; return false; } if (temp.error() != QFile::NoError) { MScore::lastError = tr("MuseScore: Save File failed: %1").arg(temp.errorString()); temp.close(); return false; } temp.close(); // // step 2 // remove old backup file if exists // QDir dir(info.path()); QString backupName = QString(".") + info.fileName() + QString(","); if (dir.exists(backupName)) { if (!dir.remove(backupName)) {// if (!MScore::noGui)// QMessageBox::critical(0, tr("MuseScore: Save File"),// tr("Removing old backup file ") + backupName + tr(" failed")); } } // // step 3 // rename old file into backup // QString name(info.filePath()); if (dir.exists(name)) { if (!dir.rename(name, backupName)) {// if (!MScore::noGui)// QMessageBox::critical(0, tr("MuseScore: Save File"),// tr("Renaming old file <")// + name + tr("> to backup <") + backupName + tr("> failed")); } }#ifdef Q_OS_WIN QFileInfo fileBackup(dir, backupName); QString backupNativePath = QDir::toNativeSeparators(fileBackup.absoluteFilePath()); SetFileAttributes((LPCTSTR)backupNativePath.toLocal8Bit(), FILE_ATTRIBUTE_HIDDEN);#endif // // step 4 // rename temp name into file name // if (!QFile::rename(tempName, name)) { MScore::lastError = tr("Renaming temp. file <%1> to <%2> failed:/n%3").arg(tempName).arg(name).arg(QString(strerror(errno))); return false; } // make file readable by all QFile::setPermissions(name, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther);//.........这里部分代码省略.........
开发者ID:JasonLil,项目名称:MuseScore,代码行数:101,
示例12: courantFenetre::Fenetre(QWidget *parent) : courant(0), QMainWindow(parent){ //************************* courant = NULL; folder = NULL; resize(1200, 512); //*************************** Menu *************************** QMenu* mFile = menuBar()->addMenu("&File"); QMenu* mEdit = menuBar()->addMenu("&Edit"); QMenu* mView = menuBar()->addMenu("&View"); QMenu* mNouveau = mFile->addMenu("New"); QAction* mactionAnnuler = mEdit->addAction("Annuler"); QAction* mactionRefaire = mEdit->addAction("Refaire"); QAction* mactionSupprimer = mEdit->addAction("Supprimer"); QMenu* mTag = mEdit->addMenu("Tags"); QAction* mactionSupprimerTag = mTag->addAction("Supprimer"); QMenu* mDocument = mEdit->addMenu("Documents"); QAction* mactionUp = mDocument->addAction("Monter"); QAction* mactionDown = mDocument->addAction("Descendre"); QMenu* mExport = mEdit->addMenu("Exporter"); QAction* mactionOuvrir = mFile->addAction("Ouvrir un espace de travail"); QAction* mactionNew = mFile->addAction("Nouvel espace de travail"); QAction* mactionSaveAs = mFile->addAction("Enregistrer sous..."); QAction* mactionNewArticle = mNouveau->addAction("Article"); QAction* mactionNewImage = mNouveau->addAction("Image"); QAction* mactionNewAudio = mNouveau->addAction("Audio"); QAction* mactionNewVideo = mNouveau->addAction("Video"); QAction* mactionNewDocument = mNouveau->addAction("Document"); QAction* mactionExportHTML = mExport->addAction("Html"); QAction* mactionExportTex = mExport->addAction("Tex"); QAction* mactionExportTexte = mExport->addAction("Texte"); QAction* mactionOption=mEdit->addAction("Setting"); QAction* mactionAddTag = mNouveau->addAction("Tag"); QAction* mactionSave = mFile->addAction("Sauvegarder"); mFile->addSeparator(); QMenu* ouvrirCorbeille = mFile->addMenu("Corbeille"); QAction* mactionRestaurer = ouvrirCorbeille->addAction("Restaurer"); QAction* mactionVider = ouvrirCorbeille->addAction("Vider la Corbeille"); mactionViewEdit = mView->addAction("Onglet Editeur"); mactionViewHTML = mView->addAction("Onglet Html"); mactionViewTex = mView->addAction("Onglet Tex"); mactionViewTexte = mView->addAction("Onglet Texte"); mFile->addSeparator(); QAction* actionQuitter = mFile->addAction("&Quitter"); actionQuitter->setIcon(QIcon("icon/quitter.png")); mactionNewArticle->setIcon(QIcon("icon/article.png")); mactionNewImage->setIcon(QIcon("icon/image.png")); mactionNewAudio->setIcon(QIcon("icon/audio.png")); mactionNewVideo->setIcon(QIcon("icon/video.png")); mNouveau->setIcon(QIcon("icon/plus.png")); mactionDown->setIcon(QIcon("icon/down.png")); mactionUp->setIcon(QIcon("icon/up.png")); mactionAddTag->setIcon(QIcon("icon/tag.png")); mactionSave->setIcon(QIcon("icon/save.png")); mactionExportHTML->setIcon(QIcon("icon/html.png")); mactionExportTex->setIcon(QIcon("icon/tex.png")); mactionExportTexte->setIcon(QIcon("icon/texte.png")); mactionAnnuler->setIcon(QIcon("icon/undo.png")); mactionRefaire->setIcon(QIcon("icon/redo.png")); mactionSupprimer->setIcon(QIcon("icon/cross.png")); mactionRestaurer->setIcon(QIcon("icon/corbeille.png")); mactionNewDocument->setIcon(QIcon("icon/document.png")); mactionOption->setIcon(QIcon("icon/setting.png")); mactionOuvrir->setShortcut(QKeySequence("Ctrl+O")); actionQuitter->setShortcut(QKeySequence("Ctrl+Q")); mactionSave->setShortcut(QKeySequence("Ctrl+S")); mactionAnnuler->setShortcut(QKeySequence("Ctrl+Z")); mactionRefaire->setShortcut(QKeySequence("Ctrl+Y")); mactionSupprimer->setShortcut(tr("Delete")); //** VIEW **// mactionViewEdit->setCheckable(true); mactionViewEdit->setChecked(true); mactionViewHTML->setCheckable(true); mactionViewTex->setCheckable(true); mactionViewTexte->setCheckable(true); //Bar de statue QStatusBar* statusBar = new QStatusBar; statusBar->addWidget(new QLabel("Projet Lo21 - Pauline Crouillère / Emilien Notarianni")); this->setStatusBar(statusBar); // Création de la barre d'outils QToolBar *toolBarFichier = addToolBar("Fichier"); toolBarFichier->addAction(mactionNewArticle); toolBarFichier->addAction(mactionNewImage); toolBarFichier->addAction(mactionNewAudio);//.........这里部分代码省略.........
开发者ID:pcrouillere,项目名称:NoteManager,代码行数:101,
示例13: KXmlGuiWindowFITSViewer::FITSViewer (QWidget *parent) : KXmlGuiWindow (parent){#ifdef Q_OS_OSX if(Options::independentWindowFITS()) setWindowFlags(Qt::Window); else{ setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint); connect(QApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(changeAlwaysOnTop(Qt::ApplicationState))); }#endif fitsTab = new QTabWidget(this); undoGroup = new QUndoGroup(this); fitsID = 0; debayerDialog= NULL; markStars = false; lastURL = QUrl(QDir::homePath()); fitsTab->setTabsClosable(true); setWindowIcon(QIcon::fromTheme("kstars_fitsviewer", QIcon(":/icons/breeze/default/kstars_fitsviewer.svg"))); setCentralWidget(fitsTab); connect(fitsTab, SIGNAL(currentChanged(int)), this, SLOT(tabFocusUpdated(int))); connect(fitsTab, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); //These two connections will enable or disable the scope button if a scope is available or not. //Of course this is also dependent on the presence of WCS data in the image. #ifdef HAVE_INDI connect(INDIListener::Instance(), SIGNAL(newTelescope(ISD::GDInterface *)), this, SLOT(updateWCSFunctions())); connect(INDIListener::Instance(), SIGNAL(deviceRemoved(ISD::GDInterface *)), this, SLOT(updateWCSFunctions())); #endif led.setColor(Qt::green); fitsPosition.setAlignment(Qt::AlignCenter); fitsValue.setAlignment(Qt::AlignCenter); //fitsPosition.setFixedWidth(100); //fitsValue.setFixedWidth(100); fitsWCS.setVisible(false); statusBar()->insertPermanentWidget(FITS_WCS, &fitsWCS); statusBar()->insertPermanentWidget(FITS_VALUE, &fitsValue); statusBar()->insertPermanentWidget(FITS_POSITION, &fitsPosition); statusBar()->insertPermanentWidget(FITS_ZOOM, &fitsZoom); statusBar()->insertPermanentWidget(FITS_RESOLUTION, &fitsResolution); statusBar()->insertPermanentWidget(FITS_LED, &led); QAction *action; action = actionCollection()->addAction("rotate_right", this, SLOT(rotateCW())); action->setText(i18n("Rotate Right")); action->setIcon(QIcon::fromTheme("object-rotate-right", QIcon(":/icons/breeze/default/object-rotate-right.svg"))); action = actionCollection()->addAction("rotate_left", this, SLOT(rotateCCW())); action->setText(i18n("Rotate Left")); action->setIcon(QIcon::fromTheme("object-rotate-left", QIcon(":/icons/breeze/default/object-rotate-left.svg"))); action = actionCollection()->addAction("flip_horizontal", this, SLOT(flipHorizontal())); action->setText(i18n("Flip Horizontal")); action->setIcon(QIcon::fromTheme("object-flip-horizontal", QIcon(":/icons/breeze/default/object-flip-horizontal.svg"))); action = actionCollection()->addAction("flip_vertical", this, SLOT(flipVertical())); action->setText(i18n("Flip Vertical")); action->setIcon(QIcon::fromTheme("object-flip-vertical", QIcon(":/icons/breeze/default/object-flip-vertical.svg"))); action = actionCollection()->addAction("image_histogram"); action->setText(i18n("Histogram")); connect(action, SIGNAL(triggered(bool)), SLOT (histoFITS())); actionCollection()->setDefaultShortcut(action, QKeySequence::Replace); action->setIcon(QIcon(":/icons/histogram.png")); action = KStandardAction::open(this, SLOT(openFile()), actionCollection()); action->setIcon(QIcon::fromTheme("document-open", QIcon(":/icons/breeze/default/document-open.svg"))); saveFileAction = KStandardAction::save(this, SLOT(saveFile()), actionCollection()); saveFileAction->setIcon(QIcon::fromTheme("document-save", QIcon(":/icons/breeze/default/document-save.svg"))); action=saveFileAsAction = KStandardAction::saveAs(this, SLOT(saveFileAs()), actionCollection()); saveFileAsAction->setIcon(QIcon::fromTheme("document-save_as", QIcon(":/icons/breeze/default/document-save-as.svg"))); action = actionCollection()->addAction("fits_header"); actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::CTRL+Qt::Key_H)); action->setIcon(QIcon::fromTheme("document-properties", QIcon(":/icons/breeze/default/document-properties.svg"))); action->setText(i18n( "FITS Header")); connect(action, SIGNAL(triggered(bool) ), SLOT(headerFITS())); action = actionCollection()->addAction("fits_debayer"); actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::CTRL+Qt::Key_D)); action->setIcon(QIcon::fromTheme("view-preview", QIcon(":/icons/breeze/default/view-preview.svg"))); action->setText(i18n( "Debayer...")); connect(action, SIGNAL(triggered(bool) ), SLOT(debayerFITS()));//.........这里部分代码省略.........
开发者ID:KDE,项目名称:kstars,代码行数:101,
示例14: mainint main(int argc, char **argv) { struct level2_data *data; vmwSVMWGraphState *graph_state; vmwVisual *virtual_1; int ch,i,j,y_offset=0; int x=0,y=0; char tempst[10]; int sprite_array[16]; int sprite_offset=0; int doublesize=1,fullscreen=0; int argsfound=0; char filename[255],spritefile[255]; /* Parse command line arguments */ i=1; while(i<argc) { if (argv[i][0]=='-') { if (argv[i][1]=='d') doublesize=2; if (argv[i][1]=='f') fullscreen=1; } else { argsfound++; if (argsfound==1) strncpy(filename,argv[i],254); if (argsfound==2) strncpy(spritefile,argv[i],254); } i++; } if (argsfound<2) { printf("/nUSAGE: %s [-f] [-d] data_file sprite_file/n/n",argv[0]); return -1; } printf("Editing datafile=%s spritefile=%s/n",filename,spritefile); data=parse_data_file(filename); graph_state=vmwSetupSVMWGraph(VMW_SDLTARGET,doublesize*320,doublesize*200,0,doublesize,fullscreen,1); graph_state->default_font=vmwLoadFont("../data/tbfont.tb1",8,16,256); virtual_1=vmwSetupVisual(320,200); if (vmwLoadPicPacked(0,0,virtual_1,1,1,spritefile,graph_state)!=0) { printf("ERROR LOADING %s/n",spritefile); return -1; } for(j=0;j<data->rows;j++) for(i=0;i<data->cols;i++) data->sprites[j*10+i]->data=vmwGetSprite(1+i*21,1+j*11,20,10,virtual_1); vmwDrawBox(0,0,319,199,0,virtual_1); draw_all_sprites(0,data,virtual_1); vmwBlitMemToDisplay(graph_state,virtual_1); ch=' '; while(1) { switch(ch) { case 'A'...'P' : if (sprite_array[ch-0x41]!=-1) modify_level(data,x,y+y_offset,CHANGE_SPRITE, sprite_array[ch-0x41]); break; case 'a'...'p' : if (sprite_array[ch-0x61]!=-1) modify_level(data,x,y+y_offset,CHANGE_SPRITE, sprite_array[ch-0x61]); break; case 's': case 'S': save_data(filename,data); modified_since_save=0; break; case 'u': case 'U': undo(data); break; case 'q': case 'Q': if (modified_since_save) { if (vmwAreYouSure(graph_state, graph_state->default_font, virtual_1, "FILE HAS CHANGED", "QUIT W/O SAVING?", "YES-QUIT ANYWAY", "NO!-LET ME SAVE")) return 0; } else return 0; break; case '>': case '.': i=0; j=sprite_offset; while ( (i<16) && (j<data->numsprites)) { if ((data->sprites[j]->initialized) && (belongs_on_map(data->sprites[j]->type))) { i++; } j++; } if (j<data->numsprites) sprite_offset=j; //.........这里部分代码省略.........
开发者ID:deater,项目名称:tb1,代码行数:101,
示例15: cancelvoidExecutionEnv::workingCanceled( const int /*resp*/) { cancel(); undo(); return;}
开发者ID:Drooids,项目名称:inkscape,代码行数:6,
示例16: switchvoidPlayField::keyPressEvent(QKeyEvent * e) { int x=levelMap_->xpos(); int y=levelMap_->ypos(); switch (e->key()) { case Qt::Key_Up: if (e->state() & Qt::ControlModifier) step(x, 0); else if (e->state() & Qt::ShiftModifier) push(x, 0); else push(x, y-1); break; case Qt::Key_Down: if (e->state() & Qt::ControlModifier) step(x, MAX_Y); else if (e->state() & Qt::ShiftModifier) push(x, MAX_Y); else push(x, y+1); break; case Qt::Key_Left: if (e->state() & Qt::ControlModifier) step(0, y); else if (e->state() & Qt::ShiftModifier) push(0, y); else push(x-1, y); break; case Qt::Key_Right: if (e->state() & Qt::ControlModifier) step(MAX_X, y); else if (e->state() & Qt::ShiftModifier) push(MAX_X, y); else push(x+1, y); break; case Qt::Key_Q: KApplication::kApplication()->closeAllWindows(); break; case Qt::Key_Backspace: case Qt::Key_Delete: if (e->state() & Qt::ControlModifier) redo(); else undo(); break;#if 0 case Qt::Key_X: levelMap_->random(); levelChange(); repaint(false); break; case Qt::Key_R: level(levelMap_->level()); return; break; case Qt::Key_N: nextLevel(); return; break; case Qt::Key_P: previousLevel(); return; break; case Qt::Key_U: undo(); return; break; case Qt::Key_I: history_->redo(levelMap_); repaint(false); return; break; case Qt::Key_S: { QString buf; history_->save(buf); printf("%s/n", (char *) buf); } return; break; case Qt::Key_L: stopMoving(); history_->clear(); level(levelMap_->level()); { char buf[4096]="r1*D1*D1*r1*@r1*D1*"; //scanf("%s", buf); history_->load(levelMap_, buf); } updateStepsXpm(); updatePushesXpm(); repaint(false); return; break;#endif case Qt::Key_Print: HtmlPrinter::printHtml(levelMap_); break; default: e->ignore(); return; break;//.........这里部分代码省略.........
开发者ID:KDE,项目名称:ksokoban,代码行数:101,
示例17: mBlogId/** Constructor */CreateBlogMsg::CreateBlogMsg(std::string cId ,QWidget* parent, Qt::WFlags flags): mBlogId(cId), QMainWindow (parent, flags){ /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); setAttribute ( Qt::WA_DeleteOnClose, true ); setupFileActions(); setupEditActions(); setupViewActions(); setupInsertActions(); setupParagraphActions(); setAcceptDrops(true); setStartupText(); newBlogMsg(); ui.toolBar_2->addAction(ui.actionIncreasefontsize); ui.toolBar_2->addAction(ui.actionDecreasefontsize); ui.toolBar_2->addAction(ui.actionBlockquoute); ui.toolBar_2->addAction(ui.actionOrderedlist); ui.toolBar_2->addAction(ui.actionUnorderedlist); ui.toolBar_2->addAction(ui.actionBlockquoute); ui.toolBar_2->addAction(ui.actionCode); ui.toolBar_2->addAction(ui.actionsplitPost); setupTextActions(); connect(ui.actionPublish, SIGNAL(triggered()), this, SLOT(sendMsg())); connect(ui.actionNew, SIGNAL(triggered()), this, SLOT (fileNew())); connect(ui.actionIncreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeIncrease())); connect(ui.actionDecreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeDecrease())); connect(ui.actionBlockquoute, SIGNAL (triggered()), this, SLOT (blockQuote())); connect(ui.actionCode, SIGNAL (triggered()), this, SLOT (toggleCode())); connect(ui.actionsplitPost, SIGNAL (triggered()), this, SLOT (addPostSplitter())); connect(ui.actionOrderedlist, SIGNAL (triggered()), this, SLOT (addOrderedList())); connect(ui.actionUnorderedlist, SIGNAL (triggered()), this, SLOT (addUnorderedList())); //connect(webView, SIGNAL(loadFinished(bool)),this, SLOT(updateTextEdit())); connect( ui.msgEdit, SIGNAL( textChanged(const QString &)), this, SLOT(updateTextEdit())); connect( ui.msgEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat))); connect( ui.msgEdit, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged())); QPalette palette = QApplication::palette(); codeBackground = palette.color( QPalette::Active, QPalette::Midlight ); fontChanged(ui.msgEdit->font()); colorChanged(ui.msgEdit->textColor()); alignmentChanged(ui.msgEdit->alignment()); connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)), actionSave, SLOT(setEnabled(bool))); connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool))); connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)), actionUndo, SLOT(setEnabled(bool))); connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)), ui.actionUndo, SLOT(setEnabled(bool))); connect( ui.msgEdit->document(), SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool))); setWindowModified( ui.msgEdit->document()->isModified()); actionSave->setEnabled( ui.msgEdit->document()->isModified()); actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable()); ui.actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable()); actionRedo->setEnabled( ui.msgEdit->document()->isRedoAvailable()); connect(actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo())); connect(ui.actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo())); connect(actionRedo, SIGNAL(triggered()), ui.msgEdit, SLOT(redo())); actionCut->setEnabled(false); actionCopy->setEnabled(false); connect(actionCut, SIGNAL(triggered()), ui.msgEdit, SLOT(cut())); connect(actionCopy, SIGNAL(triggered()), ui.msgEdit, SLOT(copy())); connect(actionPaste, SIGNAL(triggered()), ui.msgEdit, SLOT(paste())); connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool))); connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool))); #ifndef QT_NO_CLIPBOARD connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));#endif //defaultCharFormat defaultCharFormat = ui.msgEdit->currentCharFormat(); const QFont defaultFont = ui.msgEdit->document()->defaultFont(); defaultCharFormat.setFont( defaultFont ); defaultCharFormat.setForeground( ui.msgEdit->currentCharFormat().foreground() ); defaultCharFormat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) ); defaultCharFormat.setBackground( palette.color( QPalette::Active,//.........这里部分代码省略.........
开发者ID:boukeversteegh,项目名称:retroshare,代码行数:101,
示例18: QMainWindowPluginCreator::PluginCreator(QWidget* parent) : QMainWindow(parent) { state = S_INIT; item = 0; view = 0; dock = 0; manualDock = 0; helpBrowser = 0; setupUi(this); QToolBar* fileTools = addToolBar(tr("File Operations")); fileTools->setObjectName("FileOperations"); actionNew->setIcon(*icons[fileNew_ICON]); actionNew->setShortcut(QKeySequence(QKeySequence::New)); fileTools->addAction(actionNew); actionOpen->setIcon(*icons[fileOpen_ICON]); actionOpen->setShortcut(QKeySequence(QKeySequence::Open)); fileTools->addAction(actionOpen); actionSave->setIcon(*icons[fileSave_ICON]); actionSave->setShortcut(QKeySequence(QKeySequence::Save)); fileTools->addAction(actionSave); actionQuit->setShortcut(QKeySequence(QKeySequence::Quit)); actionManual->setIcon(QIcon(":/data/help.png")); actionManual->setShortcut(QKeySequence(QKeySequence::HelpContents)); fileTools->addAction(actionManual); QToolBar* editTools = addToolBar(tr("Edit Operations")); editTools->setObjectName("EditOperations"); actionUndo->setIcon(*icons[undo_ICON]); actionUndo->setShortcut(QKeySequence(QKeySequence::Undo)); editTools->addAction(actionUndo); actionRedo->setIcon(*icons[redo_ICON]); actionRedo->setShortcut(QKeySequence(QKeySequence::Redo)); editTools->addAction(actionRedo); actionUndo->setEnabled(false); actionRedo->setEnabled(false); log->setReadOnly(true); log->setMaximumBlockCount(1000); readSettings(); setState(S_EMPTY); connect(run, SIGNAL(clicked()), SLOT(runClicked())); connect(stop, SIGNAL(clicked()), SLOT(stopClicked())); connect(actionOpen, SIGNAL(triggered()), SLOT(loadPlugin())); connect(actionSave, SIGNAL(triggered()), SLOT(savePlugin())); connect(actionNew, SIGNAL(triggered()), SLOT(newPlugin())); connect(actionQuit, SIGNAL(triggered()), SLOT(close())); connect(actionManual, SIGNAL(triggered()), SLOT(showManual())); connect(actionUndo, SIGNAL(triggered()), textEdit, SLOT(undo())); connect(actionRedo, SIGNAL(triggered()), textEdit, SLOT(redo())); connect(textEdit, SIGNAL(undoAvailable(bool)), actionUndo, SLOT(setEnabled(bool))); connect(textEdit, SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool))); connect(textEdit, SIGNAL(textChanged()), SLOT(textChanged())); }
开发者ID:guifre2,项目名称:MuseScore,代码行数:63,
示例19: setWindowTitle void maskImageWidget::init(const QImage& image) { setWindowTitle(tr("Mask Editor")); QPixmap load("coral_open32x32.png"); QPixmap save("coral_save32x32.png"); QPixmap undo("coral_undo32x32.png"); QPixmap redo("coral_redo32x32.png"); QPixmap pen("coral_pencil32x32.png"); QPixmap eraser("coral_eraser32x32.png"); QAction *canvasloadmask = new QAction(this); canvasloadmask->setIcon(load); canvasloadmask->setText(tr("&Load Mask")); QAction *canvassavemask = new QAction(this); canvassavemask->setIcon(QIcon(save)); canvassavemask->setText(tr("&Save Mask")); QAction *canvasundo = new QAction(this); canvasundo->setIcon(QIcon(undo)); canvasundo->setText(tr("&Undo")); canvasundo->setShortcut(QKeySequence("Ctrl+Z")); QAction *canvasredo = new QAction(this); canvasredo->setIcon(QIcon(redo)); canvasredo->setText(tr("&Redo")); canvasredo->setShortcut(QKeySequence("Ctrl+Shift+Z")); QAction *canvasclear = new QAction(tr("&Clear"), this); canvasclear->setShortcut(QKeySequence("Ctrl+C")); QAction *canvaspen = new QAction(this); canvaspen->setIcon(QIcon(pen)); canvaspen->setText(tr("&Pen")); QAction *canvaseraser = new QAction(this); canvaseraser->setIcon(QIcon(eraser)); canvaseraser->setText(tr("&Eraser")); QActionGroup *actions(new QActionGroup(this)); actions->addAction(canvaspen); actions->addAction(canvaseraser); canvaspen->setCheckable(true); canvaseraser->setCheckable(true); canvaspen->setChecked(true); actions->setExclusive(true); QAction *canvasOK = new QAction(this); canvasOK->setText("OK"); QAction *canvasCancel = new QAction(this); canvasCancel->setText("Cancel"); QBoxLayout *layout(new QVBoxLayout(this)); // We don't want a real-size image. We will downscale it! QImage image_to_use = image; pimpl_->realwidth_ = image.width(); pimpl_->realheight_ = image.height(); qDebug("maskImageWidget::Init real wxh %i x%i",pimpl_->realwidth_,pimpl_->realheight_); QDesktopWidget *desktop(QApplication::desktop()); if (image.width() > (desktop->width() * .8) || image.height() > (desktop->height() * .8)) { int width(desktop->width()), height(desktop->height()); image_to_use = image.scaled((int)std::floor(width * .75), (int)std::floor(height * .75), Qt::KeepAspectRatio); } pimpl_->render_area_ = new maskRenderWidget(image_to_use, this); QToolBar *canvas_toolbar(new QToolBar(this)); canvas_toolbar->addSeparator(); canvas_toolbar->addAction(canvasloadmask); canvas_toolbar->addAction(canvassavemask); canvas_toolbar->addSeparator(); canvas_toolbar->addAction(canvasundo); canvas_toolbar->addAction(canvasredo); canvas_toolbar->addSeparator(); QSpinBox *pen_width(new QSpinBox(canvas_toolbar)); pen_width->setToolTip(tr("Pen Width")); pen_width->setRange(0, 80); pen_width->setSingleStep(2); pen_width->setValue(16); connect(pen_width, SIGNAL(valueChanged(int)), SLOT(setCanvasPenWidth(int))); canvas_toolbar->addWidget(pen_width); canvas_toolbar->addAction(canvaspen); canvas_toolbar->addAction(canvaseraser); canvas_toolbar->addSeparator(); QSpinBox *gradient(new QSpinBox(canvas_toolbar)); gradient->setToolTip("Gradient Threshold"); gradient->setRange(0, 255); gradient->setValue(pimpl_->threshold_gradient_); connect(gradient, SIGNAL(valueChanged(int)), SLOT(setGradientThreshold(int))); QSpinBox *fixed(new QSpinBox(canvas_toolbar)); fixed->setToolTip("Fixed Threshold"); fixed->setRange(0, 255); fixed->setValue(pimpl_->threshold_fixed_); connect(fixed, SIGNAL(valueChanged(int)), SLOT(setFixedThreshold(int))); canvas_toolbar->addWidget(gradient); canvas_toolbar->addWidget(fixed);//.........这里部分代码省略.........
开发者ID:GuoXinxiao,项目名称:meshlab,代码行数:101,
示例20: QPopupMenuvoid PaintMainWindow::CreateMenuBar() { //Create File Menu //File Menu Begin QPopupMenu* file = new QPopupMenu(this); //Create Image Section file->insertItem("&New image", this, SLOT(OnNewImage()), CTRL+Key_N); file->insertItem("&Load image", this, SLOT(OnLoadImage()), CTRL+Key_O); file->insertItem("&Save image", this, SLOT(OnSaveImage()), CTRL+Key_S); file->insertSeparator(); //Create Color Section file->insertItem("&Foreground color", this, SLOT(ChangeFGColor())); file->insertItem("&Background color", this, SLOT(ChangeBGColor())); file->insertSeparator(); //Create Exit Section file->insertItem("&Exit", this, SLOT(OnExit()), CTRL+Key_X); //Insert File Menu menuBar()->insertItem("&File", file); //File Menu End //Create Edit Menu //Edit Menu Begin QPopupMenu* edit = new QPopupMenu(this); //Create Edit items edit->insertItem("&Undo", canvas, SLOT(undo()), CTRL+Key_Z); edit->insertItem("&Redo", canvas, SLOT(redo()), CTRL+Key_Y); edit->insertItem("&Clear All", canvas, SLOT(clearAll())); edit->insertItem("Re&size", this, SLOT(OnResizeImage()), CTRL+Key_R); //Insert Edit Menu menuBar()->insertItem("&Edit", edit); //Edit Menu End //Create View Menu //View Menu Begin QPopupMenu* view = new QPopupMenu(this); //Create ToolBar toggler QAction *ToolBar_t = new QAction("&Tool Bar", 0, this); QObject::connect(ToolBar_t, SIGNAL(activated()), this, SLOT(ToggleToolBar())); //Set ToolBar toggler to be checkable ToolBar_t->setToggleAction(true); ToolBar_t->setOn(true); ToolBar_t->addTo(view); //Connect ToolBar state to ToolBar toggler QObject::connect(tools, SIGNAL(visibilityChanged(bool)), ToolBar_t, SLOT(toggle())); //Insert View Menu menuBar()->insertItem("&View", view); //View Menu End //Create Help Menu //Help Menu Begin QPopupMenu* help = new QPopupMenu(this); //Create Help items help->insertItem("&About", this, SLOT(ShowAbout())); //Insert Help Menu menuBar()->insertItem("&Help", help); //Help Menu End}
开发者ID:johnmave126,项目名称:comp2012h-paint,代码行数:70,
示例21: KTextEditSimpleRichTextEdit::SimpleRichTextEdit(QWidget *parent) : KTextEdit(parent){ enableFindReplace(false); setCheckSpellingEnabled(true); setAutoFormatting(KTextEdit::AutoNone); setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); QTextDocument *textDocument = document(); QTextOption textOption; textOption.setAlignment(Qt::AlignCenter); textOption.setWrapMode(QTextOption::NoWrap); textDocument->setDefaultTextOption(textOption); QFont defaultFont = font(); defaultFont.setPointSize(defaultFont.pointSize() + 2); textDocument->setDefaultFont(defaultFont); QString styleSheet("p {" " display: block;" " white-space: pre;" " margin-top: 0px;" " margin-bottom: 0px;" "}"); textDocument->setDefaultStyleSheet(styleSheet); setTextInteractionFlags(Qt::TextEditorInteraction); m_actions[Undo] = new QAction(this); m_actions[Undo]->setIcon(QIcon::fromTheme("edit-undo")); m_actions[Undo]->setText(i18n("Undo")); m_actions[Undo]->setShortcuts(KStandardShortcut::undo()); connect(m_actions[Undo], SIGNAL(triggered()), this, SLOT(undo())); m_actions[Redo] = new QAction(this); m_actions[Redo]->setIcon(QIcon::fromTheme("edit-redo")); m_actions[Redo]->setText(i18n("Redo")); m_actions[Redo]->setShortcuts(KStandardShortcut::redo()); connect(m_actions[Redo], SIGNAL(triggered()), this, SLOT(redo())); m_actions[Cut] = new QAction(this); m_actions[Cut]->setIcon(QIcon::fromTheme("edit-cut")); m_actions[Cut]->setText(i18n("Cut")); m_actions[Cut]->setShortcuts(KStandardShortcut::cut()); connect(m_actions[Cut], SIGNAL(triggered()), this, SLOT(cut())); m_actions[Copy] = new QAction(this); m_actions[Copy]->setIcon(QIcon::fromTheme("edit-copy")); m_actions[Copy]->setText(i18n("Copy")); m_actions[Copy]->setShortcuts(KStandardShortcut::copy()); connect(m_actions[Copy], SIGNAL(triggered()), this, SLOT(copy()));#if !defined(QT_NO_CLIPBOARD) m_actions[Paste] = new QAction(this); m_actions[Paste]->setIcon(QIcon::fromTheme("edit-paste")); m_actions[Paste]->setText(i18n("Paste")); m_actions[Paste]->setShortcuts(KStandardShortcut::paste()); connect(m_actions[Paste], SIGNAL(triggered()), this, SLOT(paste()));#endif m_actions[Delete] = new QAction(this); m_actions[Delete]->setIcon(QIcon::fromTheme("edit-delete")); m_actions[Delete]->setText(i18n("Delete")); m_actions[Delete]->setShortcut(QKeySequence::Delete); connect(m_actions[Delete], SIGNAL(triggered()), this, SLOT(deleteText())); m_actions[Clear] = new QAction(this); m_actions[Clear]->setIcon(QIcon::fromTheme("edit-clear")); m_actions[Clear]->setText(i18nc("@action:inmenu Clear all text", "Clear")); connect(m_actions[Clear], SIGNAL(triggered()), this, SLOT(undoableClear())); m_actions[SelectAll] = new QAction(this); m_actions[SelectAll]->setIcon(QIcon::fromTheme("edit-select-all")); m_actions[SelectAll]->setText(i18n("Select All")); m_actions[SelectAll]->setShortcut(QKeySequence::SelectAll); connect(m_actions[SelectAll], SIGNAL(triggered()), this, SLOT(selectAll())); m_actions[ToggleBold] = new QAction(this); m_actions[ToggleBold]->setIcon(QIcon::fromTheme("format-text-bold")); m_actions[ToggleBold]->setText(i18nc("@action:inmenu Toggle bold style", "Bold")); m_actions[ToggleBold]->setShortcut(QKeySequence("Ctrl+B")); connect(m_actions[ToggleBold], SIGNAL(triggered()), this, SLOT(toggleFontBold())); m_actions[ToggleItalic] = new QAction(this); m_actions[ToggleItalic]->setIcon(QIcon::fromTheme("format-text-italic")); m_actions[ToggleItalic]->setText(i18nc("@action:inmenu Toggle italic style", "Italic")); m_actions[ToggleItalic]->setShortcut(QKeySequence("Ctrl+I")); connect(m_actions[ToggleItalic], SIGNAL(triggered()), this, SLOT(toggleFontItalic())); m_actions[ToggleUnderline] = new QAction(this); m_actions[ToggleUnderline]->setIcon(QIcon::fromTheme("format-text-underline")); m_actions[ToggleUnderline]->setText(i18nc("@action:inmenu Toggle underline style", "Underline")); m_actions[ToggleUnderline]->setShortcut(QKeySequence("Ctrl+U")); connect(m_actions[ToggleUnderline], SIGNAL(triggered()), this, SLOT(toggleFontUnderline())); m_actions[ToggleStrikeOut] = new QAction(this); m_actions[ToggleStrikeOut]->setIcon(QIcon::fromTheme("format-text-strikethrough")); m_actions[ToggleStrikeOut]->setText(i18nc("@action:inmenu Toggle strike through style", "Strike Through")); m_actions[ToggleStrikeOut]->setShortcut(QKeySequence("Ctrl+T")); connect(m_actions[ToggleStrikeOut], SIGNAL(triggered()), this, SLOT(toggleFontStrikeOut())); m_actions[ChangeTextColor] = new QAction(this); m_actions[ChangeTextColor]->setIcon(QIcon::fromTheme("format-text-color"));//.........这里部分代码省略.........
开发者ID:maxrd2,项目名称:subtitlecomposer,代码行数:101,
示例22: menuBarvoid MainWindow::createMenus(){ QAction* action; QString name; QMenu* menu; QMenu* subMenu; // ----- File Menu ----- menu = menuBar()->addMenu("File"); name = "About"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), this, SLOT(showAbout())); name = "New Molecule"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(newMoleculeMenu())); action->setShortcut(QKeySequence::New); name = "New Viewer"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), this, SLOT(newViewer())); name = "Open"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), this, SLOT(openFile())); action->setShortcut(QKeySequence::Open); name = "Open Recent"; m_recentFilesMenu = menu->addMenu(name); updateRecentFilesMenu(); menu->addSeparator();/* name = "Parse Test File"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), this, SLOT(parseFile())); menu->addSeparator();*/ name = "Close Viewer"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), this, SLOT(close())); action->setShortcut(QKeySequence::Close); name = "Save"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(saveAll())); action->setShortcut(QKeySequence::Save); name = "Save As"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(saveAs())); action->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_S); menu->addSeparator(); name = "Save Picture"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), &m_viewer, SLOT(saveSnapshot())); action->setShortcut(Qt::CTRL + Qt::Key_P); name = "Record Animation"; action = menu->addAction(name); action->setCheckable(true); action->setChecked(false); connect(action, SIGNAL(triggered()), this, SLOT(toggleRecordingActive())); action->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_P); m_recordAnimationAction = action; name = "Show Message Log"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), this, SLOT(showLogMessages())); action->setShortcut(Qt::CTRL + Qt::Key_L); name = "Quit"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), this, SLOT(quit())); action->setShortcut(Qt::CTRL + Qt::Key_Q); // ----- Edit Menu ----- menu = menuBar()->addMenu("Edit"); name = "Undo"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), &m_undoStack, SLOT(undo())); action->setShortcut(QKeySequence::Undo); connect(&m_undoStack, SIGNAL(canUndoChanged(bool)), action, SLOT(setEnabled(bool))); name = "Redo"; action = menu->addAction(name); connect(action, SIGNAL(triggered()), &m_undoStack, SLOT(redo())); action->setShortcut(QKeySequence::Redo); connect(&m_undoStack, SIGNAL(canRedoChanged(bool)), action, SLOT(setEnabled(bool))); menu->addSeparator();//.........这里部分代码省略.........
开发者ID:bjnano,项目名称:IQmol,代码行数:101,
示例23: QAction/*========================createActions========================*/void CBaseEditWindow::createActions( IShader* ){ // // files // m_actNew = new QAction( QIcon(":/images/new.png"), tr( "&New" ), this ); m_actNew->setShortcut( tr( "Ctrl+N" ) ); connect( m_actNew, SIGNAL(triggered() ), this, SLOT(newFile()) ); m_actOpen = new QAction( QIcon(":/images/open.png"), tr( "&Open..." ), this ); m_actOpen->setShortcut( tr( "Ctrl+O" ) ); connect( m_actOpen, SIGNAL(triggered()), this, SLOT(open()) ); m_actSave = new QAction( QIcon(":/images/save.png"), tr( "&Save" ), this ); m_actSave->setShortcut( tr( "Ctrl+S" ) ); connect( m_actSave, SIGNAL(triggered()), this, SLOT(save()) ); m_actSaveAs = new QAction( tr( "Save &As" ), this ); connect( m_actSaveAs, SIGNAL(triggered()), this, SLOT(saveAs()) ); m_actQuit = new QAction( QIcon(":/images/exit.png"), tr( "E&xit" ), this ); m_actQuit->setShortcut( tr( "Ctrl+Q" ) ); connect( m_actQuit, SIGNAL(triggered()), this, SLOT(close()) ); // // edit // m_actUndo = new QAction( QIcon(":/images/undo.png"), tr( "&Undo" ), this ); m_actUndo->setShortcut( tr( "Ctrl+Z" ) ); connect( m_actUndo, SIGNAL(triggered()), this, SLOT(undo()) ); m_actRedo = new QAction( QIcon(":/images/redo.png"), tr( "&Redo" ), this ); m_actRedo->setShortcut( tr( "Ctrl+Shift+Z" ) ); connect( m_actRedo, SIGNAL(triggered()), this, SLOT(redo()) ); m_actCopy = new QAction( QIcon(":/images/copy.png"), tr( "&Copy" ), this ); m_actCopy->setShortcut( tr( "Ctrl+C" ) ); connect( m_actCopy, SIGNAL(triggered()), this, SLOT(copy()) ); m_actCut = new QAction( QIcon(":/images/cut.png"), tr( "Cu&t" ), this ); m_actCut->setShortcut( tr( "Ctrl+X" ) ); connect( m_actCut, SIGNAL(triggered()), this, SLOT(cut()) ); m_actPaste = new QAction( QIcon(":/images/paste.png"), tr( "&Paste" ), this ); m_actPaste->setShortcut( tr( "Ctrl+V" ) ); connect( m_actPaste, SIGNAL(triggered()), this, SLOT(paste()) ); // // shaders // m_actLink = new QAction( tr( "&Link" ), this ); m_actLink->setShortcut( tr( "F5" ) ); connect( m_actLink, SIGNAL(triggered()), this, SLOT(link()) ); // // help // m_actAbout = new QAction( tr( "&About" ), this ); connect( m_actAbout, SIGNAL(triggered()), this, SLOT(about()) ); m_actAboutQt = new QAction( QIcon(":/images/qt.png"), tr( "About &Qt" ), this ); connect( m_actAboutQt, SIGNAL(triggered()), this, SLOT(aboutQt()) );}
开发者ID:lgarest,项目名称:42,代码行数:68,
示例24: ASSERT//.........这里部分代码省略......... m_ui.blendSrcFuncCombo->setCurrentIndex( params.m_blendSourceFunc - 1 ); connect( m_ui.blendSrcFuncCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onParamChange() ) ); m_ui.blendDestFuncCombo->setCurrentIndex( params.m_blendDestFunc - 1 ); connect( m_ui.blendDestFuncCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onParamChange() ) ); } // separate alpha blending group box { m_ui.useSeparatedAlphaBlending->setChecked( params.m_useSeparateAlphaBlend ); connect( m_ui.useSeparatedAlphaBlending, SIGNAL( toggled( bool ) ), this, SLOT( onParamChange() ) ); m_ui.alphaBlendSrcFuncCombo->setCurrentIndex( params.m_alphaBlendSourceFunc - 1 ); connect( m_ui.alphaBlendSrcFuncCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onParamChange() ) ); m_ui.alphaBlendDestFuncCombo->setCurrentIndex( params.m_alphaBlendDestFunc - 1 ); connect( m_ui.alphaBlendDestFuncCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onParamChange() ) ); } // stencil operations group box { m_ui.useStencil->setChecked( params.m_stencilEnable ); connect( m_ui.useStencil, SIGNAL( toggled( bool ) ), this, SLOT( onParamChange() ) ); m_ui.stencilFailCombo->setCurrentIndex( params.m_stencilFail - 1 ); connect( m_ui.stencilFailCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onParamChange() ) ); m_ui.stencilZFailCombo->setCurrentIndex( params.m_stencilZFail - 1 ); connect( m_ui.stencilZFailCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onParamChange() ) ); m_ui.stencilPassCombo->setCurrentIndex( params.m_stencilPass - 1 ); connect( m_ui.stencilPassCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onParamChange() ) ); m_ui.stencilFuncCombo->setCurrentIndex( params.m_stencilFunc - 1 ); connect( m_ui.stencilFuncCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onParamChange() ) ); m_stencilRef = new HexEditor( m_ui.stencilRefFrame, params.m_stencilRef ); m_ui.stencilRefFrame->layout()->addWidget( m_stencilRef ); m_stencilMask = new HexEditor( m_ui.stencilMaskFrame, params.m_stencilMask ); m_ui.stencilMaskFrame->layout()->addWidget( m_stencilMask ); m_stencilWriteMask = new HexEditor( m_ui.stencilWriteMaskFrame, params.m_stencilWriteMask ); m_ui.stencilWriteMaskFrame->layout()->addWidget( m_stencilWriteMask ); } refreshRenderingParamsUI(); } // set texture stages tabs { initializeTextureStagesTab(); } // initialize the toolbar // file management { QAction* actionSave = new QAction( QIcon( iconsDir + tr( "/saveFile.png" ) ), tr( "Save" ), toolbar ); actionSave->setShortcut( QKeySequence( tr( "Ctrl+S" ) ) ); toolbar->addAction( actionSave ); connect( actionSave, SIGNAL( triggered() ), this, SLOT( save() ) ); QAction* actionImportFrom = new QAction( QIcon( iconsDir + tr( "/import.png" ) ), tr( "Import" ), toolbar ); toolbar->addAction( actionImportFrom ); connect( actionImportFrom, SIGNAL( triggered() ), this, SLOT( importFrom() ) ); QAction* actionExportTo = new QAction( QIcon( iconsDir + tr( "/export.png" ) ), tr( "Export" ), toolbar ); toolbar->addAction( actionExportTo ); connect( actionExportTo, SIGNAL( triggered() ), this, SLOT( exportTo() ) ); toolbar->addSeparator(); } // script edition commands { QAction* actionUndo = new QAction( QIcon( iconsDir + tr( "/undo.png" ) ), tr( "Undo" ), toolbar ); actionUndo->setShortcut( QKeySequence( tr( "Ctrl+Z" ) ) ); toolbar->addAction( actionUndo ); connect( actionUndo, SIGNAL( triggered() ), m_scriptEditor, SLOT( undo() ) ); QAction* actionRedo = new QAction( QIcon( iconsDir + tr( "/redo.png" ) ), tr( "Redo" ), toolbar ); actionRedo->setShortcut( QKeySequence( tr( "Ctrl+Y" ) ) ); toolbar->addAction( actionRedo ); connect( actionRedo, SIGNAL( triggered() ), m_scriptEditor, SLOT( redo() ) ); toolbar->addSeparator(); } // building commands { QAction* actionCompile = new QAction( QIcon( iconsDir + tr( "/play.png" ) ), tr( "Compile" ), toolbar ); actionCompile->setShortcut( QKeySequence( tr( "F5" ) ) ); toolbar->addAction( actionCompile ); connect( actionCompile, SIGNAL( triggered() ), this, SLOT( compile() ) ); } show();}
开发者ID:chenwenbin928,项目名称:tamy,代码行数:101,
示例25: SLOTvoid AnnotWindow::slotUpdateUndoAndRedoInContextMenu(QMenu* menu){ if (!menu) return; QList<QAction *> actionList = menu->actions(); enum { UndoAct, RedoAct, CutAct, CopyAct, PasteAct, ClearAct, SelectAllAct, NCountActs }; KAction *kundo = KStandardAction::create( KStandardAction::Undo, m_document, SLOT(undo()), menu); KAction *kredo = KStandardAction::create( KStandardAction::Redo, m_document, SLOT(redo()), menu); connect(m_document, SIGNAL(canUndoChanged(bool)), kundo, SLOT(setEnabled(bool))); connect(m_document, SIGNAL(canRedoChanged(bool)), kredo, SLOT(setEnabled(bool))); kundo->setEnabled(m_document->canUndo()); kredo->setEnabled(m_document->canRedo()); QAction *oldUndo, *oldRedo; oldUndo = actionList[UndoAct]; oldRedo = actionList[RedoAct]; menu->insertAction(oldUndo, kundo); menu->insertAction(oldRedo, kredo); menu->removeAction(oldUndo); menu->removeAction(oldRedo);}
开发者ID:Axure,项目名称:okular,代码行数:24,
示例26: undobool MineBrush::MineAction::redo(){ return undo();}
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:4,
示例27: Selection_Flipyvoid Selection_Flipy (void){ UndoableCommand undo("mirrorSelected -axis y"); Select_FlipAxis(1);}
开发者ID:chrisglass,项目名称:ufoai,代码行数:5,
注:本文中的undo函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ unescape函数代码示例 C++ underMouse函数代码示例 |