From 57357d21c3633ff7dbb120e231b8b9eaf9821fb6 Mon Sep 17 00:00:00 2001 From: Arno Date: Tue, 7 Mar 2017 10:22:01 +0100 Subject: 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... --- helper.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'helper.cpp') diff --git a/helper.cpp b/helper.cpp index eaf0dda..5fa3a3b 100644 --- a/helper.cpp +++ b/helper.cpp @@ -1,6 +1,6 @@ #include -#include #include +#include #include #include @@ -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); + } } -- cgit v1.2.3-70-g09d2