Pages
Developer Documentation
On this page

Icons

Your application will probably want icons that follow the user's icon theme. In SonicDE the default icon theme is Silver (silver).

Use QIcon::fromTheme() in QtWidgets applications, or Kirigami's Icon in QtQuick applications. Both take the icon's name in the icon theme.

SonicDE and the other major Linux desktops follow the freedesktop.org Icon Theme Specification and Icon Naming Specification. Names fall back to more general ones: if there is no document-open-recent icon, the document-open icon is used, and if that doesn't exist either, the document icon.

Finding the right icons

SonicDE's Icon Explorer (iconexplorer, in sonic-theme-sdk) searches the icons of your icon theme. You can search for icons by name and by category, see an icon with different color schemes, and compare it with other icon themes.

Example

In a QtWidgets application:

QIcon undoicon = QIcon::fromTheme("edit-undo");

In a QtQuick application:

import org.kde.kirigami as Kirigami

Kirigami.Icon {
    source: "edit-undo"
}

Since Qt 6.7, QIcon::fromTheme() also takes a QIcon::ThemeIcon, for example QIcon::fromTheme(QIcon::ThemeIcon::EditUndo), and accepts a fallback icon used when the theme has none.

Platforms other than Linux

Other platforms have no icon theme.

Android

On Android, package the Breeze icons you use with Kirigami's kirigami_package_breeze_icons() CMake function:

if(ANDROID)
    kirigami_package_breeze_icons(ICONS
        edit-undo
        edit-redo
    )
endif()

Adapted for SonicDE from develop.kde.org/docs/features/additional-features/icons/ by Carl Schwan, Kunda Ki, Marius P, Mikhail Zolotukhin, Thiago Sueto, Tobias Fella, licensed under CC BY-SA 4.0.

Edit this page on GitHub

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.