KGuiAddons 5.109.0
Functions
KIconUtils Namespace Reference

Provides utility functions for icons. More...

Functions

QIcon addOverlay (const QIcon &icon, const QIcon &overlay, Qt::Corner position)
 Adds the overlay over the icon in the specified position.
 
QIcon addOverlays (const QIcon &icon, const QHash< Qt::Corner, QIcon > &overlays)
 Adds overlays over the icon.
 
QIcon addOverlays (const QIcon &icon, const QStringList &overlays)
 Adds up to four overlays over the icon.
 
QIcon addOverlays (const QString &iconName, const QStringList &overlays)
 Adds up to four overlays on the icon constructed from iconName.
 

Detailed Description

Provides utility functions for icons.

Function Documentation

◆ addOverlay()

QIcon KIconUtils::addOverlay ( const QIcon &  icon,
const QIcon &  overlay,
Qt::Corner  position 
)

Adds the overlay over the icon in the specified position.

The overlay icon is scaled down approx. to 1/3 or 1/4 (depending on the icon size) and placed in one of the corners of the base icon.

◆ addOverlays() [1/3]

QIcon KIconUtils::addOverlays ( const QIcon &  icon,
const QHash< Qt::Corner, QIcon > &  overlays 
)

Adds overlays over the icon.

The overlays is a QHash of Qt::Corner and QIcon. The Qt::Corner value decides where the overlay icon will be painted, the QIcon value is the overlay icon to be painted.

The overlay icon is scaled down to 1/3 or 1/4 (depending on the icon size) and placed in one of the corners of the base icon.

◆ addOverlays() [2/3]

QIcon KIconUtils::addOverlays ( const QIcon &  icon,
const QStringList &  overlays 
)

Adds up to four overlays over the icon.

The overlays is a QStringList of icon names (e.g. the emblems that are drawn on icons in Dolphin and KFileWidget, e.g. symlink, un-mounted device ...etc).

Overlays are added in this order:

  • first icon is used to paint an overlay on the bottom-right corner
  • second icon on the bottom-left corner
  • third icon on the top-left corner
  • fourth icon on the top-right corner

Each overlay icon is scaled down to 1/3 or 1/4 (depending on the icon size).

Since
5.90

◆ addOverlays() [3/3]

QIcon KIconUtils::addOverlays ( const QString &  iconName,
const QStringList &  overlays 
)

Adds up to four overlays on the icon constructed from iconName.

The overlays is a QStringList of icon names (e.g. the emblems that are drawn on icons in Dolphin and KFileWidget, e.g. symlink, un-mounted device ...etc).

Overlays are added in this order:

  • first icon is used to paint an overlay on the bottom-right corner
  • second icon on the bottom-left corner
  • third icon on the top-left corner
  • fourth icon on the top-right corner

Each overlay icon is scaled down to 1/3 or 1/4 (depending on the icon size).

All QIcon objects are constructed using QIcon::fromTheme().

Since
5.82