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), labelGradationHeights(nullptr),
labelGradationSizes(nullptr), labelGradationSizes(nullptr),
labelPatternUnit(nullptr), labelPatternUnit(nullptr),
dockDiagramVisible(true),
isInitialized(false), isInitialized(false),
mIsReadOnly(false), mIsReadOnly(false),
recentFileActs(QVector<QAction *>(MaxRecentFiles)), recentFileActs(QVector<QAction *>(MaxRecentFiles)),
@ -587,27 +586,6 @@ void TMainWindow::changeEvent(QEvent *event)
QMainWindow::changeEvent(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) bool TMainWindow::eventFilter(QObject *object, QEvent *event)
{ {
@ -2024,7 +2002,6 @@ void TMainWindow::InitWindow()
SCASSERT(m != nullptr) SCASSERT(m != nullptr)
ui->labelToolTip->setVisible(false); ui->labelToolTip->setVisible(false);
ui->tabWidget->setVisible(true); ui->tabWidget->setVisible(true);
ui->actionMeasurementDiagram->setEnabled(true);
ui->tabWidget->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(0);
ui->plainTextEditNotes->setEnabled(true); ui->plainTextEditNotes->setEnabled(true);

View file

@ -40,7 +40,7 @@
namespace Ui namespace Ui
{ {
class TMainWindow; class TMainWindow;
} } // namespace Ui
class QLabel; class QLabel;
class QxtCsvModel; class QxtCsvModel;
@ -69,7 +69,6 @@ public slots:
protected: protected:
virtual void closeEvent(QCloseEvent *event) override; virtual void closeEvent(QCloseEvent *event) override;
virtual void changeEvent(QEvent* event) override; virtual void changeEvent(QEvent* event) override;
virtual void showEvent(QShowEvent *event) override;
virtual bool eventFilter(QObject *object, QEvent *event) override; virtual bool eventFilter(QObject *object, QEvent *event) override;
virtual void ExportToCSVData(const QString &fileName, bool withHeader, int mib, virtual void ExportToCSVData(const QString &fileName, bool withHeader, int mib,
const QChar &separator) final; const QChar &separator) final;
@ -149,8 +148,6 @@ private:
QLabel *labelGradationHeights; QLabel *labelGradationHeights;
QLabel *labelGradationSizes; QLabel *labelGradationSizes;
QLabel *labelPatternUnit; QLabel *labelPatternUnit;
QAction *actionDockDiagram;
bool dockDiagramVisible;
bool isInitialized; bool isInitialized;
bool mIsReadOnly; bool mIsReadOnly;
enum { MaxRecentFiles = 5 }; enum { MaxRecentFiles = 5 };

View file

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