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


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


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

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

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

//! [3]
    undoicon = QIcon.fromTheme("edit-undo")
//! [3]

//! [4]
    undoicon = QIcon.fromTheme("edit-undo", QIcon(":/undo.png"))
//! [4]