Icon

Search for usage in LXR

#include <icon.h>

Inheritance diagram for Icon:

Public Types

enum  Status { Null = 0, Ready, Loading, Error }
 
- Public Types inherited from QQuickItem
enum  Flag
 
enum  ItemChange
 
enum  TransformOrigin
 

Properties

bool active
 
QColor color
 
QString fallback
 
bool isMask
 
qreal paintedHeight
 
qreal paintedWidth
 
QString placeholder
 
bool selected
 
QVariant source
 
Icon::Status status
 
bool valid
 
- Properties inherited from QQuickItem
 activeFocus
 
 activeFocusOnTab
 
 antialiasing
 
 baselineOffset
 
 childrenRect
 
 clip
 
 enabled
 
 focus
 
 height
 
 implicitHeight
 
 implicitWidth
 
 opacity
 
 parent
 
 rotation
 
 scale
 
 smooth
 
 state
 
 transformOrigin
 
 visible
 
 width
 
 x
 
 y
 
 z
 
- Properties inherited from QObject
 objectName
 

Signals

void activeChanged ()
 
void colorChanged ()
 
void fallbackChanged (const QString &fallback)
 
void isMaskChanged ()
 
void paintedAreaChanged ()
 
void placeholderChanged (const QString &placeholder)
 
void selectedChanged ()
 
void sourceChanged ()
 
void statusChanged ()
 
void validChanged ()
 

Public Member Functions

 Icon (QQuickItem *parent=nullptr)
 
bool active () const
 
QColor color () const
 
QString fallback () const
 
bool isMask () const
 
qreal paintedHeight () const
 
qreal paintedWidth () const
 
QString placeholder () const
 
bool selected () const
 
void setActive (bool active=true)
 
void setColor (const QColor &color)
 
void setFallback (const QString &fallback)
 
void setIsMask (bool mask)
 
void setPlaceholder (const QString &placeholder)
 
void setSelected (bool selected=true)
 
void setSource (const QVariant &source)
 
QVariant source () const
 
Status status () const
 
QSGNodeupdatePaintNode (QSGNode *node, UpdatePaintNodeData *data) override
 
bool valid () const
 
- Public Member Functions inherited from QQuickItem
 QQuickItem (QQuickItem *parent)
 
Qt::MouseButtons acceptedMouseButtons () const const
 
bool acceptHoverEvents () const const
 
bool acceptTouchEvents () const const
 
void activeFocusChanged (bool)
 
bool activeFocusOnTab () const const
 
void activeFocusOnTabChanged (bool)
 
bool antialiasing () const const
 
void antialiasingChanged (bool)
 
qreal baselineOffset () const const
 
void baselineOffsetChanged (qreal)
 
QQuickItemchildAt (qreal x, qreal y) const const
 
QList< QQuickItem * > childItems () const const
 
QRectF childrenRect ()
 
void childrenRectChanged (const QRectF &)
 
bool clip () const const
 
void clipChanged (bool)
 
QObjectcontainmentMask () const const
 
void containmentMaskChanged ()
 
virtual bool contains (const QPointF &point) const const
 
QCursor cursor () const const
 
void enabledChanged ()
 
bool filtersChildMouseEvents () const const
 
QQuickItem::Flags flags () const const
 
void focusChanged (bool)
 
void forceActiveFocus ()
 
void forceActiveFocus (Qt::FocusReason reason)
 
void grabMouse ()
 
QSharedPointer< QQuickItemGrabResultgrabToImage (const QSize &targetSize)
 
void grabTouchPoints (const QVector< int > &ids)
 
bool hasActiveFocus () const const
 
bool hasFocus () const const
 
qreal height () const const
 
void heightChanged ()
 
qreal implicitHeight () const const
 
void implicitHeightChanged ()
 
qreal implicitWidth () const const
 
void implicitWidthChanged ()
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const const
 
bool isAncestorOf (const QQuickItem *child) const const
 
bool isEnabled () const const
 
bool isFocusScope () const const
 
virtual bool isTextureProvider () const const
 
bool isVisible () const const
 
bool keepMouseGrab () const const
 
bool keepTouchGrab () const const
 
QPointF mapFromGlobal (const QPointF &point) const const
 
QPointF mapFromItem (const QQuickItem *item, const QPointF &point) const const
 
QPointF mapFromScene (const QPointF &point) const const
 
QRectF mapRectFromItem (const QQuickItem *item, const QRectF &rect) const const
 
QRectF mapRectFromScene (const QRectF &rect) const const
 
QRectF mapRectToItem (const QQuickItem *item, const QRectF &rect) const const
 
QRectF mapRectToScene (const QRectF &rect) const const
 
QPointF mapToGlobal (const QPointF &point) const const
 
QPointF mapToItem (const QQuickItem *item, const QPointF &point) const const
 
QPointF mapToScene (const QPointF &point) const const
 
QQuickItemnextItemInFocusChain (bool forward)
 
qreal opacity () const const
 
void opacityChanged ()
 
void parentChanged (QQuickItem *)
 
QQuickItemparentItem () const const
 
void polish ()
 
void resetAntialiasing ()
 
void resetHeight ()
 
void resetWidth ()
 
qreal rotation () const const
 
void rotationChanged ()
 
qreal scale () const const
 
void scaleChanged ()
 
QQuickItemscopedFocusItem () const const
 
void setAcceptedMouseButtons (Qt::MouseButtons buttons)
 
void setAcceptHoverEvents (bool enabled)
 
void setAcceptTouchEvents (bool enabled)
 
void setActiveFocusOnTab (bool)
 
void setAntialiasing (bool)
 
void setBaselineOffset (qreal)
 
void setClip (bool)
 
void setContainmentMask (QObject *mask)
 
void setCursor (const QCursor &cursor)
 
void setEnabled (bool)
 
void setFiltersChildMouseEvents (bool filter)
 
void setFlag (QQuickItem::Flag flag, bool enabled)
 
void setFlags (QQuickItem::Flags flags)
 
void setFocus (bool focus, Qt::FocusReason reason)
 
void setFocus (bool)
 
void setHeight (qreal)
 
void setImplicitHeight (qreal)
 
void setImplicitWidth (qreal)
 
void setKeepMouseGrab (bool keep)
 
void setKeepTouchGrab (bool keep)
 
void setOpacity (qreal)
 
void setParentItem (QQuickItem *parent)
 
void setRotation (qreal)
 
void setScale (qreal)
 
void setSize (const QSizeF &size)
 
void setSmooth (bool)
 
void setState (const QString &)
 
void setTransformOrigin (QQuickItem::TransformOrigin)
 
void setVisible (bool)
 
void setWidth (qreal)
 
void setX (qreal)
 
void setY (qreal)
 
void setZ (qreal)
 
QSizeF size () const const
 
bool smooth () const const
 
void smoothChanged (bool)
 
void stackAfter (const QQuickItem *sibling)
 
void stackBefore (const QQuickItem *sibling)
 
QString state () const const
 
void stateChanged (const QString &)
 
virtual QSGTextureProvidertextureProvider () const const
 
QQuickItem::TransformOrigin transformOrigin () const const
 
void transformOriginChanged (QQuickItem::TransformOrigin)
 
void ungrabMouse ()
 
void ungrabTouchPoints ()
 
void unsetCursor ()
 
void update ()
 
void visibleChanged ()
 
qreal width () const const
 
void widthChanged ()
 
QQuickWindowwindow () const const
 
void windowChanged (QQuickWindow *window)
 
qreal x () const const
 
void xChanged ()
 
qreal y () const const
 
void yChanged ()
 
qreal z () const const
 
void zChanged ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

QImage findIcon (const QSize &size)
 
void geometryChange (const QRectF &newGeometry, const QRectF &oldGeometry) override
 
bool guessMonochrome (const QImage &img)
 
void handleFinished (QNetworkReply *reply)
 
void handleRedirect (QNetworkReply *reply)
 
QIcon::Mode iconMode () const
 
void itemChange (QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value) override
 
void setStatus (Status status)
 
void updateIsMaskHeuristic (const QString &iconSource)
 
void updatePaintedGeometry ()
 
void updatePolish () override
 
- Protected Member Functions inherited from QQuickItem
virtual bool childMouseEventFilter (QQuickItem *item, QEvent *event)
 
virtual void classBegin () override
 
virtual void componentComplete () override
 
virtual void dragEnterEvent (QDragEnterEvent *event)
 
virtual void dragLeaveEvent (QDragLeaveEvent *event)
 
virtual void dragMoveEvent (QDragMoveEvent *event)
 
virtual void dropEvent (QDropEvent *event)
 
virtual bool event (QEvent *ev) override
 
virtual void focusInEvent (QFocusEvent *)
 
virtual void focusOutEvent (QFocusEvent *)
 
virtual void geometryChanged (const QRectF &newGeometry, const QRectF &oldGeometry)
 
bool heightValid () const const
 
virtual void hoverEnterEvent (QHoverEvent *event)
 
virtual void hoverLeaveEvent (QHoverEvent *event)
 
virtual void hoverMoveEvent (QHoverEvent *event)
 
virtual void inputMethodEvent (QInputMethodEvent *event)
 
bool isComponentComplete () const const
 
virtual void keyPressEvent (QKeyEvent *event)
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void mouseUngrabEvent ()
 
virtual void releaseResources ()
 
virtual void touchEvent (QTouchEvent *event)
 
virtual void touchUngrabEvent ()
 
void updateInputMethod (Qt::InputMethodQueries queries)
 
virtual QSGNodeupdatePaintNode (QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *updatePaintNodeData)
 
virtual void wheelEvent (QWheelEvent *event)
 
bool widthValid () const const
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QQuickItem
 Bottom
 
 BottomLeft
 
 BottomRight
 
 Center
 
typedef Flags
 
 ItemAcceptsDrops
 
 ItemAcceptsInputMethod
 
 ItemActiveFocusHasChanged
 
 ItemAntialiasingHasChanged
 
 ItemChildAddedChange
 
 ItemChildRemovedChange
 
 ItemClipsChildrenToShape
 
 ItemDevicePixelRatioHasChanged
 
 ItemEnabledHasChanged
 
 ItemHasContents
 
 ItemIsFocusScope
 
 ItemOpacityHasChanged
 
 ItemParentHasChanged
 
 ItemRotationHasChanged
 
 ItemSceneChange
 
 ItemVisibleHasChanged
 
 Left
 
 Right
 
 Top
 
 TopLeft
 
 TopRight
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

Class for rendering an icon in UI.

Definition at line 26 of file icon.h.

Member Enumeration Documentation

◆ Status

This enum indicates the current status of the icon.

Enumerator
Null 

No icon source has been set.

Ready 

The icon has been loaded correctly.

Loading 

The icon is currently being loaded.

Error 

There was an error while loading the icon, for instance a non existent themed name, or an invalid url.

Definition at line 185 of file icon.h.

Property Documentation

◆ active

bool Icon::active
readwrite

This property sets whether the icon will use the QIcon.Active mode, resulting in a graphical effect being applied when the icon is currently active.

Note
This is typically used to indicate when an item is being hovered or pressed.

The color differences under the default KDE color palette, Breeze. Note that a dull highlight background is typically displayed behind active icons and it is recommended to add one if you are creating a custom component.

default: false

Definition at line 98 of file icon.h.

◆ color

QColor Icon::color
readwrite

This property holds the color to use when drawing the icon.

This property is used only when ::isMask is set to true. If this property is not set or is Qt::transparent, the icon will use the text or the selected text color, depending on if ::selected is set to true.

default: Qt::transparent

See also
Qt::GlobalColor

Definition at line 144 of file icon.h.

◆ fallback

QString Icon::fallback
readwrite

This property holds the name of an icon from the icon theme as a fallback for when an icon set with the source property is not found.

import org.kde.kirigami 2.20 as Kirigami
Kirigami.Icon {
source: "this-icon-does-not-exist"
fallback: "view-refresh"
}
Note
This will only be loaded if source is unavailable (e.g. it doesn't exist, or network issues have prevented loading).

Definition at line 66 of file icon.h.

◆ isMask

bool Icon::isMask
readwrite

This property sets whether this icon will be treated as a mask.

When an icon is being used as a mask, all non-transparent colors are replaced with the color provided in the Icon's ::color property.

default: false

See also
::color

Definition at line 131 of file icon.h.

◆ paintedHeight

qreal Icon::paintedHeight
read

This property holds the height of the painted area in pixels.

This will be smaller than or equal to the height of the area taken up by the Item itself. This can be 0.

default: 0.0

Since
KDE Frameworks 5.15

Definition at line 180 of file icon.h.

◆ paintedWidth

qreal Icon::paintedWidth
read

This property holds the width of the painted area in pixels.

This will be smaller than or equal to the width of the area taken up by the Item itself. This can be 0.

default: 0.0

Since
KDE Frameworks 5.15

Definition at line 168 of file icon.h.

◆ placeholder

QString Icon::placeholder
readwrite

This property holds the name of an icon from the icon theme to show while the icon set in source is being loaded.

This will only be used if the source image is a type that can have such a long loading time that showing a temporary image in its place makes sense (e.g. a remote image, or an image from an ImageProvider of the type QtQml.QQmlImageProviderBase.ImageResponse).

default: "image-png"

Since
KDE Frameworks 5.15

Definition at line 81 of file icon.h.

◆ selected

bool Icon::selected
readwrite

This property sets whether the icon will use the QIcon.Selected mode, resulting in a graphical effect being applied when the icon is currently selected.

This is typically used to indicate when a list item is currently selected.

The color differences under the default KDE color palette, Breeze. Note that a blue background is typically displayed behind selected elements.

default: false

Definition at line 119 of file icon.h.

◆ source

QVariant Icon::source
readwrite

This property holds the source of this icon.

The icon can be pulled from:

  • The Freedesktop standard icon name:
    import org.kde.kirigami 2.20 as Kirigami
    Kirigami.Icon {
    source: "view-refresh"
    }
  • The filesystem:
    import org.kde.kirigami 2.20 as Kirigami
    Kirigami.Icon {
    source: "/home/example/cool.svg"
    }
  • Remote URIs:
    import org.kde.kirigami 2.20 as Kirigami
    Kirigami.Icon {
    source: "https://example.com/kirigami.png"
    }
  • Custom providers:
    import org.kde.kirigami 2.20 as Kirigami
    Kirigami.Icon {
    source: "image://provider/kirigami.svg"
    }
  • Your application's bundled resources:
    import org.kde.kirigami 2.20 as Kirigami
    Kirigami.Icon {
    source: "qrc:/kirigami.svg"
    }
Note
See https://doc.qt.io/qt-5/qtquickcontrols2-icons.html for how to bundle icon themes in your application to refer to them by name instead of by resource URL.
Use fallback to provide a fallback theme name for icons.
Cuttlefish is a KDE application that lets you view all the icons that you can use for your application. It offers a number of useful features such as previews of their appearance across different installed themes, previews at different sizes, and more. You might find it a useful tool when deciding on which icons to use in your application.

Definition at line 57 of file icon.h.

◆ status

Icon::Status Icon::status
read

This property specifies the status of the icon.

Note
Image loading will not be initiated until the item is shown, so if the Icon is not visible, it can only have Null or Loading states.

default: Status::Null

Since
KDE Frameworks 5.15

Definition at line 156 of file icon.h.

◆ valid

bool Icon::valid
read

This property specifies whether the icon's source is valid and is being used.

Definition at line 103 of file icon.h.


The documentation for this class was generated from the following files:
QString fallback
This property holds the name of an icon from the icon theme as a fallback for when an icon set with t...
Definition: icon.h:66
QVariant source
This property holds the source of this icon.
Definition: icon.h:57
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Sep 25 2023 04:03:55 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.