KIconButton Class
A pushbutton for choosing an icon. More...
- Header:
#include <KIconButton> - CMake:
find_package(KF6 REQUIRED COMPONENTS IconWidgets)
target_link_libraries(mytarget PRIVATE KF6::IconWidgets) - Inherits: QPushButton
List of all members, including inherited members
Properties
Public Functions
- KIconButton(QWidget *parent = nullptr)
- int buttonIconSize() const
- const QString &icon() const
- int iconSize() const
- void resetIcon()
- void setButtonIconSize(int size)
- void setIcon(const QIcon &icon)
- void setIcon(const QString &icon)
- void setIconSize(int size)
- void setIconType(KIconLoader::Group group, KIconLoader::Context context, bool user = false)
- void setStrictIconSize(bool b)
- bool strictIconSize() const
Signals
Detailed Description
Pressing on the button will open a KIconDialog for the user to select an icon. The current icon will be displayed on the button.
See also KIconDialog
Property Documentation
icon : QString
Access functions:
- const
QString&icon() const voidsetIcon(constQString&icon)voidsetIcon(constQIcon&icon)voidresetIcon()
Notifier signal:
voidiconChanged(constQString&icon)
iconSize : int
Access functions:
inticonSize() constvoidsetIconSize(intsize)
strictIconSize : bool
Access functions:
boolstrictIconSize() constvoidsetStrictIconSize(boolb)
Member Function Documentation
[explicit] KIconButton::KIconButton(QWidget *parent = nullptr)
Constructs a KIconButton using the global icon loader.
parent The parent widget.
int KIconButton::buttonIconSize() const
Returns the button's icon size.
See also setButtonIconSize()
const QString &KIconButton::icon() const
Returns the name of the selected icon.
Note: Getter function for property icon.
See also setIcon()
[signal] void KIconButton::iconChanged(const QString &icon)
Emitted when the icon has changed.
Note: Notifier signal for property icon.
int KIconButton::iconSize() const
Returns the icon size set via setIconSize() or 0, if the default icon size will be used.
Note: Getter function for property iconSize.
See also setIconSize()
void KIconButton::resetIcon()
Resets the icon (reverts to an empty button).
Note: Resetter function for property icon.
void KIconButton::setButtonIconSize(int size)
Sets the size of the icon to be shown on the button.
See also KIconLoader::StdSizes, buttonIconSize
void KIconButton::setIcon(const QIcon &icon)
Sets the button's initial icon.
Note: Setter function for property icon.
See also icon()
void KIconButton::setIcon(const QString &icon)
Sets the button's initial icon.
Note: Setter function for property icon.
void KIconButton::setIconSize(int size)
Sets the size of the icon to be shown / selected.
Note: Setter function for property iconSize.
See also KIconLoader::StdSizes, iconSize
void KIconButton::setIconType(KIconLoader::Group group, KIconLoader::Context context, bool user = false)
Sets the icon group and context. Use KIconLoader::NoGroup if you want to allow icons for any group in the given context.
void KIconButton::setStrictIconSize(bool b)
Sets a strict icon size policy for allowed icons. When true, only icons of the specified group's size in setIconType() are allowed, and only icons of that size will be shown in the icon dialog.
Note: Setter function for property strictIconSize.
See also strictIconSize()
bool KIconButton::strictIconSize() const
Returns true if a strict icon size policy is set.
Note: Getter function for property strictIconSize.
See also setStrictIconSize()