Added a new widget pixmapbutton, which will be the new baseclass for all
buttons used in promoe
This commit is contained in:
parent
b7ae919014
commit
e2fdb4e009
3 changed files with 73 additions and 0 deletions
30
src/widgets/pixmapbutton.cpp
Normal file
30
src/widgets/pixmapbutton.cpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
|
||||
#include "pixmapbutton.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
#include <QPixmap>
|
||||
|
||||
PixmapButton::PixmapButton (QWidget *parent) : QAbstractButton (parent)
|
||||
{
|
||||
}
|
||||
|
||||
PixmapButton::~PixmapButton ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
PixmapButton::paintEvent( QPaintEvent * event )
|
||||
{
|
||||
QPixmap pixmap = icon().pixmap (size(),
|
||||
isDown() ? QIcon::Active : QIcon::Normal,
|
||||
isChecked() ? QIcon::On : QIcon::Off);
|
||||
|
||||
QPainter p;
|
||||
p.begin(this);
|
||||
p.drawPixmap( rect(), pixmap, pixmap.rect() );
|
||||
p.end();
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue