Basic implementation for Full circumference trigger.
This commit is contained in:
parent
15978bd868
commit
a16e6bc082
|
@ -561,6 +561,8 @@ void TMainWindow::changeEvent(QEvent *event)
|
|||
|
||||
if (mType == MeasurementsType::Multisize)
|
||||
{
|
||||
actionFullCircumference->setText(tr("Use full circumference"));
|
||||
|
||||
ui->labelMType->setText(tr("Multisize measurements"));
|
||||
|
||||
InitDimensionsBaseValue();
|
||||
|
@ -1915,6 +1917,14 @@ void TMainWindow::SaveMFullName()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::FullCircumferenceChanged(bool checked)
|
||||
{
|
||||
m->SetFullCircumference(checked);
|
||||
MeasurementsWereSaved(false);
|
||||
InitDimensionsBaseValue();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::SetupMenu()
|
||||
{
|
||||
|
@ -2022,6 +2032,7 @@ void TMainWindow::InitWindow()
|
|||
|
||||
if (mType == MeasurementsType::Multisize)
|
||||
{
|
||||
InitMenu();
|
||||
ui->labelMType->setText(tr("Multisize measurements"));
|
||||
|
||||
InitDimensionsBaseValue();
|
||||
|
@ -2175,13 +2186,29 @@ void TMainWindow::InitWindow()
|
|||
InitTable();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::InitMenu()
|
||||
{
|
||||
if (mType == MeasurementsType::Multisize)
|
||||
{
|
||||
ui->menuMeasurements->addSeparator();
|
||||
|
||||
actionFullCircumference = new QAction(tr("Use full circumference"), this);
|
||||
actionFullCircumference->setCheckable(true);
|
||||
actionFullCircumference->setChecked(m->IsFullCircumference());
|
||||
ui->menuMeasurements->addAction(actionFullCircumference);
|
||||
connect(actionFullCircumference, &QAction::triggered, this, &TMainWindow::FullCircumferenceChanged);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::InitDimensionsBaseValue()
|
||||
{
|
||||
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||
const QString unit = UnitsToStr(m->MUnit(), true);
|
||||
const bool fc = m->IsFullCircumference();
|
||||
|
||||
auto DimensionsBaseValue = [this, dimensions, unit](int index, QLabel *name, QLabel *base)
|
||||
auto DimensionsBaseValue = [this, dimensions, unit, fc](int index, QLabel *name, QLabel *base)
|
||||
{
|
||||
SCASSERT(name != nullptr)
|
||||
SCASSERT(base != nullptr)
|
||||
|
@ -2194,7 +2221,14 @@ void TMainWindow::InitDimensionsBaseValue()
|
|||
|
||||
if (dimension->IsCircumference() || dimension->Type() == MeasurementDimension::X)
|
||||
{
|
||||
base->setText(QString("%1 %2").arg(dimension->BaseValue()).arg(unit));
|
||||
if (dimension->Type() != MeasurementDimension::X && fc)
|
||||
{
|
||||
base->setText(QString("%1 %2").arg(dimension->BaseValue()*2).arg(unit));
|
||||
}
|
||||
else
|
||||
{
|
||||
base->setText(QString("%1 %2").arg(dimension->BaseValue()).arg(unit));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -127,6 +127,8 @@ private slots:
|
|||
void SaveMDescription();
|
||||
void SaveMFullName();
|
||||
|
||||
void FullCircumferenceChanged(bool checked);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(TMainWindow)
|
||||
Ui::TMainWindow *ui;
|
||||
|
@ -150,11 +152,13 @@ private:
|
|||
QLabel *labelPatternUnit;
|
||||
bool isInitialized;
|
||||
bool mIsReadOnly;
|
||||
QAction *actionFullCircumference{nullptr};
|
||||
|
||||
QVector<QObject *> hackedWidgets;
|
||||
|
||||
void SetupMenu();
|
||||
void InitWindow();
|
||||
void InitMenu();
|
||||
void InitDimensionsBaseValue();
|
||||
void InitTable();
|
||||
void SetDecimals();
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabMeasurements">
|
||||
<attribute name="icon">
|
||||
|
|
Loading…
Reference in New Issue
Block a user