summaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_gui_image_qicon.cpp
blob: 5e8f1da4bcd94d6d857ae6512ea9531c2d0d6063 (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
//! [0]
button = QToolButton()
button.setIcon(QIcon("open.xpm"))
//! [0]


//! [1]
button.setIcon(QIcon())
//! [1]


//! [2]
def drawIcon(self, painter, pos):
    enabledStatus = QIcon.Normal
    if !isEnabled():
        enabledStatus = QIcon::Disabled

    onOff = QIcon.On
    if !isOn():
        onOff = QIcon.Off

    pixmap = icon.pixmap(QSize(22, 22),
                        enabledStatus,
                        onOff)
    painter.drawPixmap(pos, pixmap)
//! [2]