Skip to content

Commit 06cfac2

Browse files
committed
Fix build for Qt4 by disabling the hack for unfocused QTreeView
1 parent 1f38313 commit 06cfac2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

style/adwaitahelper.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
#include <QPainterPath>
3030
#include <QStyle>
3131
#include <QWidget>
32+
33+
#if QT_VERSION > 0x050000
3234
#include <QWindow>
35+
#endif
3336

3437
#if ADWAITA_HAVE_X11
3538
#include <QX11Info>
@@ -59,6 +62,7 @@ class Helper
5962
virtual ~Helper()
6063
{}
6164

65+
#if QT_VERSION > 0x050000
6266
static bool isWindowActive(const QWidget *widget)
6367
{
6468
const QWindow *win = widget ? widget->window()->windowHandle() : nullptr;
@@ -67,6 +71,7 @@ class Helper
6771
}
6872
return false;
6973
}
74+
#endif
7075

7176
//*@name color utilities
7277
//@{

style/adwaitastyle.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ void Style::polish(QWidget *widget)
407407
}
408408
}
409409

410+
#if QT_VERSION > 0x050000
410411
// HACK to avoid different text color in unfocused views
411412
if (QAbstractItemView *view = qobject_cast<QAbstractItemView *>(widget)) {
412413
QWindow *win = widget ? widget->window()->windowHandle() : nullptr;
@@ -427,6 +428,7 @@ void Style::polish(QWidget *widget)
427428
}
428429

429430
}
431+
#endif
430432

431433
if (!widget->parent() || !qobject_cast<QWidget *>(widget->parent()) || qobject_cast<QDialog *>(widget) || qobject_cast<QMainWindow *>(widget)) {
432434
addEventFilter(widget);
@@ -4617,12 +4619,13 @@ bool Style::drawItemViewItemControl(const QStyleOption *option, QPainter *painte
46174619
#else
46184620
QStyleOptionViewItemV4 op(*vopt);
46194621
#endif
4622+
#if QT_VERSION > 0x050000
46204623
if (_helper->isWindowActive(widget)) {
46214624
QPalette palette = op.palette;
46224625
palette.setColor(QPalette::Inactive, QPalette::Text, palette.color(QPalette::Active, QPalette::Text));
46234626
op.palette = palette;
46244627
}
4625-
4628+
#endif
46264629
ParentStyleClass::drawControl(CE_ItemViewItem, &op, painter, widget);
46274630

46284631
return true;

0 commit comments

Comments
 (0)