Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
src_gui_image_qicon.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QIcon>
4#include <QPainter>
5#include <QToolButton>
6
8
9struct MyWidget : public QWidget
10{
12 bool isChecked() { return true; }
14};
15
16void wrapper0() {
17
20button->setIcon(QIcon("open.xpm"));
22
23
27
28} // wrapper0
29
30
33{
34 QPixmap pixmap = icon.pixmap(QSize(22, 22),
38 : QIcon::Off);
40}
42
43
44void wrapper1() {
45
47QIcon undoicon = QIcon::fromTheme("edit-undo");
49
50} // wrapper1
51
52
54QIcon undoicon = QIcon::fromTheme("edit-undo", QIcon(":/undo.png"));
56
57
58void wrapper2(){
62
63} // wrapper2
64} // src_gui_image_qicon
void setIcon(const QIcon &icon)
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
static void setFallbackSearchPaths(const QStringList &paths)
Definition qicon.cpp:1189
static QStringList fallbackSearchPaths()
Definition qicon.cpp:1168
@ Disabled
Definition qicon.h:22
@ Normal
Definition qicon.h:22
@ Off
Definition qicon.h:23
@ On
Definition qicon.h:23
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
Definition qicon.cpp:788
static QIcon fromTheme(const QString &name)
Definition qicon.cpp:1296
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
\inmodule QtCore\reentrant
Definition qpoint.h:23
\inmodule QtCore
Definition qsize.h:25
The QToolButton class provides a quick-access button to commands or options, usually used inside a QT...
Definition qtoolbutton.h:20
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QPoint pos
the position of the widget within its parent widget
Definition qwidget.h:111
bool isEnabled() const
Definition qwidget.h:814
QPushButton * button
[2]
widget render & pixmap
QPainter painter(this)
[7]
void drawIcon(QPainter *painter, QPoint pos)
[2]