From f9c67430c78472a5eca0b5d669ab2071ffa14bd0 Mon Sep 17 00:00:00 2001 From: victor Date: Tue, 11 Jul 2017 17:51:29 +0900 Subject: [PATCH] =?UTF-8?q?=ED=98=84=EC=9E=AC=20=EC=98=A8=EB=8F=84?= =?UTF-8?q?=EB=A5=BC=20=ED=91=9C=EC=8B=9C=ED=95=A0=20=EB=95=8C=20=EC=8A=AC?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=8D=94=EB=8F=84=20=EA=B0=99=EC=9D=B4=20?= =?UTF-8?q?=EC=9B=80=EC=A7=81=EC=9D=B4=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/gui/oven_control/cooldownpopup.cpp | 34 +++++++++++++++++++++++++--------- app/gui/oven_control/cooldownpopup.ui | 10 +++++++++- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/app/gui/oven_control/cooldownpopup.cpp b/app/gui/oven_control/cooldownpopup.cpp index 658e124..170028b 100644 --- a/app/gui/oven_control/cooldownpopup.cpp +++ b/app/gui/oven_control/cooldownpopup.cpp @@ -137,11 +137,23 @@ void CooldownPopup::showCurrentTemp() void CooldownPopup::updateView() { + QWidget *focused = focusWidget(); + ui->tempButton->setChecked(focused == ui->tempSlider); + int temp; if (showingCurrentTemp) temp = oven->currentTemp(); - else + else if (ui->tempSlider->isSliderDown() || focusWidget() == ui->tempSlider) temp = ui->tempSlider->sliderPosition(); + else + temp = ui->tempSlider->value(); + + if (ui->tempSlider->sliderPosition() != temp) + { + ui->tempSlider->blockSignals(true); + ui->tempSlider->setSliderPosition(temp); + ui->tempSlider->blockSignals(false); + } ui->tempCurrentLabel->setText(Stringer::temperature(temp, Stringer::fontSize14)); @@ -299,17 +311,21 @@ void CooldownPopup::onEncoderRight() void CooldownPopup::onEncoderClicked(QWidget *clicked) { if (clicked == ui->background) + { close(); - else if (clicked->inherits("QPushButton")) + return; + } + + QPushButton *b = qobject_cast(clicked); + if (b) { - QPushButton *b = qobject_cast(clicked); - if (b) - b->click(); + b->click(); + return; } - else if (clicked->inherits("Slider")) + + Slider *slider = qobject_cast(clicked); + if (slider) { - Slider *slider = qobject_cast(clicked); - if (slider == ui->tempSlider) - ui->tempButton->setFocus(); + ui->tempButton->setFocus(); } } diff --git a/app/gui/oven_control/cooldownpopup.ui b/app/gui/oven_control/cooldownpopup.ui index 8672879..efb5fd0 100644 --- a/app/gui/oven_control/cooldownpopup.ui +++ b/app/gui/oven_control/cooldownpopup.ui @@ -100,11 +100,16 @@ height: 33px; QPushButton { image: url(:/images/slider_icon/cooldown.png); } -QPushButton::pressed, QPushButton:focus { image: url(:/images/slider_icon/cooldown_ov.png); } +QPushButton:pressed, +QPushButton:focus { image: url(:/images/slider_icon/mark_01_icon_active.png); } +QPushButton:checked { image: url(:/images/slider_icon/cooldown_ov.png); } + + true + icon @@ -360,6 +365,9 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cooldown 140 + + Qt::ClickFocus + -- 2.1.4