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 | 137 | |
| 138 | 138 | void CooldownPopup::updateView() |
| 139 | 139 | { |
| 140 | + QWidget *focused = focusWidget(); | |
| 141 | + ui->tempButton->setChecked(focused == ui->tempSlider); | |
| 142 | + | |
| 140 | 143 | int temp; |
| 141 | 144 | if (showingCurrentTemp) |
| 142 | 145 | temp = oven->currentTemp(); |
| 143 | - else | |
| 146 | + else if (ui->tempSlider->isSliderDown() || focusWidget() == ui->tempSlider) | |
| 144 | 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 | 158 | ui->tempCurrentLabel->setText(Stringer::temperature(temp, Stringer::fontSize14)); |
| 147 | 159 | |
| ... | ... | @@ -299,17 +311,21 @@ void CooldownPopup::onEncoderRight() |
| 299 | 311 | void CooldownPopup::onEncoderClicked(QWidget *clicked) |
| 300 | 312 | { |
| 301 | 313 | if (clicked == ui->background) |
| 314 | + { | |
| 302 | 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 | 100 | </property> |
| 101 | 101 | <property name="styleSheet"> |
| 102 | 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 | 106 | </property> |
| 105 | 107 | <property name="text"> |
| 106 | 108 | <string notr="true"/> |
| 107 | 109 | </property> |
| 110 | + <property name="checkable"> | |
| 111 | + <bool>true</bool> | |
| 112 | + </property> | |
| 108 | 113 | <property name="style" stdset="0"> |
| 109 | 114 | <string notr="true">icon</string> |
| 110 | 115 | </property> |
| ... | ... | @@ -360,6 +365,9 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cooldown |
| 360 | 365 | <height>140</height> |
| 361 | 366 | </rect> |
| 362 | 367 | </property> |
| 368 | + <property name="focusPolicy"> | |
| 369 | + <enum>Qt::ClickFocus</enum> | |
| 370 | + </property> | |
| 363 | 371 | </widget> |
| 364 | 372 | </widget> |
| 365 | 373 | <widget class="QPushButton" name="closeButton"> | ... | ... |