aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-10-08 09:16:34 -0400
committerKen Moore <moorekou@gmail.com>2015-10-08 09:16:34 -0400
commitf2e7539354da61ff2fd03ccfb58acae8b89aa097 (patch)
treed42fabdf0bd5a1ca0f3c5b30ffff63aa32739c76 /lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h
parentGet rid of an extra empty grid space between desktop items. (diff)
downloadlumina-f2e7539354da61ff2fd03ccfb58acae8b89aa097.tar.gz
lumina-f2e7539354da61ff2fd03ccfb58acae8b89aa097.tar.bz2
lumina-f2e7539354da61ff2fd03ccfb58acae8b89aa097.zip
Commit a couple fixes:
1) Make sure the calendar desktop plugin updates the date occasionally. 2) Add the framework for a custom-painted Toolbutton for the applauncher plugin. This will be used to ensure font outlines in the near future. 3) Another small adjustment for new window geometries - run the overall adjustment first - then re-check and see if the window is off the top of the screen before trying the fallback movement routine.
Diffstat (limited to 'lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h')
-rw-r--r--lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h b/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h
new file mode 100644
index 00000000..1e71658d
--- /dev/null
+++ b/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h
@@ -0,0 +1,58 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This is a simple subclass for a QToolButton with black/white text (for transparent backgrounds)
+//===========================================
+#ifndef _LUMINA_DESKTOP_PLUGIN_APPLAUNCHER_OUTLINE_TOOLBUTTON_H
+#define _LUMINA_DESKTOP_PLUGIN_APPLAUNCHER_OUTLINE_TOOLBUTTON_H
+
+#include <QToolButton>
+#include <QPainter>
+#include <QPainterPath>
+#include <QPen>
+#include <QStyle>
+#include <QStyleOption>
+#include <QStylePainter>
+#include <QFont>
+
+class OutlineToolButton : public QToolButton{
+ Q_OBJECT
+public:
+ OutlineToolButton(QWidget *parent=0) : QToolButton(parent){
+ QFont font = this->font();
+ font.setStyleStrategy(QFont::ForceOutline);// | QFont::PreferQuality);
+ this->setFont(font);
+ }
+ ~OutlineToolButton(){}
+
+protected:
+ void paintEvent(QPaintEvent*){
+
+ //QPainter painter(this);
+ //QPainterPath path;
+ //QPen pen;
+ //pen.setWidth(2);
+ //pen.setColor(Qt::red);
+ //painter.setFont(this->font());
+ //painter.setPen(pen);
+ //path.addText(10 , 60, this->font(), this->text()); //Adjust the position
+ //painter.drawPath(path);
+ QFont font = this->font();
+ font.setStyleStrategy(QFont::ForceOutline);// | QFont::PreferQuality);
+ //This is what a QToolButton performs
+ QStylePainter p(this);
+ //p.setPen(pen);
+ QStyleOptionToolButton opt;
+ initStyleOption(&opt);
+ opt.font = font; //Use the font which forces outlines
+ //p.style()->drawControl(QStyle::CE_ToolButtonLabel, &opt, &p, this); //this does the outline underneath
+ p.drawComplexControl(QStyle::CC_ToolButton, opt); //This does the normal painting on top
+ //Now do the normal paint event over the top
+ //QToolButton::paintEvent(ev);
+ }
+
+};
+#endif
bgstack15