KIconThemes
kicondialog.cpp
88bool KIconDialogSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
92 const QString display = sourceModel()->index(source_row, 0, source_parent).data(Qt::DisplayRole).toString();
94 if ((m_symbolicIcons == OnlySymbolicIcons && !isSymbolic) || (m_symbolicIcons == NoSymbolicIcons && isSymbolic)) {
215 item.pixmap = m_loader->loadScaledIcon(item.path, KIconLoader::Desktop, dpr, iconSize(), KIconLoader::DefaultState, {}, nullptr, true);
232 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
239KIconCanvasDelegate::KIconCanvasDelegate(QListView *parent, QAbstractItemDelegate *defaultDelegate)
245void KIconCanvasDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
260QSize KIconCanvasDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
292 QObject::connect(model, &KIconDialogModel::hasSymbolicIconChanged, filterSymbolicAction, &QAction::setVisible);
293 QObject::connect(model, &KIconDialogModel::hasSymbolicIconChanged, proxyModel, &KIconDialogSortFilterProxyModel::setHasSymbolicIcon);
324 QAction *findAction = KStandardActions::find(ui.searchLine, qOverload<>(&QWidget::setFocus), q);
329 QAction *filterSymbolicAll = filterSymbolicMenu->addAction(i18nc("@item:inmenu All icons", "All"));
334 QAction *filterSymbolicOnly = filterSymbolicMenu->addAction(i18nc("@item:inmenu Show only symbolic icons", "Only Symbolic"));
338 QAction *filterSymbolicNone = filterSymbolicMenu->addAction(i18nc("@item:inmenu Hide symbolic icons", "No Symbolic"));
351 proxyModel->setSymbolicIcons(static_cast<KIconDialogSortFilterProxyModel::SymbolicIcons>(action->data().toInt()));
356 QObject::connect(ui.searchLine, &QLineEdit::textChanged, proxyModel, &QSortFilterProxyModel::setFilterFixedString);
439 browseButton = new QPushButton(QIcon::fromTheme(QStringLiteral("folder-open")), i18n("Browse…"));
476 const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, relDir, QStandardPaths::LocateDirectory);
504 const int frameHMargin = ui.canvas->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, ui.canvas) + 1;
506 ui.canvas->setGridSize(QSize(100, ui.canvas->iconSize().height() + lineCount * metrics.height() + 3 * frameHMargin));
516 if (ui.canvas->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, ui.canvas)) {
517 width += ui.canvas->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &opt, ui.canvas);
586void KIconDialog::setup(KIconLoader::Group group, KIconLoader::Context context, bool strictIconSize, int iconSize, bool user, bool lockUser, bool lockCustomDir)
730 QFileDialog *dlg = new QFileDialog(q, i18n("Select Icon"), QString(), i18n("*.ico *.png *.xpm *.svg *.svgz|Icon Files (*.ico *.png *.xpm *.svg *.svgz)"));
bool strictIconSize() const
Returns true if a strict icon size policy is set.
Definition kicondialog.cpp:559
KIconDialog(QWidget *parent=nullptr)
Constructs an icon selection dialog using the global icon loader.
Definition kicondialog.cpp:301
void setStrictIconSize(bool policy)
Sets a strict icon size policy for allowed icons.
Definition kicondialog.cpp:554
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...
Definition kicondialog.cpp:586
int iconSize() const
Returns the icon size set via setIconSize() or 0, if the default icon size will be used.
Definition kicondialog.cpp:574
void setSelectedIcon(const QString &iconName)
Sets the icon that is initially selected in the dialog.
Definition kicondialog.cpp:580
void showDialog()
show()s this dialog and emits a newIconName(const QString&) signal when successful.
Definition kicondialog.cpp:673
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.
Definition kicondialog.cpp:703
QString openDialog()
exec()utes this modal dialog and returns the name of the selected icon, or QString() if the dialog wa...
Definition kicondialog.cpp:654
void setIconSize(int size)
Sets the size of the icons to be shown / selected.
Definition kicondialog.cpp:564
void setCustomLocation(const QString &location)
Sets the location of the custom icon directory.
Definition kicondialog.cpp:649
static KIconLoader * global()
Returns the global icon loader initialized with the application name.
Definition kiconloader.cpp:1475
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
char * toString(const EngineQuery &query)
QString path(const QString &relativePath)
KIOCORE_EXPORT QString dir(const QString &fileClass)
QString name(StandardAction id)
void clicked(bool checked)
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const const=0
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const const=0
void modelReset()
void rowsInserted(const QModelIndex &parent, int first, int last)
void rowsRemoved(const QModelIndex &parent, int first, int last)
void activated(const QModelIndex &index)
sourceModel
void setCheckable(bool)
void setChecked(bool)
QVariant data() const const
void setData(const QVariant &data)
void setVisible(bool)
void activated(int index)
Accepted
virtual void accept()
virtual int exec()
void setModal(bool modal)
virtual void reject()
virtual void showEvent(QShowEvent *event) override
HelpRole
void accepted()
void rejected()
QStringList entryList(Filters filters, SortFlags sort) const const
ExistingFile
void setFileMode(FileMode mode)
void fileSelected(const QString &file)
QString absolutePath() const const
QString completeBaseName() const const
int pointSize() const const
void setPointSize(int pointSize)
QIcon fromTheme(const QString &name)
TrailingPosition
void textChanged(const QString &text)
iterator begin()
qsizetype count() const const
iterator end()
gridSize
QVariant data(int role) const const
bool isValid() const const
int row() const const
Q_EMITQ_EMIT
Q_OBJECTQ_OBJECT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
T qobject_cast(QObject *object)
void setHeight(int height)
void setWidth(int width)
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const const
void invalidateFilter()
void setFilterFixedString(const QString &pattern)
LocateDirectory
GenericDataLocation
QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options)
QString & append(QChar ch)
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
QChar * data()
bool endsWith(QChar c, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
qsizetype lastIndexOf(QChar ch, Qt::CaseSensitivity cs) const const
QString mid(qsizetype position, qsizetype n) const const
PM_FocusFrameHMargin
SH_ScrollView_FrameOnlyAroundContents
void initFrom(const QWidget *widget)
WrapText
AlignHCenter
CaseInsensitive
DisplayRole
ItemIsEnabled
NoTextInteraction
WindowModal
int toInt(bool *ok) const const
QString toString() const const
virtual bool event(QEvent *event) override
void setFocus()
void show()
size
void setWindowModality(Qt::WindowModality windowModality)
void setWindowTitle(const QString &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.