Merge pull request #6779 from spycrab/qt_trans_fix

Qt/WrapInScrollArea: Only use transparency on Windows
This commit is contained in:
Anthony 2018-05-07 09:56:47 -07:00 committed by GitHub
commit ecd9b94415
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -30,11 +30,17 @@ QWidget* GetWrappedWidget(QWidget* wrapped_widget, QWidget* to_resize, int margi
std::max(recommended_height, to_resize->height())); std::max(recommended_height, to_resize->height()));
} }
#ifdef _WIN32
// Transparency can cause unwanted side-effects on OSes other than Windows
// Make sure the background color stays consistent with the parent widget // Make sure the background color stays consistent with the parent widget
QPalette p = wrapped_widget->palette(); QPalette p = wrapped_widget->palette();
p.setColor(QPalette::Window, QColor(0, 0, 0, 0)); p.setColor(QPalette::Window, QColor(0, 0, 0, 0));
wrapped_widget->setPalette(p); wrapped_widget->setPalette(p);
scroll->setPalette(p); scroll->setPalette(p);
#endif
return scroll; return scroll;
} }