blob: 324b5fca79dd8adff652c1ef40fcf965b94de60a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
//=========================================================
// MusE
// Linux Music Editor
// $Id: ttoolbutton.cpp,v 1.1 2004/02/21 16:53:50 wschweer Exp $
// (C) Copyright 2004 Werner Schweer (ws@seh.de)
//=========================================================
#include <QPainter>
#include <QStyle>
#include "ttoolbutton.h"
#include "gconfig.h"
#include "icons.h"
//---------------------------------------------------------
// drawButton
//---------------------------------------------------------
void TransparentToolButton::drawButton(QPainter* p)
{
int w = width();
int h = height();
QIcon::Mode mode = isEnabled() ? QIcon::Normal : QIcon::Disabled;
QIcon::State state = isChecked() ? QIcon::On : QIcon::Off;
const QPixmap pm(icon().pixmap(style()->pixelMetric(QStyle::PM_SmallIconSize), mode, state));
p->drawPixmap(QPoint((w - pm.width())/2, (h - pm.height())/2), pm);
}
|