Commit c7e56b4c4e985156f8a1a6c18d23d3ef7fe17311
Committed by
David Gräff
1 parent
84f258e2
fix Dark mode background introduced with MacOS 10.14 (mojave) (#264)
this fix set the correct background when you change the style. without the patch and with Dark mode the text and background are white; with this patch the text remain white but the background will be set to dark. thanks to @gmittone Signed-off-by: Davide `rainbow` Gerhard <rainbow@irh.it>
Showing
2 changed files
with
10 additions
and
0 deletions
openhantek/src/widgets/sispinbox.cpp
| ... | ... | @@ -41,6 +41,8 @@ SiSpinBox::SiSpinBox(Unit unit, QWidget *parent) : QDoubleSpinBox(parent) { |
| 41 | 41 | this->init(); |
| 42 | 42 | |
| 43 | 43 | this->setUnit(unit); |
| 44 | + | |
| 45 | + this->setBackground(); | |
| 44 | 46 | } |
| 45 | 47 | |
| 46 | 48 | /// \brief Cleans up the main window. |
| ... | ... | @@ -177,3 +179,10 @@ void SiSpinBox::init() { |
| 177 | 179 | |
| 178 | 180 | /// \brief Resets the ::steppedTo flag after the value has been changed. |
| 179 | 181 | void SiSpinBox::resetSteppedTo() { this->steppedTo = false; } |
| 182 | + | |
| 183 | +// fix Dark mode background introduced with MacOS 10.24 (mojave) | |
| 184 | +void SiSpinBox::setBackground() { | |
| 185 | + QPalette palette; | |
| 186 | + QColor background = palette.color(QPalette::Window); | |
| 187 | + this->setStyleSheet("background-color: " + background.name()); | |
| 188 | +} | ... | ... |
openhantek/src/widgets/sispinbox.h