diff --git a/UI/locked-checkbox.cpp b/UI/locked-checkbox.cpp deleted file mode 100644 index 2d0d688eda06b664606fc4f056b4751bab565a20..0000000000000000000000000000000000000000 --- a/UI/locked-checkbox.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include -#include "locked-checkbox.hpp" - -#include - -LockedCheckBox::LockedCheckBox() : QCheckBox() -{ - QString lockedFile; - QString unlockedFile; - if (devicePixelRatio() >= 2) { - lockedFile = ":/res/images/locked_mask_2x.png"; - unlockedFile = ":/res/images/unlocked_mask_2x.png"; - } else { - lockedFile = ":/res/images/locked_mask.png"; - unlockedFile = ":/res/images/unlocked_mask.png"; - } - lockedImage = QPixmap::fromImage(QImage(lockedFile)); - unlockedImage = QPixmap::fromImage(QImage(unlockedFile)); - setMinimumSize(16, 16); - - setStyleSheet("outline: none;"); -} - -void LockedCheckBox::paintEvent(QPaintEvent *event) -{ - UNUSED_PARAMETER(event); - - QPixmap &pixmap = isChecked() ? lockedImage : unlockedImage; - QImage image(pixmap.size(), QImage::Format_ARGB32); - - QPainter draw(&image); - draw.setCompositionMode(QPainter::CompositionMode_Source); - draw.drawPixmap(0, 0, pixmap.width(), pixmap.height(), pixmap); - draw.setCompositionMode(QPainter::CompositionMode_SourceIn); - draw.fillRect(QRectF(QPointF(0.0f, 0.0f), pixmap.size()), - palette().color(foregroundRole())); - - QPainter p(this); - p.drawPixmap(0, 0, 16, 16, QPixmap::fromImage(image)); -} diff --git a/UI/locked-checkbox.hpp b/UI/locked-checkbox.hpp index 8510f4668fca48f3320a6d81ea258bd69ee16528..0eb2d82ab128b021a2a7443fa3f753958ab265dd 100644 --- a/UI/locked-checkbox.hpp +++ b/UI/locked-checkbox.hpp @@ -1,19 +1,7 @@ #pragma once #include -#include - -class QPaintEvernt; class LockedCheckBox : public QCheckBox { Q_OBJECT - - QPixmap lockedImage; - QPixmap unlockedImage; - -public: - LockedCheckBox(); - -protected: - void paintEvent(QPaintEvent *event) override; }; diff --git a/UI/visibility-checkbox.cpp b/UI/visibility-checkbox.cpp deleted file mode 100644 index d80cab2d4ecd29ffba0cddcd0c191b914af72c90..0000000000000000000000000000000000000000 --- a/UI/visibility-checkbox.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include -#include "visibility-checkbox.hpp" - -#include - -VisibilityCheckBox::VisibilityCheckBox() : QCheckBox() -{ - QString checkedFile; - QString uncheckedFile; - if (devicePixelRatio() >= 2) { - checkedFile = ":/res/images/visible_mask_2x.png"; - uncheckedFile = ":/res/images/invisible_mask_2x.png"; - } else { - checkedFile = ":/res/images/visible_mask.png"; - uncheckedFile = ":/res/images/invisible_mask.png"; - } - checkedImage = QPixmap::fromImage(QImage(checkedFile)); - uncheckedImage = QPixmap::fromImage(QImage(uncheckedFile)); - setMinimumSize(16, 16); - - setStyleSheet("outline: none;"); -} - -void VisibilityCheckBox::paintEvent(QPaintEvent *event) -{ - UNUSED_PARAMETER(event); - - QPixmap &pixmap = isChecked() ? checkedImage : uncheckedImage; - QImage image(pixmap.size(), QImage::Format_ARGB32); - - QPainter draw(&image); - draw.setCompositionMode(QPainter::CompositionMode_Source); - draw.drawPixmap(0, 0, pixmap.width(), pixmap.height(), pixmap); - draw.setCompositionMode(QPainter::CompositionMode_SourceIn); - draw.fillRect(QRectF(QPointF(0.0f, 0.0f), pixmap.size()), - palette().color(foregroundRole())); - - QPainter p(this); - p.drawPixmap(0, 0, 16, 16, QPixmap::fromImage(image)); -} diff --git a/UI/visibility-checkbox.hpp b/UI/visibility-checkbox.hpp index 3112c5db11019f931091f8832bdf7d8e0499ba88..ff21df2c4119572d6add3aa6392636b1018815f7 100644 --- a/UI/visibility-checkbox.hpp +++ b/UI/visibility-checkbox.hpp @@ -1,19 +1,7 @@ #pragma once #include -#include - -class QPaintEvernt; class VisibilityCheckBox : public QCheckBox { Q_OBJECT - - QPixmap checkedImage; - QPixmap uncheckedImage; - -public: - VisibilityCheckBox(); - -protected: - void paintEvent(QPaintEvent *event) override; };