qt-copy patch: fix alternate rows in Q{List,Tree}Widget

Matthew Woehlke mw_triad at users.sourceforge.net
Tue Sep 11 01:27:46 BST 2007


I'd like to commit the following to qt-copy... any objections? (I 
already reported the bug along with a similar patch against 
qlistview.cpp only; I'll forward the updated patch including 
qtreewidget.cpp once I have somewhere to send it.)

==== patches/0189-listview-alternate-row-colors.diff ====
qt-bugs@ issue :
Trolltech task ID :
applied: no
author: Matthew Woehlke <mw_triad at users.sourceforge.net>

This patch fixes incorrect setting of the palette color group in
QListView that resulted in alternate rows being drawn with the Active
AlternateBase color even for inactive widgets (while the rest of the
widget is drawn correctly). Please let me know if QListView and
QTreeView are not the only culprits.

--- src/gui/itemviews/qtreeview.cpp
+++ src/gui/itemviews/qtreeview.cpp
@@ -1356,7 +1356,8 @@
                  opt.state &= ~QStyle::State_Enabled;
                  cg = QPalette::Disabled;
              } else {
-                cg = QPalette::Active;
+                cg = window()->isActiveWindow() ? QPalette::Active
+                                                : QPalette::Inactive;
              }
              opt.palette.setCurrentColorGroup(cg);
          }
--- src/gui/itemviews/qlistview.cpp
+++ src/gui/itemviews/qlistview.cpp
@@ -1042,7 +1042,8 @@
                  option.state &= ~QStyle::State_Enabled;
                  cg = QPalette::Disabled;
              } else {
-                cg = QPalette::Normal;
+                cg = window()->isActiveWindow() ? QPalette::Active
+                                                : QPalette::Inactive;
              }
              option.palette.setCurrentColorGroup(cg);
          }
====

-- 
Matthew
A KWin crash is like a Finite Improbability Generator... only instead of 
undergarments, all my windows move 4 pixels to the right.





More information about the kde-core-devel mailing list