summaryrefslogtreecommitdiffstats
path: root/helper.cpp
diff options
context:
space:
mode:
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);
+ }
}