summaryrefslogtreecommitdiffstats
path: root/helper.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2017-03-07 10:22:01 +0100
committerArno <arno@disconnect.de>2017-03-07 10:22:01 +0100
commit57357d21c3633ff7dbb120e231b8b9eaf9821fb6 (patch)
tree9378471bc18825b678e65b93313259335d8531c1 /helper.cpp
parentfad486922aa8ac8a4e55bd154bd8817f759d7ebd (diff)
downloadBeetPlayer-57357d21c3633ff7dbb120e231b8b9eaf9821fb6.tar.gz
BeetPlayer-57357d21c3633ff7dbb120e231b8b9eaf9821fb6.tar.bz2
BeetPlayer-57357d21c3633ff7dbb120e231b8b9eaf9821fb6.zip
Implement color choosing dialog for QTreeViews
Hmm, this shouldn't be so hard. Quite a lot of code for such an easy thing, but maybe it's just me and I'm over-complicating things...
Diffstat (limited to 'helper.cpp')
-rw-r--r--helper.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/helper.cpp b/helper.cpp
index eaf0dda..5fa3a3b 100644
--- a/helper.cpp
+++ b/helper.cpp
@@ -1,6 +1,6 @@
#include <QPainter>
-#include <QPalette>
#include <QAction>
+#include <QLabel>
#include <QApplication>
#include <taglib/fileref.h>
@@ -35,4 +35,20 @@ namespace Helper {
TagLib::AudioProperties *props = f.audioProperties();
return props->lengthInSeconds();
}
+
+ QColor colorFromLabel(QLabel *l){
+ QColor retval;
+ const QPixmap *pm = l->pixmap();
+ if(pm){
+ QImage img = pm->toImage();
+ retval = img.pixelColor(0, 0);
+ }
+ return retval;
+ }
+
+ void fillLabel(QLabel *l, QColor c){
+ QPixmap newPm(l->sizeHint());
+ newPm.fill(c);
+ l->setPixmap(newPm);
+ }
}