KIconThemes 5.109.0
kicondialog.h
1/* vi: ts=8 sts=4 sw=4
2
3 This file is part of the KDE project, module kfile.
4 SPDX-FileCopyrightText: 2000 Geert Jansen <jansen@kde.org>
5 SPDX-FileCopyrightText: 2000 Kurt Granroth <granroth@kde.org>
6 SPDX-FileCopyrightText: 1997 Christoph Neerfeld <chris@kde.org>
7 SPDX-FileCopyrightText: 2002 Carsten Pfeiffer <pfeiffer@kde.org>
8 SPDX-FileCopyrightText: 2021 Kai Uwe Broulik <kde@broulik.de>
9
10 SPDX-License-Identifier: LGPL-2.0-only
11*/
12
13#ifndef KICONDIALOG_H
14#define KICONDIALOG_H
15
16#include "kiconthemes_export.h"
17
18#include <QDialog>
19#include <QPushButton>
20#include <memory>
21
22#include <kiconloader.h>
23
32class KICONTHEMES_EXPORT KIconDialog : public QDialog
33{
34 Q_OBJECT
35
36public:
42 explicit KIconDialog(QWidget *parent = nullptr);
43
44#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 104)
53 KICONTHEMES_DEPRECATED_VERSION(5, 104, "Use KIconDialog(QWidget *) instead")
54 explicit KIconDialog(KIconLoader *loader, QWidget *parent = nullptr);
55#endif
56
60 ~KIconDialog() override;
61
70 void setStrictIconSize(bool policy);
74 bool strictIconSize() const;
75
80 void setCustomLocation(const QString &location);
81
87 void setIconSize(int size);
92 int iconSize() const;
93
103 void setSelectedIcon(const QString &iconName);
104
113 bool strictIconSize = false,
114 int iconSize = 0,
115 bool user = false,
116 bool lockUser = false,
117 bool lockCustomDir = false);
118
125 QString openDialog();
126
132
153 bool strictIconSize = false,
154 int iconSize = 0,
155 bool user = false,
156 QWidget *parent = nullptr,
157 const QString &title = QString());
158
159Q_SIGNALS:
160 void newIconName(const QString &iconName);
161
162protected Q_SLOTS:
163 void slotOk();
164
165private:
166 std::unique_ptr<class KIconDialogPrivate> const d;
167
168 friend class ShowEventFilter;
169 friend class KIconDialogPrivate;
170
171 Q_DISABLE_COPY(KIconDialog)
172
173};
174
175#endif // KICONDIALOG_H
Dialog for interactive selection of icons.
Definition kicondialog.h:33
bool strictIconSize() const
Returns true if a strict icon size policy is set.
KIconDialog(QWidget *parent=nullptr)
Constructs an icon selection dialog using the global icon loader.
void setStrictIconSize(bool policy)
Sets a strict icon size policy for allowed icons.
void setup(KIconLoader::Group group, KIconLoader::Context context=KIconLoader::Application, bool strictIconSize=false, int iconSize=0, bool user=false, bool lockUser=false, bool lockCustomDir=false)
Allows you to set the same parameters as in the class method getIcon(), as well as two additional par...
~KIconDialog() override
Destructs the dialog.
int iconSize() const
Returns the icon size set via setIconSize() or 0, if the default icon size will be used.
void setSelectedIcon(const QString &iconName)
Sets the icon that is initially selected in the dialog.
void showDialog()
show()s this dialog and emits a newIconName(const QString&) signal when successful.
QString openDialog()
exec()utes this modal dialog and returns the name of the selected icon, or QString() if the dialog wa...
void setIconSize(int size)
Sets the size of the icons to be shown / selected.
static QString getIcon(KIconLoader::Group group=KIconLoader::Desktop, KIconLoader::Context context=KIconLoader::Application, bool strictIconSize=false, int iconSize=0, bool user=false, QWidget *parent=nullptr, const QString &title=QString())
Pops up the dialog an lets the user select an icon.
void setCustomLocation(const QString &location)
Sets the location of the custom icon directory.
Iconloader for KDE.
Definition kiconloader.h:74
Group
The group of the icon.
Definition kiconloader.h:125
@ Desktop
Desktop icons.
Definition kiconloader.h:129
Context
Defines the context of the icon.
Definition kiconloader.h:81
@ Application
An icon that represents an application.
Definition kiconloader.h:84