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)
|
if (mType == MeasurementsType::Multisize)
|
||||||
{
|
{
|
||||||
|
actionFullCircumference->setText(tr("Use full circumference"));
|
||||||
|
|
||||||
ui->labelMType->setText(tr("Multisize measurements"));
|
ui->labelMType->setText(tr("Multisize measurements"));
|
||||||
|
|
||||||
InitDimensionsBaseValue();
|
InitDimensionsBaseValue();
|
||||||
|
@ -1915,6 +1917,14 @@ void TMainWindow::SaveMFullName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TMainWindow::FullCircumferenceChanged(bool checked)
|
||||||
|
{
|
||||||
|
m->SetFullCircumference(checked);
|
||||||
|
MeasurementsWereSaved(false);
|
||||||
|
InitDimensionsBaseValue();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::SetupMenu()
|
void TMainWindow::SetupMenu()
|
||||||
{
|
{
|
||||||
|
@ -2022,6 +2032,7 @@ void TMainWindow::InitWindow()
|
||||||
|
|
||||||
if (mType == MeasurementsType::Multisize)
|
if (mType == MeasurementsType::Multisize)
|
||||||
{
|
{
|
||||||
|
InitMenu();
|
||||||
ui->labelMType->setText(tr("Multisize measurements"));
|
ui->labelMType->setText(tr("Multisize measurements"));
|
||||||
|
|
||||||
InitDimensionsBaseValue();
|
InitDimensionsBaseValue();
|
||||||
|
@ -2175,13 +2186,29 @@ void TMainWindow::InitWindow()
|
||||||
InitTable();
|
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()
|
void TMainWindow::InitDimensionsBaseValue()
|
||||||
{
|
{
|
||||||
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||||
const QString unit = UnitsToStr(m->MUnit(), true);
|
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(name != nullptr)
|
||||||
SCASSERT(base != nullptr)
|
SCASSERT(base != nullptr)
|
||||||
|
@ -2194,7 +2221,14 @@ void TMainWindow::InitDimensionsBaseValue()
|
||||||
|
|
||||||
if (dimension->IsCircumference() || dimension->Type() == MeasurementDimension::X)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,6 +127,8 @@ private slots:
|
||||||
void SaveMDescription();
|
void SaveMDescription();
|
||||||
void SaveMFullName();
|
void SaveMFullName();
|
||||||
|
|
||||||
|
void FullCircumferenceChanged(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(TMainWindow)
|
Q_DISABLE_COPY(TMainWindow)
|
||||||
Ui::TMainWindow *ui;
|
Ui::TMainWindow *ui;
|
||||||
|
@ -150,11 +152,13 @@ private:
|
||||||
QLabel *labelPatternUnit;
|
QLabel *labelPatternUnit;
|
||||||
bool isInitialized;
|
bool isInitialized;
|
||||||
bool mIsReadOnly;
|
bool mIsReadOnly;
|
||||||
|
QAction *actionFullCircumference{nullptr};
|
||||||
|
|
||||||
QVector<QObject *> hackedWidgets;
|
QVector<QObject *> hackedWidgets;
|
||||||
|
|
||||||
void SetupMenu();
|
void SetupMenu();
|
||||||
void InitWindow();
|
void InitWindow();
|
||||||
|
void InitMenu();
|
||||||
void InitDimensionsBaseValue();
|
void InitDimensionsBaseValue();
|
||||||
void InitTable();
|
void InitTable();
|
||||||
void SetDecimals();
|
void SetDecimals();
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tabMeasurements">
|
<widget class="QWidget" name="tabMeasurements">
|
||||||
<attribute name="icon">
|
<attribute name="icon">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user