Work-around unfocused item vew colours with Kantum
This commit is contained in:
committed by
Craig Drummond
parent
7542b77672
commit
4ee7ee5609
@@ -136,6 +136,14 @@ public:
|
||||
cg = QPalette::Inactive;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
if (QPalette::Inactive==cg && option.state & QStyle::State_Enabled && parent() && qobject_cast<QWidget *>(parent())) {
|
||||
QWidget *pw=static_cast<QWidget *>(parent());
|
||||
if (pw->topLevelWidget() && pw->topLevelWidget()->isActiveWindow()) {
|
||||
cg = QPalette::Normal;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
QStyleOptionViewItem opt(option);
|
||||
opt.showDecorationSelected = true;
|
||||
QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
|
||||
|
||||
@@ -323,7 +323,15 @@ void GroupedViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
|
||||
#ifdef Q_OS_WIN
|
||||
QColor textColor(option.palette.color(QPalette::Text));
|
||||
#else
|
||||
QColor textColor(option.palette.color(option.state&QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text));
|
||||
|
||||
bool active = option.state&QStyle::State_Active;
|
||||
#ifdef Q_OS_LINUX
|
||||
if (!active && view && view->topLevelWidget() && view->topLevelWidget()->isActiveWindow()) {
|
||||
active=true;
|
||||
}
|
||||
#endif
|
||||
|
||||
QColor textColor(option.palette.color(active ? QPalette::Active : QPalette::Inactive, option.state&QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text));
|
||||
#endif
|
||||
QTextOption textOpt(Qt::AlignVCenter);
|
||||
QRect r(option.rect.adjusted(constBorder+4, constBorder, -(constBorder+4), -constBorder));
|
||||
|
||||
@@ -179,6 +179,11 @@ public:
|
||||
bool gtk=mouseOver && GtkStyle::isActive();
|
||||
bool selected=option.state&QStyle::State_Selected;
|
||||
bool active=option.state&QStyle::State_Active;
|
||||
#ifdef Q_OS_LINUX
|
||||
if (!active && itemView() && itemView()->topLevelWidget() && itemView()->topLevelWidget()->isActiveWindow()) {
|
||||
active=true;
|
||||
}
|
||||
#endif
|
||||
bool drawBgnd=true;
|
||||
bool iconMode = view && QListView::IconMode==view->viewMode();
|
||||
QStyleOptionViewItem opt(option);
|
||||
@@ -436,6 +441,11 @@ public:
|
||||
bool rtl = QApplication::isRightToLeft();
|
||||
bool selected=option.state&QStyle::State_Selected;
|
||||
bool active=option.state&QStyle::State_Active;
|
||||
#ifdef Q_OS_LINUX
|
||||
if (!active && itemView() && itemView()->topLevelWidget() && itemView()->topLevelWidget()->isActiveWindow()) {
|
||||
active=true;
|
||||
}
|
||||
#endif
|
||||
bool mouseOver=underMouse && option.state&QStyle::State_MouseOver;
|
||||
#ifdef Q_OS_WIN
|
||||
QColor textColor(option.palette.color(active ? QPalette::Active : QPalette::Inactive, QPalette::Text));
|
||||
|
||||
Reference in New Issue
Block a user