From 3f73d9140b07ad835bf8760e0e51962705ced025 Mon Sep 17 00:00:00 2001 From: laserpants Date: Tue, 14 Jun 2016 02:29:05 +0300 Subject: [PATCH] remove old files --- components/checkbox_internal.cpp | 83 ----------------------------- components/checkbox_internal.h | 45 ---------------- components/radiobutton_internal.cpp | 58 -------------------- components/radiobutton_internal.h | 40 -------------- 4 files changed, 226 deletions(-) delete mode 100644 components/checkbox_internal.cpp delete mode 100644 components/checkbox_internal.h delete mode 100644 components/radiobutton_internal.cpp delete mode 100644 components/radiobutton_internal.h diff --git a/components/checkbox_internal.cpp b/components/checkbox_internal.cpp deleted file mode 100644 index 90da8d9..0000000 --- a/components/checkbox_internal.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "checkbox_internal.h" -#include -#include -#include - -CheckboxIcon::CheckboxIcon(const QIcon &icon, QWidget *parent) - : QWidget(parent), - _icon(icon), - _iconSize(24), - _opacity(1.0), - _effect(new QGraphicsColorizeEffect) -{ - setAttribute(Qt::WA_TransparentForMouseEvents); - - setGraphicsEffect(_effect); -} - -CheckboxIcon::~CheckboxIcon() -{ -} - -void CheckboxIcon::setColor(const QColor &color) -{ - if (_effect->color() == color) - return; - - _effect->setColor(color); - update(); -} - -QColor CheckboxIcon::color() const -{ - return _effect->color(); -} - -void CheckboxIcon::setIconSize(qreal size) -{ - _iconSize = size; - update(); -} - -qreal CheckboxIcon::iconSize() const -{ - return _iconSize; -} - -void CheckboxIcon::setOpacity(qreal opacity) -{ - _opacity = opacity; - update(); -} - -qreal CheckboxIcon::opacity() const -{ - return _opacity; -} - -void CheckboxIcon::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event) - -#ifdef DEBUG_LAYOUT - QPainter debug(this); - debug.drawRect(rect().adjusted(0, 0, -1, -1)); -#endif - - if (0 == _iconSize) - return; - - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing); - painter.setOpacity(_opacity); - - const qreal p = static_cast((height())-_iconSize)/2; - const qreal z = _iconSize/24; - - QTransform t; - t.translate(p, p); - t.scale(z, z); - painter.setTransform(t); - - _icon.paint(&painter, QRect(0, 0, 24, 24)); -} diff --git a/components/checkbox_internal.h b/components/checkbox_internal.h deleted file mode 100644 index fb6aced..0000000 --- a/components/checkbox_internal.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef CHECKBOX_INTERNAL_H -#define CHECKBOX_INTERNAL_H - -#include -#include - -class QGraphicsColorizeEffect; - -class CheckboxIcon : public QWidget -{ - Q_OBJECT - - Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(qreal iconSize READ iconSize WRITE setIconSize) - Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity) - -public: - CheckboxIcon(const QIcon &icon, QWidget *parent = 0); - ~CheckboxIcon(); - - inline void setIcon(const QIcon &icon) { _icon = icon; update(); } - inline QIcon icon() const { return _icon; } - - void setColor(const QColor &color); - QColor color() const; - - void setIconSize(qreal size); - qreal iconSize() const; - - void setOpacity(qreal opacity); - qreal opacity() const; - -protected: - void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; - -private: - Q_DISABLE_COPY(CheckboxIcon) - - QIcon _icon; - qreal _iconSize; - qreal _opacity; - QGraphicsColorizeEffect *const _effect; -}; - -#endif // CHECKBOX_INTERNAL_H diff --git a/components/radiobutton_internal.cpp b/components/radiobutton_internal.cpp deleted file mode 100644 index aec3c9c..0000000 --- a/components/radiobutton_internal.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "radiobutton_internal.h" -#include -#include - -RadioButtonIcon::RadioButtonIcon(const QIcon &icon, QWidget *parent) - : QWidget(parent), - _icon(icon), - _iconSize(24), - _effect(new QGraphicsColorizeEffect) -{ - setAttribute(Qt::WA_TransparentForMouseEvents); - - setGraphicsEffect(_effect); -} - -RadioButtonIcon::~RadioButtonIcon() -{ -} - -void RadioButtonIcon::setColor(const QColor &color) -{ - _effect->setColor(color); - update(); -} - -QColor RadioButtonIcon::color() const -{ - return _effect->color(); -} - -void RadioButtonIcon::setIconSize(int size) -{ - _iconSize = size; - update(); -} - -int RadioButtonIcon::iconSize() const -{ - return _iconSize; -} - -void RadioButtonIcon::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event) - -#ifdef DEBUG_LAYOUT - QPainter debug(this); - debug.drawRect(rect().adjusted(0, 0, -1, -1)); -#endif - - if (0 == _iconSize) - return; - - QPainter painter(this); - - const int p = (height() - _iconSize)/2; - _icon.paint(&painter, QRect(p, p, _iconSize, _iconSize)); -} diff --git a/components/radiobutton_internal.h b/components/radiobutton_internal.h deleted file mode 100644 index 6d07c8c..0000000 --- a/components/radiobutton_internal.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef RADIOBUTTON_INTERNAL_H -#define RADIOBUTTON_INTERNAL_H - -#include -#include - -class QGraphicsColorizeEffect; - -class RadioButtonIcon : public QWidget -{ - Q_OBJECT - - Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(int iconSize READ iconSize WRITE setIconSize) - -public: - RadioButtonIcon(const QIcon &icon, QWidget *parent = 0); - ~RadioButtonIcon(); - - inline void setIcon(const QIcon &icon) { _icon = icon; update(); } - inline QIcon icon() const { return _icon; } - - void setColor(const QColor &color); - QColor color() const; - - void setIconSize(int size); - int iconSize() const; - -protected: - void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; - -private: - Q_DISABLE_COPY(RadioButtonIcon) - - QIcon _icon; - int _iconSize; - QGraphicsColorizeEffect *const _effect; -}; - -#endif // RADIOBUTTON_INTERNAL_H