Commit f9c67430c78472a5eca0b5d669ab2071ffa14bd0
1 parent
1fe669c2ef
Exists in
master
and in
2 other branches
현재 온도를 표시할 때 슬라이더도 같이 움직이도록 수정
Showing
2 changed files
with
34 additions
and
10 deletions
Show diff stats
app/gui/oven_control/cooldownpopup.cpp
| @@ -137,11 +137,23 @@ void CooldownPopup::showCurrentTemp() | @@ -137,11 +137,23 @@ void CooldownPopup::showCurrentTemp() | ||
| 137 | 137 | ||
| 138 | void CooldownPopup::updateView() | 138 | void CooldownPopup::updateView() |
| 139 | { | 139 | { |
| 140 | + QWidget *focused = focusWidget(); | ||
| 141 | + ui->tempButton->setChecked(focused == ui->tempSlider); | ||
| 142 | + | ||
| 140 | int temp; | 143 | int temp; |
| 141 | if (showingCurrentTemp) | 144 | if (showingCurrentTemp) |
| 142 | temp = oven->currentTemp(); | 145 | temp = oven->currentTemp(); |
| 143 | - else | 146 | + else if (ui->tempSlider->isSliderDown() || focusWidget() == ui->tempSlider) |
| 144 | temp = ui->tempSlider->sliderPosition(); | 147 | temp = ui->tempSlider->sliderPosition(); |
| 148 | + else | ||
| 149 | + temp = ui->tempSlider->value(); | ||
| 150 | + | ||
| 151 | + if (ui->tempSlider->sliderPosition() != temp) | ||
| 152 | + { | ||
| 153 | + ui->tempSlider->blockSignals(true); | ||
| 154 | + ui->tempSlider->setSliderPosition(temp); | ||
| 155 | + ui->tempSlider->blockSignals(false); | ||
| 156 | + } | ||
| 145 | 157 | ||
| 146 | ui->tempCurrentLabel->setText(Stringer::temperature(temp, Stringer::fontSize14)); | 158 | ui->tempCurrentLabel->setText(Stringer::temperature(temp, Stringer::fontSize14)); |
| 147 | 159 | ||
| @@ -299,17 +311,21 @@ void CooldownPopup::onEncoderRight() | @@ -299,17 +311,21 @@ void CooldownPopup::onEncoderRight() | ||
| 299 | void CooldownPopup::onEncoderClicked(QWidget *clicked) | 311 | void CooldownPopup::onEncoderClicked(QWidget *clicked) |
| 300 | { | 312 | { |
| 301 | if (clicked == ui->background) | 313 | if (clicked == ui->background) |
| 314 | + { | ||
| 302 | close(); | 315 | close(); |
| 303 | - else if (clicked->inherits("QPushButton")) | 316 | + return; |
| 317 | + } | ||
| 318 | + | ||
| 319 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
| 320 | + if (b) | ||
| 304 | { | 321 | { |
| 305 | - QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
| 306 | - if (b) | ||
| 307 | - b->click(); | 322 | + b->click(); |
| 323 | + return; | ||
| 308 | } | 324 | } |
| 309 | - else if (clicked->inherits("Slider")) | 325 | + |
| 326 | + Slider *slider = qobject_cast<Slider *>(clicked); | ||
| 327 | + if (slider) | ||
| 310 | { | 328 | { |
| 311 | - Slider *slider = qobject_cast<Slider *>(clicked); | ||
| 312 | - if (slider == ui->tempSlider) | ||
| 313 | - ui->tempButton->setFocus(); | 329 | + ui->tempButton->setFocus(); |
| 314 | } | 330 | } |
| 315 | } | 331 | } |
app/gui/oven_control/cooldownpopup.ui
| @@ -100,11 +100,16 @@ height: 33px; | @@ -100,11 +100,16 @@ height: 33px; | ||
| 100 | </property> | 100 | </property> |
| 101 | <property name="styleSheet"> | 101 | <property name="styleSheet"> |
| 102 | <string notr="true">QPushButton { image: url(:/images/slider_icon/cooldown.png); } | 102 | <string notr="true">QPushButton { image: url(:/images/slider_icon/cooldown.png); } |
| 103 | -QPushButton::pressed, QPushButton:focus { image: url(:/images/slider_icon/cooldown_ov.png); }</string> | 103 | +QPushButton:pressed, |
| 104 | +QPushButton:focus { image: url(:/images/slider_icon/mark_01_icon_active.png); } | ||
| 105 | +QPushButton:checked { image: url(:/images/slider_icon/cooldown_ov.png); }</string> | ||
| 104 | </property> | 106 | </property> |
| 105 | <property name="text"> | 107 | <property name="text"> |
| 106 | <string notr="true"/> | 108 | <string notr="true"/> |
| 107 | </property> | 109 | </property> |
| 110 | + <property name="checkable"> | ||
| 111 | + <bool>true</bool> | ||
| 112 | + </property> | ||
| 108 | <property name="style" stdset="0"> | 113 | <property name="style" stdset="0"> |
| 109 | <string notr="true">icon</string> | 114 | <string notr="true">icon</string> |
| 110 | </property> | 115 | </property> |
| @@ -360,6 +365,9 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cooldown | @@ -360,6 +365,9 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cooldown | ||
| 360 | <height>140</height> | 365 | <height>140</height> |
| 361 | </rect> | 366 | </rect> |
| 362 | </property> | 367 | </property> |
| 368 | + <property name="focusPolicy"> | ||
| 369 | + <enum>Qt::ClickFocus</enum> | ||
| 370 | + </property> | ||
| 363 | </widget> | 371 | </widget> |
| 364 | </widget> | 372 | </widget> |
| 365 | <widget class="QPushButton" name="closeButton"> | 373 | <widget class="QPushButton" name="closeButton"> |