Icon

#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)
 
void setFocus (bool focus, Qt::FocusReason reason)
 
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 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
 
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 (QObject *object)
 
qobject_cast (const 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 geometryChanged (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 setStatus (Status status)
 
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 *)
 
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 itemChange (QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
 
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 *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
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, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &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 25 of file icon.h.

Member Enumeration Documentation

Enumerator
Ready 

No icon has been set.

Loading 

The icon loaded correctly.

Error 

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

Definition at line 149 of file icon.h.

Property Documentation

bool Icon::active
readwrite

Whether this icon will use the QIcon::Active mode when drawing the icon, resulting in a graphical effect being applied to the icon to indicate that it is currently active.

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

active.png

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.

Definition at line 87 of file icon.h.

QColor Icon::color
readwrite

The color to use when drawing this icon when isMask is enabled.

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.

Definition at line 123 of file icon.h.

QString Icon::fallback
readwrite

The name of a fallback icon to load from the icon theme when the source cannot be found.

The default fallback icon is "unknown".

Kirgami.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 59 of file icon.h.

bool Icon::isMask
readwrite

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.

See also
color

Definition at line 115 of file icon.h.

qreal Icon::paintedHeight
read

The height of the painted area measured 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.

Since
5.15

Definition at line 147 of file icon.h.

qreal Icon::paintedWidth
read

The width of the painted area measured 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.

Since
5.15

Definition at line 139 of file icon.h.

QString Icon::placeholder
readwrite

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

This is primarily relevant for remote sources, or those using slow- loading image providers. The default temporary icon is "image-x-icon"

Note
This will only be loaded if the source is a type which can be so long-loading that a temporary image makes sense (e.g. a remote image, or from an ImageProvider of the type QQmlImageProviderBase::ImageResponse)
Since
5.15

Definition at line 72 of file icon.h.

bool Icon::selected
readwrite

Whether this icon will use the QIcon::Selected mode when drawing the icon, resulting in a graphical effect being applied to the icon to indicate that it is currently selected.

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

selected.png

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

Definition at line 106 of file icon.h.

QVariant Icon::source
readwrite

The source of this icon.

An Icon can pull from:

  • The icon theme:
    Kirgami.Icon {
    source: "view-refresh"
    }
  • The filesystem:
    Kirgami.Icon {
    source: "/home/example/cool.svg"
    }
  • Remote URIs:
    Kirgami.Icon {
    source: "https://example.com/kirigami.png"
    }
  • Custom providers:
    Kirgami.Icon {
    source: "image://provider/kirigami.svg"
    }
  • Your application's bundled resources:
    Kirgami.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.

Definition at line 49 of file icon.h.

Icon::Status Icon::status
read

Whether the icon is correctly loaded, is asyncronously loading or there was an error.

Note that 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.

Since
5.15

Definition at line 131 of file icon.h.

bool Icon::valid
read

Whether this icon's source is valid and it is being used.

Definition at line 92 of file icon.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:38:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.