From 0963768ba79b6304c27c9ea293c71824e77a64ef Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 3 Sep 2009 16:42:47 +0200 Subject: Make itemviews use gradient selection on Vista by default We postponed this in 4.3 when the vista style was introduced since a lot of microsoft apps still used the legacy style and microsoft did not enable it by default. It has been reported as bugs a few times and it seems increasingly odd that we are not using the more modern look and feel when we can. Instead of only enabling it for QTreeView, we now only disable it for QTableView as the look still cannot be used to span vertical cells. Task-number: QTBUG-3746 Reviewed-by: prasanth --- src/gui/styles/qwindowsvistastyle.cpp | 22 ++++++++-------------- src/gui/styles/qwindowsvistastyle_p.h | 1 + 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index b062a3f..6cb8b40 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -731,14 +731,11 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt { const QStyleOptionViewItemV4 *vopt; const QAbstractItemView *view = qobject_cast(widget); - bool newStyle = false; + bool newStyle = true; + + if (qobject_cast(widget)) + newStyle = false; - if (const QListView *listview = qobject_cast(widget)) { - if (listview->viewMode() == QListView::IconMode) - newStyle = true; - } else if (qobject_cast(widget)) { - newStyle = true; - } if (newStyle && view && (vopt = qstyleoption_cast(option))) { bool selected = vopt->state & QStyle::State_Selected; bool hover = vopt->state & QStyle::State_MouseOver; @@ -1496,14 +1493,11 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption { const QStyleOptionViewItemV4 *vopt; const QAbstractItemView *view = qobject_cast(widget); - bool newStyle = false; + bool newStyle = true; + + if (qobject_cast(widget)) + newStyle = false; - if (const QListView *listview = qobject_cast(widget)) { - if (listview->viewMode() == QListView::IconMode) - newStyle = true; - } else if (qobject_cast(widget)) { - newStyle = true; - } if (newStyle && view && (vopt = qstyleoption_cast(option))) { /* // We cannot currently get the correct selection color for "explorer style" views diff --git a/src/gui/styles/qwindowsvistastyle_p.h b/src/gui/styles/qwindowsvistastyle_p.h index d4170aa..e9bbb77 100644 --- a/src/gui/styles/qwindowsvistastyle_p.h +++ b/src/gui/styles/qwindowsvistastyle_p.h @@ -84,6 +84,7 @@ #include #include #include +#include #include #include -- cgit v0.12