diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 6e13b293c..a1e99b1b3 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -112,7 +112,10 @@ MainWindow::MainWindow(QWidget *parent) dialogTable(nullptr), dialogTool(nullptr), dialogHistory(nullptr), comboBoxDraws(nullptr), patternPieceLabel(nullptr), mode(Draw::Calculation), - currentDrawIndex(0), currentToolBoxIndex(0), drawMode(true), recentFileActs(), + currentDrawIndex(0), currentToolBoxIndex(0), + isDockToolOptionsVisible(true), + isDockGroupsVisible(true), + drawMode(true), recentFileActs(), separatorAct(nullptr), leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true), gradationHeights(nullptr), gradationSizes(nullptr), gradationHeightsLabel(nullptr), gradationSizesLabel(nullptr), @@ -2061,7 +2064,8 @@ void MainWindow::ActionDraw(bool checked) } ui->dockWidgetLayoutPages->setVisible(false); - ui->dockWidgetToolOptions->setVisible(true); + ui->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible); + ui->dockWidgetGroups->setVisible(isDockGroupsVisible); } else { @@ -2130,7 +2134,8 @@ void MainWindow::ActionDetails(bool checked) } ui->dockWidgetLayoutPages->setVisible(false); - ui->dockWidgetToolOptions->setVisible(true); + ui->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible); + ui->dockWidgetGroups->setVisible(isDockGroupsVisible); helpLabel->setText(""); } @@ -2207,7 +2212,14 @@ void MainWindow::ActionLayout(bool checked) } ui->dockWidgetLayoutPages->setVisible(true); + + ui->dockWidgetToolOptions->blockSignals(true); ui->dockWidgetToolOptions->setVisible(false); + ui->dockWidgetToolOptions->blockSignals(false); + + ui->dockWidgetGroups->blockSignals(true); + ui->dockWidgetGroups->setVisible(false); + ui->dockWidgetGroups->blockSignals(false); ShowPaper(ui->listWidget->currentRow()); @@ -2704,6 +2716,7 @@ void MainWindow::SetEnableWidgets(bool enable) ui->actionUnloadMeasurements->setEnabled(enable && designStage); actionDockWidgetToolOptions->setEnabled(enable && designStage); + actionDockWidgetGroups->setEnabled(enable && designStage); undoAction->setEnabled(enable && designStage && qApp->getUndoStack()->canUndo()); redoAction->setEnabled(enable && designStage && qApp->getUndoStack()->canRedo()); @@ -2911,6 +2924,18 @@ void MainWindow::ChangedHeight(const QString &text) } } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::DockToolOptionsVisibilityChanged(bool visible) +{ + isDockToolOptionsVisible = visible; +} + +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::DockGropsVisibilityChanged(bool visible) +{ + isDockGroupsVisible = visible; +} + //--------------------------------------------------------------------------------------------------------------------- void MainWindow::SetDefaultHeight() { @@ -3229,6 +3254,9 @@ void MainWindow::ReadSettings() // Text under tool buton icon ToolBarStyles(); + + isDockToolOptionsVisible = ui->dockWidgetToolOptions->isVisible(); + isDockGroupsVisible = ui->dockWidgetGroups->isVisible(); } //--------------------------------------------------------------------------------------------------------------------- @@ -3335,13 +3363,6 @@ void MainWindow::CreateMenus() separatorAct->setSeparator(true); ui->menuPatternPiece->insertAction(ui->actionPattern_properties, separatorAct); - //Add dock - actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction(); - ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetToolOptions); - - separatorAct = new QAction(this); - separatorAct->setSeparator(true); - ui->menuPatternPiece->insertAction(ui->actionPattern_properties, separatorAct); AddDocks(); } @@ -3514,7 +3535,15 @@ void MainWindow::LastUsedTool() //--------------------------------------------------------------------------------------------------------------------- void MainWindow::AddDocks() { - ui->menuPatternPiece->insertAction(ui->actionPattern_properties, ui->dockWidgetToolOptions->toggleViewAction()); + //Add dock + actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction(); + ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetToolOptions); + connect(ui->dockWidgetToolOptions, &QDockWidget::visibilityChanged, this, + &MainWindow::DockToolOptionsVisibilityChanged); + + actionDockWidgetGroups = ui->dockWidgetGroups->toggleViewAction(); + ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetGroups); + connect(ui->dockWidgetGroups, &QDockWidget::visibilityChanged, this, &MainWindow::DockGropsVisibilityChanged); separatorAct = new QAction(this); separatorAct->setSeparator(true); diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 52602520e..673dcdf63 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -204,6 +204,9 @@ private slots: void ChangedSize(const QString &text); void ChangedHeight(const QString & text); + void DockToolOptionsVisibilityChanged(bool visible); + void DockGropsVisibilityChanged(bool visible); + private: Q_DISABLE_COPY(MainWindow) /** @brief ui keeps information about user interface */ @@ -255,6 +258,9 @@ private: /** @brief currentToolBoxIndex save current set of tools. */ qint32 currentToolBoxIndex; + bool isDockToolOptionsVisible; + bool isDockGroupsVisible; + /** @brief drawMode true if we current draw scene. */ bool drawMode; diff --git a/src/app/valentina/mainwindow.ui b/src/app/valentina/mainwindow.ui index fdb501f67..51eb11f32 100644 --- a/src/app/valentina/mainwindow.ui +++ b/src/app/valentina/mainwindow.ui @@ -938,6 +938,14 @@ + + + 0 + 0 + 130 + 356 + + :/icon/16x16/operations.png:/icon/16x16/operations.png @@ -1455,6 +1463,18 @@ + + + true + + + Groups + + + 2 + + + diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index e5137b537..2cbf03c0f 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -60,7 +60,8 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent) : QMainWindow(parent), listDetails(QVector()), currentScene(nullptr), tempSceneLayout(nullptr), pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP())), doc(nullptr), papers(QList()), shadows(QList()), scenes(QList()), details(QList >()), - undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), curFile(QString()), + undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), actionDockWidgetGroups(nullptr), + curFile(QString()), isLayoutStale(true), margins(), paperSize(), isTiled(false) { InitTempLayoutScene(); diff --git a/src/app/valentina/mainwindowsnogui.h b/src/app/valentina/mainwindowsnogui.h index 1cb1d1926..f4aea3bb0 100644 --- a/src/app/valentina/mainwindowsnogui.h +++ b/src/app/valentina/mainwindowsnogui.h @@ -83,6 +83,7 @@ protected: QAction *undoAction; QAction *redoAction; QAction *actionDockWidgetToolOptions; + QAction *actionDockWidgetGroups; /** @brief fileName name current pattern file. */ QString curFile;