Add actions undo and redo on toolbar.

--HG--
branch : develop
This commit is contained in:
dismine 2014-06-24 11:47:28 +03:00
parent 82836c15a1
commit 3267bec1c2
3 changed files with 10 additions and 8 deletions

View File

@ -92,7 +92,7 @@ MainWindow::MainWindow(QWidget *parent)
helpLabel = new QLabel(QObject::tr("Create new pattern piece to start working.")); helpLabel = new QLabel(QObject::tr("Create new pattern piece to start working."));
ui->statusBar->addWidget(helpLabel); ui->statusBar->addWidget(helpLabel);
ToolBarZoom(); ToolBarTools();
pattern = new VContainer(); pattern = new VContainer();
@ -1048,7 +1048,7 @@ void MainWindow::ToolBarDraws()
ui->actionLayout->setEnabled(false); ui->actionLayout->setEnabled(false);
} }
void MainWindow::ToolBarZoom() void MainWindow::ToolBarTools()
{ {
/*First we will try use Standard Shortcuts from Qt, but because keypad "-" and "+" not the same keys like in main /*First we will try use Standard Shortcuts from Qt, but because keypad "-" and "+" not the same keys like in main
keypad, shortcut Ctrl+"-" or "+" from keypad will not working with standard shortcut (QKeySequence::ZoomIn or keypad, shortcut Ctrl+"-" or "+" from keypad will not working with standard shortcut (QKeySequence::ZoomIn or
@ -2086,11 +2086,13 @@ void MainWindow::CreateMenus()
undoAction->setShortcuts(QKeySequence::Undo); undoAction->setShortcuts(QKeySequence::Undo);
undoAction->setIcon(QIcon::fromTheme("edit-undo")); undoAction->setIcon(QIcon::fromTheme("edit-undo"));
ui->menuDrawing->insertAction(ui->actionPattern_properties, undoAction); ui->menuDrawing->insertAction(ui->actionPattern_properties, undoAction);
ui->toolBarTools->addAction(undoAction);
QAction *redoAction = qApp->getUndoStack()->createRedoAction(this, tr("&Redo")); QAction *redoAction = qApp->getUndoStack()->createRedoAction(this, tr("&Redo"));
redoAction->setShortcuts(QKeySequence::Redo); redoAction->setShortcuts(QKeySequence::Redo);
redoAction->setIcon(QIcon::fromTheme("edit-redo")); redoAction->setIcon(QIcon::fromTheme("edit-redo"));
ui->menuDrawing->insertAction(ui->actionPattern_properties, redoAction); ui->menuDrawing->insertAction(ui->actionPattern_properties, redoAction);
ui->toolBarTools->addAction(redoAction);
separatorAct = new QAction(this); separatorAct = new QAction(this);
separatorAct->setSeparator(true); separatorAct->setSeparator(true);

View File

@ -219,7 +219,7 @@ private:
bool guiEnabled; bool guiEnabled;
void ToolBarOption(); void ToolBarOption();
void ToolBarDraws(); void ToolBarDraws();
void ToolBarZoom(); void ToolBarTools();
void InitToolButtons(); void InitToolButtons();
void CancelTool(); void CancelTool();
void ArrowTool(); void ArrowTool();

View File

@ -699,7 +699,7 @@
<addaction name="actionZoomOut"/> <addaction name="actionZoomOut"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionPattern_properties"/> <addaction name="actionPattern_properties"/>
<addaction name="actionEdit_pattern_code"/> <addaction name="actionEdit_pattern_code"/>
</widget> </widget>
<widget class="QMenu" name="menuMeasurements"> <widget class="QMenu" name="menuMeasurements">
<property name="title"> <property name="title">
@ -767,9 +767,9 @@
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
</widget> </widget>
<widget class="QToolBar" name="toolBarZoom"> <widget class="QToolBar" name="toolBarTools">
<property name="windowTitle"> <property name="windowTitle">
<string>toolBar_2</string> <string>Toolbar tools</string>
</property> </property>
<attribute name="toolBarArea"> <attribute name="toolBarArea">
<enum>TopToolBarArea</enum> <enum>TopToolBarArea</enum>
@ -1057,7 +1057,7 @@
<string>Zoom out</string> <string>Zoom out</string>
</property> </property>
</action> </action>
<action name="actionEdit_pattern_code"> <action name="actionEdit_pattern_code">
<property name="text"> <property name="text">
<string>Edit pattern XML code</string> <string>Edit pattern XML code</string>
</property> </property>