remove old files
This commit is contained in:
parent
fcde226168
commit
3f73d9140b
|
@ -1,83 +0,0 @@
|
|||
#include "checkbox_internal.h"
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
#include <QGraphicsColorizeEffect>
|
||||
|
||||
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<qreal>((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));
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
#ifndef CHECKBOX_INTERNAL_H
|
||||
#define CHECKBOX_INTERNAL_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QIcon>
|
||||
|
||||
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
|
|
@ -1,58 +0,0 @@
|
|||
#include "radiobutton_internal.h"
|
||||
#include <QPainter>
|
||||
#include <QGraphicsColorizeEffect>
|
||||
|
||||
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));
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
#ifndef RADIOBUTTON_INTERNAL_H
|
||||
#define RADIOBUTTON_INTERNAL_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QIcon>
|
||||
|
||||
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
|
Loading…
Reference in New Issue