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
This commit is contained in:
Roman Telezhynskyi 2019-01-15 09:53:23 +02:00
parent a190fcaea2
commit c142cb4b85
3 changed files with 24 additions and 31 deletions

View file

@ -96,7 +96,6 @@ TMainWindow::TMainWindow(QWidget *parent)
labelGradationHeights(nullptr),
labelGradationSizes(nullptr),
labelPatternUnit(nullptr),
dockDiagramVisible(true),
isInitialized(false),
mIsReadOnly(false),
recentFileActs(QVector<QAction *>(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);

View file

@ -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 };

View file

@ -839,7 +839,7 @@
<x>0</x>
<y>0</y>
<width>835</width>
<height>18</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -1213,7 +1213,7 @@
<bool>true</bool>
</property>
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="share/resources/tapeicon.qrc">
@ -1222,6 +1222,9 @@
<property name="text">
<string>Measurement diagram</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
@ -1243,8 +1246,8 @@
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>764</x>
<y>377</y>
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>764</x>
@ -1252,5 +1255,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>dockWidgetDiagram</sender>
<signal>visibilityChanged(bool)</signal>
<receiver>actionMeasurementDiagram</receiver>
<slot>setChecked(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>734</x>
<y>384</y>
</hint>
<hint type="destinationlabel">
<x>-1</x>
<y>-1</y>
</hint>
</hints>
</connection>
</connections>
</ui>