[PATCH 3 of 5] (issue72) Set background image as pixmap in textoverlayicon
Wald Commits
scm-commit at wald.intevation.org
Fri Aug 22 17:17:00 CEST 2014
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1408717225 -7200
# Node ID 57371f2e8daecd51fc600dba22acaa8158e1684c
# Parent 7ac5a366184dcdff926d966ce6ffea1072d58811
(issue72) Set background image as pixmap in textoverlayicon
diff -r 7ac5a366184d -r 57371f2e8dae ui/icons.qrc
--- a/ui/icons.qrc Fri Aug 22 16:19:46 2014 +0200
+++ b/ui/icons.qrc Fri Aug 22 16:20:25 2014 +0200
@@ -21,5 +21,6 @@
<file>img/security-high.png</file>
<file>img/trash-empty.png</file>
<file>img/update-list.png</file>
+ <file>img/red-circle.png</file>
</qresource>
</RCC>
diff -r 7ac5a366184d -r 57371f2e8dae ui/mainwindow.cpp
--- a/ui/mainwindow.cpp Fri Aug 22 16:19:46 2014 +0200
+++ b/ui/mainwindow.cpp Fri Aug 22 16:20:25 2014 +0200
@@ -823,6 +823,7 @@
TextOverlayButton *updatesButton = new TextOverlayButton;
updatesButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+ updatesButton->setBackgroundIcon(":/img/red-circle.png");
updatesButton->setIcon(QIcon(":/img/view-refresh.png"));
updatesButton->setIconSize(QSize(48, 48));
updatesButton->setText(tr("Updates"));
diff -r 7ac5a366184d -r 57371f2e8dae ui/textoverlaybutton.cpp
--- a/ui/textoverlaybutton.cpp Fri Aug 22 16:19:46 2014 +0200
+++ b/ui/textoverlaybutton.cpp Fri Aug 22 16:20:25 2014 +0200
@@ -30,6 +30,7 @@
QRect myRect = e->rect().translated(26, -29);
// circle
+/* old manually painted background
QLinearGradient gradient(myRect.topLeft(),
myRect.bottomRight());
gradient.setColorAt(0, Qt::white);
@@ -38,6 +39,8 @@
painter.setBrush(brush);
painter.setPen(Qt::white);
painter.drawEllipse(75.5, 6, 20, 20);
+ */
+ painter.drawPixmap(75.5, 5, mBackground);
// font
QFont font;
@@ -48,3 +51,7 @@
return;
}
+
+void TextOverlayButton::setBackgroundIcon (const QString& iconPath) {
+ mBackground = QIcon(iconPath).pixmap(QSize(22,22));
+}
diff -r 7ac5a366184d -r 57371f2e8dae ui/textoverlaybutton.h
--- a/ui/textoverlaybutton.h Fri Aug 22 16:19:46 2014 +0200
+++ b/ui/textoverlaybutton.h Fri Aug 22 16:20:25 2014 +0200
@@ -12,6 +12,7 @@
#include <QToolButton>
#include <QString>
+#include <QPixmap>
class QPaintEvent;
@@ -27,9 +28,11 @@
public slots:
void setOverlay (const QString& text) {mOverlay = text; repaint();}
+ void setBackgroundIcon (const QString& iconPath);
private:
QString mOverlay;
+ QPixmap mBackground;
};
#endif // UI_TEXTOVERLAYBUTTON_H
More information about the Trustbridge-commits
mailing list