From c142cb4b856e47f0c8c10f1cfd6a65978ae8d4f0 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 15 Jan 2019 09:53:23 +0200 Subject: [PATCH] Some improvements after move the measurement diagram action to the ui file. There is no harm to make it enabled from the start. Plus closing the dock widget must uncheck the action. --HG-- branch : develop --- src/app/tape/tmainwindow.cpp | 23 ----------------------- src/app/tape/tmainwindow.h | 5 +---- src/app/tape/tmainwindow.ui | 27 +++++++++++++++++++++++---- 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index cecb1417c..b16586e7f 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -96,7 +96,6 @@ TMainWindow::TMainWindow(QWidget *parent) labelGradationHeights(nullptr), labelGradationSizes(nullptr), labelPatternUnit(nullptr), - dockDiagramVisible(true), isInitialized(false), mIsReadOnly(false), recentFileActs(QVector(MaxRecentFiles)), @@ -587,27 +586,6 @@ void TMainWindow::changeEvent(QEvent *event) QMainWindow::changeEvent(event); } -//--------------------------------------------------------------------------------------------------------------------- -void TMainWindow::showEvent(QShowEvent *event) -{ - QMainWindow::showEvent( event ); - if ( event->spontaneous() ) - { - return; - } - - if (isInitialized) - { - return; - } - // do your init stuff here - - dockDiagramVisible = ui->dockWidgetDiagram->isVisible(); - ui->dockWidgetDiagram->setVisible(false); - - isInitialized = true;//first show windows are held -} - //--------------------------------------------------------------------------------------------------------------------- bool TMainWindow::eventFilter(QObject *object, QEvent *event) { @@ -2024,7 +2002,6 @@ void TMainWindow::InitWindow() SCASSERT(m != nullptr) ui->labelToolTip->setVisible(false); ui->tabWidget->setVisible(true); - ui->actionMeasurementDiagram->setEnabled(true); ui->tabWidget->setCurrentIndex(0); ui->plainTextEditNotes->setEnabled(true); diff --git a/src/app/tape/tmainwindow.h b/src/app/tape/tmainwindow.h index f77a60b08..5503eafa7 100644 --- a/src/app/tape/tmainwindow.h +++ b/src/app/tape/tmainwindow.h @@ -40,7 +40,7 @@ namespace Ui { class TMainWindow; -} +} // namespace Ui class QLabel; class QxtCsvModel; @@ -69,7 +69,6 @@ public slots: protected: virtual void closeEvent(QCloseEvent *event) override; virtual void changeEvent(QEvent* event) override; - virtual void showEvent(QShowEvent *event) override; virtual bool eventFilter(QObject *object, QEvent *event) override; virtual void ExportToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator) final; @@ -149,8 +148,6 @@ private: QLabel *labelGradationHeights; QLabel *labelGradationSizes; QLabel *labelPatternUnit; - QAction *actionDockDiagram; - bool dockDiagramVisible; bool isInitialized; bool mIsReadOnly; enum { MaxRecentFiles = 5 }; diff --git a/src/app/tape/tmainwindow.ui b/src/app/tape/tmainwindow.ui index 985fa3e95..62e6dab34 100644 --- a/src/app/tape/tmainwindow.ui +++ b/src/app/tape/tmainwindow.ui @@ -839,7 +839,7 @@ 0 0 835 - 18 + 22 @@ -1213,7 +1213,7 @@ true - false + true @@ -1222,6 +1222,9 @@ Measurement diagram + + QAction::NoRole + @@ -1243,8 +1246,8 @@ setVisible(bool) - 764 - 377 + -1 + -1 764 @@ -1252,5 +1255,21 @@ + + dockWidgetDiagram + visibilityChanged(bool) + actionMeasurementDiagram + setChecked(bool) + + + 734 + 384 + + + -1 + -1 + + +