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
 
string currentIconTheme
 
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
 
 containmentMask
 
 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 Slots

void refresh ()
 

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)
 
QBindable< qreal > bindableHeight ()
 
QBindable< qreal > bindableWidth ()
 
QBindable< qreal > bindableX ()
 
QBindable< qreal > bindableY ()
 
virtual QRectF boundingRect () const const
 
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)
 
virtual QRectF clipRect () const const
 
QObjectcontainmentMask () const const
 
void containmentMaskChanged ()
 
virtual bool contains (const QPointF &point) const const
 
QCursor cursor () const const
 
void dumpItemTree () const const
 
void enabledChanged ()
 
void ensurePolished ()
 
bool filtersChildMouseEvents () const const
 
Flags flags () const const
 
void focusChanged (bool)
 
void forceActiveFocus ()
 
void forceActiveFocus (Qt::FocusReason reason)
 
void grabMouse ()
 
QSharedPointer< QQuickItemGrabResultgrabToImage (const QSize &targetSize)
 
void grabTouchPoints (const QList< 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 (Flag flag, bool enabled)
 
void setFlags (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 (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
 
TransformOrigin transformOrigin () const const
 
void transformOriginChanged (TransformOrigin)
 
void ungrabMouse ()
 
void ungrabTouchPoints ()
 
void unsetCursor ()
 
void update ()
 
QQuickItemviewportItem () const const
 
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)
 
QBindable< QStringbindableObjectName ()
 
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 () const const
 
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 QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
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_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 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
 
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 setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, 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 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 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 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)
 
- Public Attributes inherited from QQuickItem
 Bottom
 
 BottomLeft
 
 BottomRight
 
 Center
 
typedef Flags
 
 ItemAcceptsDrops
 
 ItemAcceptsInputMethod
 
 ItemActiveFocusHasChanged
 
 ItemAntialiasingHasChanged
 
 ItemChildAddedChange
 
 ItemChildRemovedChange
 
 ItemClipsChildrenToShape
 
 ItemDevicePixelRatioHasChanged
 
 ItemEnabledHasChanged
 
 ItemHasContents
 
 ItemIsFocusScope
 
 ItemIsViewport
 
 ItemObservesViewport
 
 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.

An item for displaying an icon from an asset or from the icon theme, or from an image source.

Warning
This element is just an alias around the Icon object. Checkout the Icon properties for more details.
See also
Icon.

Definition at line 25 of file icon.h.

Member Enumeration Documentation

◆ Status

Enumerator
Ready 

No icon has been set.

Loading 

The icon loaded correctly.

Definition at line 156 of file icon.h.

Property Documentation

◆ active

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.

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

◆ color

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

◆ currentIconTheme

string Icon::currentIconTheme
read

The current icon theme being used as part of the Maui Shell.

This is exposed to check changes on the used icon theme for hot reloading the icons.

Remarks
This property is read-only

Definition at line 19 of file Icon.qml.

◆ fallback

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".

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

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

◆ paintedHeight

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

◆ paintedWidth

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

◆ placeholder

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

◆ selected

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.

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

Definition at line 113 of file icon.h.

◆ source

QVariant Icon::source
readwrite

The source of this icon.

An Icon can pull from:

  • The icon theme:
  • The filesystem:
  • Remote URIs:
  • Custom providers:
  • Your application's bundled resources:
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 56 of file icon.h.

◆ status

Icon::Status Icon::status
read

Whether the icon is correctly loaded, is asynchronously 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 138 of file icon.h.

◆ valid

bool Icon::valid
read

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

Definition at line 99 of file icon.h.

Constructor & Destructor Documentation

◆ Icon()

Icon::Icon ( QQuickItem * parent = nullptr)

Definition at line 26 of file icon.cpp.

◆ ~Icon()

Icon::~Icon ( )
override

Definition at line 43 of file icon.cpp.

Member Function Documentation

◆ active()

bool Icon::active ( ) const

Definition at line 97 of file icon.cpp.

◆ color()

QColor Icon::color ( ) const

Definition at line 156 of file icon.cpp.

◆ fallback()

QString Icon::fallback ( ) const

Definition at line 552 of file icon.cpp.

◆ findIcon()

QImage Icon::findIcon ( const QSize & size)
protected

Definition at line 337 of file icon.cpp.

◆ geometryChange()

void Icon::geometryChange ( const QRectF & newGeometry,
const QRectF & oldGeometry )
overrideprotectedvirtual

Reimplemented from QQuickItem.

Definition at line 208 of file icon.cpp.

◆ guessMonochrome()

bool Icon::guessMonochrome ( const QImage & img)
protected

Definition at line 492 of file icon.cpp.

◆ handleFinished()

void Icon::handleFinished ( QNetworkReply * reply)
protected

Definition at line 241 of file icon.cpp.

◆ handleRedirect()

void Icon::handleRedirect ( QNetworkReply * reply)
protected

Definition at line 217 of file icon.cpp.

◆ iconMode()

QIcon::Mode Icon::iconMode ( ) const
protected

Definition at line 480 of file icon.cpp.

◆ isMask()

bool Icon::isMask ( ) const

Definition at line 140 of file icon.cpp.

◆ itemChange()

void Icon::itemChange ( QQuickItem::ItemChange change,
const QQuickItem::ItemChangeData & value )
overrideprotectedvirtual

Reimplemented from QQuickItem.

Definition at line 629 of file icon.cpp.

◆ paintedHeight()

qreal Icon::paintedHeight ( ) const

Definition at line 598 of file icon.cpp.

◆ paintedWidth()

qreal Icon::paintedWidth ( ) const

Definition at line 593 of file icon.cpp.

◆ placeholder()

QString Icon::placeholder ( ) const

Definition at line 565 of file icon.cpp.

◆ refresh

void Icon::refresh ( )
slot

Definition at line 198 of file icon.cpp.

◆ selected()

bool Icon::selected ( ) const

Definition at line 123 of file icon.cpp.

◆ setActive()

void Icon::setActive ( bool active = true)

Definition at line 87 of file icon.cpp.

◆ setColor()

void Icon::setColor ( const QColor & color)

Definition at line 145 of file icon.cpp.

◆ setFallback()

void Icon::setFallback ( const QString & fallback)

Definition at line 557 of file icon.cpp.

◆ setIsMask()

void Icon::setIsMask ( bool mask)

Definition at line 128 of file icon.cpp.

◆ setPlaceholder()

void Icon::setPlaceholder ( const QString & placeholder)

Definition at line 570 of file icon.cpp.

◆ setSelected()

void Icon::setSelected ( bool selected = true)

Definition at line 113 of file icon.cpp.

◆ setSource()

void Icon::setSource ( const QVariant & source)

Definition at line 47 of file icon.cpp.

◆ setStatus()

void Icon::setStatus ( Status status)
protected

Definition at line 578 of file icon.cpp.

◆ source()

QVariant Icon::source ( ) const

Definition at line 82 of file icon.cpp.

◆ status()

Icon::Status Icon::status ( ) const

Definition at line 588 of file icon.cpp.

◆ updatePaintedGeometry()

void Icon::updatePaintedGeometry ( )
protected

Definition at line 603 of file icon.cpp.

◆ updatePaintNode()

QSGNode * Icon::updatePaintNode ( QSGNode * node,
UpdatePaintNodeData * data )
overridevirtual

Reimplemented from QQuickItem.

Definition at line 161 of file icon.cpp.

◆ updatePolish()

void Icon::updatePolish ( )
overrideprotectedvirtual

Reimplemented from QQuickItem.

Definition at line 267 of file icon.cpp.

◆ valid()

bool Icon::valid ( ) const

Definition at line 102 of file icon.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:16:19 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.