Draw disabled text color for inactive window decorations
Task-number: QTBUG-68834 Change-Id: Iced478d12b56fc360c0d824cf5876855d887f9a2 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
This commit is contained in:
parent
f6fd704557
commit
4d87e7e34b
@ -87,6 +87,7 @@ private:
|
||||
QRectF minimizeButtonRect() const;
|
||||
|
||||
QColor m_foregroundColor;
|
||||
QColor m_foregroundInactiveColor;
|
||||
QColor m_backgroundColor;
|
||||
QStaticText m_windowTitle;
|
||||
Button m_clicking = None;
|
||||
@ -99,6 +100,7 @@ QWaylandBradientDecoration::QWaylandBradientDecoration()
|
||||
QPalette palette;
|
||||
m_foregroundColor = palette.color(QPalette::Active, QPalette::WindowText);
|
||||
m_backgroundColor = palette.color(QPalette::Active, QPalette::Window);
|
||||
m_foregroundInactiveColor = palette.color(QPalette::Disabled, QPalette::WindowText);
|
||||
|
||||
QTextOption option(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
option.setWrapMode(QTextOption::NoWrap);
|
||||
@ -181,7 +183,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device)
|
||||
|
||||
p.save();
|
||||
p.setClipRect(titleBar);
|
||||
p.setPen(m_foregroundColor);
|
||||
p.setPen(window()->isActive() ? m_foregroundColor : m_foregroundInactiveColor);
|
||||
QSizeF size = m_windowTitle.size();
|
||||
int dx = (top.width() - size.width()) /2;
|
||||
int dy = (top.height()- size.height()) /2;
|
||||
@ -197,7 +199,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device)
|
||||
QRectF rect;
|
||||
|
||||
// Default pen
|
||||
QPen pen(m_foregroundColor);
|
||||
QPen pen(window()->isActive() ? m_foregroundColor : m_foregroundInactiveColor);
|
||||
p.setPen(pen);
|
||||
|
||||
// Close button
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#include "qwaylandintegration_p.h"
|
||||
#include "qwaylandwindow_p.h"
|
||||
#include "qwaylandabstractdecoration_p.h"
|
||||
#include "qwaylandscreen_p.h"
|
||||
#include "qwaylandcursor_p.h"
|
||||
#include "qwaylandinputdevice_p.h"
|
||||
@ -407,6 +408,9 @@ void QWaylandDisplay::handleWindowActivated(QWaylandWindow *window)
|
||||
|
||||
mActiveWindows.append(window);
|
||||
requestWaylandSync();
|
||||
|
||||
if (auto *decoration = window->decoration())
|
||||
decoration->update();
|
||||
}
|
||||
|
||||
void QWaylandDisplay::handleWindowDeactivated(QWaylandWindow *window)
|
||||
@ -417,6 +421,9 @@ void QWaylandDisplay::handleWindowDeactivated(QWaylandWindow *window)
|
||||
requestWaylandSync();
|
||||
|
||||
mActiveWindows.removeOne(window);
|
||||
|
||||
if (auto *decoration = window->decoration())
|
||||
decoration->update();
|
||||
}
|
||||
|
||||
void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice)
|
||||
|
Loading…
x
Reference in New Issue
Block a user