summaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_gui_image_qicon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/codesnippets/doc/src/snippets/code/src_gui_image_qicon.cpp')
-rw-r--r--doc/codesnippets/doc/src/snippets/code/src_gui_image_qicon.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/doc/codesnippets/doc/src/snippets/code/src_gui_image_qicon.cpp b/doc/codesnippets/doc/src/snippets/code/src_gui_image_qicon.cpp
index 5e8f1da..efe7be4 100644
--- a/doc/codesnippets/doc/src/snippets/code/src_gui_image_qicon.cpp
+++ b/doc/codesnippets/doc/src/snippets/code/src_gui_image_qicon.cpp
@@ -12,15 +12,21 @@ button.setIcon(QIcon())
//! [2]
def drawIcon(self, painter, pos):
enabledStatus = QIcon.Normal
- if !isEnabled():
+ if not isEnabled():
enabledStatus = QIcon::Disabled
onOff = QIcon.On
- if !isOn():
+ if not isOn():
onOff = QIcon.Off
- pixmap = icon.pixmap(QSize(22, 22),
- enabledStatus,
- onOff)
+ 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]