summaryrefslogtreecommitdiffstats
path: root/globals.h
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-02-03 08:02:05 +0100
committerArno <arno@disconnect.de>2018-02-03 08:02:05 +0100
commit8512ed1a06888a98f71367f4ac3da3f6edc945c3 (patch)
treecd9504d630e25ab1e1db9cb64c01d73dc6877d81 /globals.h
parentcbb1974ae94858b101ba1bf92047236dcfa2e5fa (diff)
downloadShemovCleaner-8512ed1a06888a98f71367f4ac3da3f6edc945c3.tar.gz
ShemovCleaner-8512ed1a06888a98f71367f4ac3da3f6edc945c3.tar.bz2
ShemovCleaner-8512ed1a06888a98f71367f4ac3da3f6edc945c3.zip
Implement alternating row colors
Once again, surprisingly difficult, as you can see on the number of changed files. Coding the configuration options wasn't that difficult, but actually using them was. As it turned out, the default style on Windows doesn't use QApplication::palette() at all, though it does honor setAlternatingRowColors(). It just doesn't use the palette colors, but style sheets. Took me a while to figure out. So, there's always another layer of indirection: First, add all QTreeViews to Globals::views, then create a helper to set the style sheet.
Diffstat (limited to 'globals.h')
-rw-r--r--globals.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/globals.h b/globals.h
index e0bc5ef..c8037fe 100644
--- a/globals.h
+++ b/globals.h
@@ -3,9 +3,11 @@
#include <QObject>
#include <QHash>
+#include <QVector>
class QAction;
class Viewer;
+class QTreeView;
class Globals : public QObject {
Q_OBJECT
@@ -13,6 +15,8 @@ class Globals : public QObject {
enum ActionType { QuitAction = 0, ConfigAction = 1 };
static Globals *instance();
void addAction(QAction *a);
+ void addView(QTreeView *v);
+ const QVector<QTreeView*> views() { return mViews; }
QAction *action(int actionType);
Viewer *viewer();
@@ -23,6 +27,7 @@ class Globals : public QObject {
static Globals *mInstance;
QHash<int, QAction*> mActions;
Viewer *mViewer;
+ QVector<QTreeView*> mViews;
};
#endif // GLOBALS_H