Add reset buttons to contrast and light/dark value colour preferences

This commit is contained in:
Trevor SANDY 2021-01-25 21:43:26 +01:00
parent 7f06b93e1e
commit ca00f431cf
2 changed files with 30 additions and 0 deletions

View file

@ -30,9 +30,15 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
connect(PartEdgeContrastSlider, SIGNAL(valueChanged(int)), this, SLOT(SliderValueChanged(int)));
emit PartEdgeContrastSlider->valueChanged(PartEdgeContrastSlider->value());
ResetPartEdgeContrastButton = new QToolButton(this);
ResetPartEdgeContrastButton->setText(tr("..."));
ResetPartEdgeContrastButton->setToolTip(tr("Reset"));
connect(ResetPartEdgeContrastButton, SIGNAL(clicked()), this, SLOT(ResetSliderButtonClicked()));
EdgeSettingsLayout->addWidget(PartEdgeContrastLabel,0,0);
EdgeSettingsLayout->addWidget(PartEdgeContrastSlider,0,1);
EdgeSettingsLayout->addWidget(PartEdgeContrast,0,2);
EdgeSettingsLayout->addWidget(ResetPartEdgeContrastButton,0,3);
QLabel* PartColorValueLDIndexLabel = new QLabel(tr("Light/Dark Value:"), this);
PartColorValueLDIndex = new QLabel(this);
@ -43,9 +49,15 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
connect(PartColorValueLDIndexSlider, SIGNAL(valueChanged(int)), this, SLOT(SliderValueChanged(int)));
emit PartColorValueLDIndexSlider->valueChanged(PartColorValueLDIndexSlider->value());
ResetPartColorValueLDIndexButton = new QToolButton(this);
ResetPartColorValueLDIndexButton->setText(tr("..."));
ResetPartColorValueLDIndexButton->setToolTip(tr("Reset"));
connect(ResetPartColorValueLDIndexButton, SIGNAL(clicked()), this, SLOT(ResetSliderButtonClicked()));
EdgeSettingsLayout->addWidget(PartColorValueLDIndexLabel,1,0);
EdgeSettingsLayout->addWidget(PartColorValueLDIndexSlider,1,1);
EdgeSettingsLayout->addWidget(PartColorValueLDIndex,1,2);
EdgeSettingsLayout->addWidget(ResetPartColorValueLDIndexButton,1,3);
QGroupBox* StudColorBox = new QGroupBox(tr("High Contrast Studs"), this);
StudColorBox->setVisible(ShowHighContrastDialog);
@ -185,6 +197,20 @@ void lcAutomateEdgeColorDialog::ColorButtonClicked()
((QToolButton*)Button)->setToolTip(NewColor.name().toUpper());
}
void lcAutomateEdgeColorDialog::ResetSliderButtonClicked()
{
if (sender() == ResetPartEdgeContrastButton)
{
PartEdgeContrastSlider->setValue(0.5f * 100);
emit PartEdgeContrastSlider->valueChanged(PartEdgeContrastSlider->value());
}
else if (sender() == ResetPartColorValueLDIndexButton)
{
PartColorValueLDIndexSlider->setValue(0.5f * 100);
emit PartColorValueLDIndexSlider->valueChanged(PartColorValueLDIndexSlider->value());
}
}
void lcAutomateEdgeColorDialog::ResetColorButtonClicked()
{
quint32* Color = nullptr;

View file

@ -16,6 +16,7 @@ public:
protected slots:
void SliderValueChanged(int);
void ResetSliderButtonClicked();
void ColorButtonClicked();
void ResetColorButtonClicked();
@ -26,6 +27,9 @@ protected:
QLabel* PartEdgeContrast;
QLabel* PartColorValueLDIndex;
QToolButton* ResetPartEdgeContrastButton;
QToolButton* ResetPartColorValueLDIndexButton;
QToolButton* StudColorButton;
QToolButton* StudEdgeColorButton;
QToolButton* BlackEdgeColorButton;