QmlDesigner: Remove transparency from DocumentWarningWidget

The ToolTipBase has alpha in some themes (e.g. Flat Dark).
If the background of the DocumentWarningWidget is transparent,
this looks buggy. We remove the transparency by blending
the color against the background color.

Change-Id: I4a25a30700b3ee1e9e8d23d0b0bad09f297f0605
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2016-10-07 13:50:17 +02:00
committed by Thomas Hartmann
parent 572b5447ff
commit 2e81a39b7c

View File

@@ -27,6 +27,10 @@
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>
#include <utils/theme/theme.h>
#include <utils/stylehelper.h>
#include <QLabel> #include <QLabel>
#include <QPushButton> #include <QPushButton>
#include <QCheckBox> #include <QCheckBox>
@@ -170,6 +174,13 @@ bool DocumentWarningWidget::eventFilter(QObject *object, QEvent *event)
void DocumentWarningWidget::showEvent(QShowEvent *event) void DocumentWarningWidget::showEvent(QShowEvent *event)
{ {
const QColor backgroundColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_BackgroundColor);
QPalette pal = palette();
QColor color = pal.color(QPalette::ToolTipBase);
const QColor backgroundNoAlpha = Utils::StyleHelper::alphaBlendedColors(color, backgroundColor);
color.setAlpha(255);
pal.setColor(QPalette::ToolTipBase, backgroundNoAlpha);
setPalette(pal);
m_gotoCodeWasClicked = false; m_gotoCodeWasClicked = false;
moveToParentCenter(); moveToParentCenter();
refreshContent(); refreshContent();