summaryrefslogtreecommitdiffstats
path: root/helper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'helper.cpp')
-rw-r--r--helper.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/helper.cpp b/helper.cpp
index c3bc118..08b8532 100644
--- a/helper.cpp
+++ b/helper.cpp
@@ -11,8 +11,10 @@
#include <QPainter>
#include <QStandardPaths>
#include <QDir>
+#include <QTreeView>
#include "helper.h"
+#include "globals.h"
namespace Helper {
const QString md5Sum(const QString &path){
@@ -155,6 +157,21 @@ namespace Helper {
return QIcon(QPixmap::fromImage(img));
}
+ void setAlternatingRowColors(){
+ QSettings s;
+ bool alternate = s.value("alternatecolors").toBool();
+ if(alternate){
+ QColor b = s.value("basecolor").value<QColor>();
+ QColor a = s.value("altcolor").value<QColor>();
+ QString style = QString("background-color: rgb(%1,%2,%3);alternate-background-color: rgb(%4,%5,%6);").arg(b.red()).arg(b.green()).arg(b.blue()).arg(a.red()).arg(a.green()).arg(a.blue());
+ QVector<QTreeView*> views = Globals::instance()->views();
+ for(QTreeView *v : views){
+ v->setAlternatingRowColors(true);
+ v->setStyleSheet(style);
+ }
+ }
+ }
+
Duration::Duration() : mHours(0), mMinutes(0), mSeconds(0) {}
Duration::Duration(qint64 seconds){