Redesign a way we define the action.

This commit is contained in:
Roman Telezhynskyi 2020-10-05 11:58:03 +03:00
parent f96fd45a90
commit 0668a99cb5
3 changed files with 21 additions and 9 deletions

View File

@ -601,8 +601,6 @@ void TMainWindow::changeEvent(QEvent *event)
if (mType == MeasurementsType::Multisize) if (mType == MeasurementsType::Multisize)
{ {
actionFullCircumference->setText(tr("Use full circumference"));
ui->labelMType->setText(tr("Multisize measurements")); ui->labelMType->setText(tr("Multisize measurements"));
InitDimensionsBaseValue(); InitDimensionsBaseValue();
@ -2459,14 +2457,17 @@ void TMainWindow::InitMenu()
{ {
if (mType == MeasurementsType::Multisize) if (mType == MeasurementsType::Multisize)
{ {
ui->menuMeasurements->addSeparator(); // Measurements
ui->actionUseFullCircumference->setVisible(true);
ui->actionUseFullCircumference->setEnabled(true);
ui->actionUseFullCircumference->setChecked(m->IsFullCircumference());
connect(ui->actionUseFullCircumference, &QAction::triggered, this, &TMainWindow::FullCircumferenceChanged);
actionFullCircumference = new QAction(tr("Use full circumference"), this); QAction *separator = new QAction(this);
actionFullCircumference->setCheckable(true); separator->setSeparator(true);
actionFullCircumference->setChecked(m->IsFullCircumference()); ui->menuMeasurements->insertAction(ui->actionUseFullCircumference, separator);
ui->menuMeasurements->addAction(actionFullCircumference);
connect(actionFullCircumference, &QAction::triggered, this, &TMainWindow::FullCircumferenceChanged);
// File
ui->actionExportToIndividual->setVisible(true); ui->actionExportToIndividual->setVisible(true);
ui->actionExportToIndividual->setEnabled(true); ui->actionExportToIndividual->setEnabled(true);
connect(ui->actionExportToIndividual, &QAction::triggered, this, &TMainWindow::ExportToIndividual); connect(ui->actionExportToIndividual, &QAction::triggered, this, &TMainWindow::ExportToIndividual);

View File

@ -164,7 +164,6 @@ private:
QLabel *labelPatternUnit{nullptr}; QLabel *labelPatternUnit{nullptr};
bool isInitialized{false}; bool isInitialized{false};
bool mIsReadOnly{false}; bool mIsReadOnly{false};
QAction *actionFullCircumference{nullptr};
QTimer *gradation; QTimer *gradation;
QVector<QObject *> hackedWidgets{}; QVector<QObject *> hackedWidgets{};

View File

@ -992,6 +992,7 @@
<addaction name="actionDatabase"/> <addaction name="actionDatabase"/>
<addaction name="actionImportFromPattern"/> <addaction name="actionImportFromPattern"/>
<addaction name="actionMeasurementDiagram"/> <addaction name="actionMeasurementDiagram"/>
<addaction name="actionUseFullCircumference"/>
</widget> </widget>
<addaction name="menuFile"/> <addaction name="menuFile"/>
<addaction name="menuMeasurements"/> <addaction name="menuMeasurements"/>
@ -1353,6 +1354,17 @@
<enum>QAction::NoRole</enum> <enum>QAction::NoRole</enum>
</property> </property>
</action> </action>
<action name="actionUseFullCircumference">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Use full circumference</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>