• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kde-runtime API Reference
  • KDE Home
  • Contact Us
 

QtExtraComponents

  • sources
  • kde-4.14
  • kde-runtime
  • plasma
  • declarativeimports
  • qtextracomponents
qiconitem.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Marco Martin <mart@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef QICONITEM_H
21 #define QICONITEM_H
22 
23 #include <QDeclarativeItem>
24 #include <QPixmap>
25 #include <QVariant>
26 
27 class QIconItem : public QDeclarativeItem
28 {
29  Q_OBJECT
30 
31  Q_PROPERTY(QVariant icon READ icon WRITE setIcon)
32  Q_PROPERTY(bool smooth READ smooth WRITE setSmooth)
33  Q_PROPERTY(int implicitWidth READ implicitWidth CONSTANT)
34  Q_PROPERTY(int implicitHeight READ implicitHeight CONSTANT)
35  Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
36 
37  Q_ENUMS(State)
38 
39 public:
40 
41  enum State {
42  DefaultState,
43  ActiveState,
44  DisabledState
45  };
46 
47  QIconItem(QDeclarativeItem *parent=0);
48  ~QIconItem();
49 
50  void setIcon(const QVariant &icon);
51  QIcon icon() const;
52 
53  QIconItem::State state() const;
54  void setState(State state);
55 
56  int implicitWidth() const;
57  int implicitHeight() const;
58 
59  void setSmooth(const bool smooth);
60  bool smooth() const;
61 
62  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
63 
64 Q_SIGNALS:
65  void stateChanged(State state);
66 
67 private:
68  QIcon m_icon;
69  bool m_smooth;
70  State m_state;
71 };
72 
73 #endif
QIconItem::stateChanged
void stateChanged(State state)
QWidget
QIconItem::setIcon
void setIcon(const QVariant &icon)
Definition: qiconitem.cpp:41
QIconItem::DefaultState
Definition: qiconitem.h:42
QIconItem::state
QIconItem::State state() const
QIconItem::implicitHeight
int implicitHeight() const
QIconItem::smooth
bool smooth() const
QIconItem::DisabledState
Icon is active.
Definition: qiconitem.h:44
QPainter
QIconItem::QIconItem
QIconItem(QDeclarativeItem *parent=0)
Definition: qiconitem.cpp:28
QIconItem::State
State
Definition: qiconitem.h:41
QIconItem
Definition: qiconitem.h:27
QIconItem::~QIconItem
~QIconItem()
Definition: qiconitem.cpp:37
QIconItem::setSmooth
void setSmooth(const bool smooth)
Definition: qiconitem.cpp:84
QIconItem::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: qiconitem.cpp:98
QIconItem::icon
QIcon icon() const
QStyleOptionGraphicsItem
QDeclarativeItem
QIconItem::implicitWidth
int implicitWidth() const
QObject::parent
QObject * parent() const
QIconItem::setState
void setState(State state)
Definition: qiconitem.cpp:63
QIcon
QIconItem::ActiveState
The default state.
Definition: qiconitem.h:43
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:08:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

QtExtraComponents

Skip menu "QtExtraComponents"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kde-runtime API Reference

Skip menu "kde-runtime API Reference"
  • KCMShell
  • KNotify
  • Plasma Runtime
  •     PlasmaCore
  •     DragAndDrop
  •     PlasmaComponents
  •     PlasmaExtraComponents
  •     QtExtraComponents

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal