New upstream version 21.0.2+dfsg1
This commit is contained in:
parent
1f1bbb3518
commit
baafb6325b
706 changed files with 49633 additions and 5044 deletions
36
UI/locked-checkbox.cpp
Normal file
36
UI/locked-checkbox.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include <QPaintEvent>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include "locked-checkbox.hpp"
|
||||
|
||||
#include <util/c99defs.h>
|
||||
|
||||
LockedCheckBox::LockedCheckBox() : QCheckBox()
|
||||
{
|
||||
lockedImage =
|
||||
QPixmap::fromImage(QImage(":/res/images/locked_mask.png"));
|
||||
unlockedImage =
|
||||
QPixmap::fromImage(QImage(":/res/images/unlocked_mask.png"));
|
||||
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, image.width(), image.height(),
|
||||
QPixmap::fromImage(image));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue