KFileFilterCombo Class

File filter combo box. More...

Header: #include <KFileFilterCombo>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOFileWidgets)
Inherits: KComboBox

Public Functions

KFileFilterCombo(QWidget *parent = nullptr)
(since 6.0) KFileFilter currentFilter() const
(since 6.0) KFileFilter defaultFilter() const
(since 6.0) QList<KFileFilter> filters() const
(since 6.0) void setCurrentFilter(const KFileFilter &filter)
(since 6.0) void setDefaultFilter(const KFileFilter &filter)
(since 6.0) void setFilters(const QList<KFileFilter> &filters, const KFileFilter &defaultFilter = KFileFilter())
bool showsAllTypes() const

Signals

void filterChanged()

Detailed Description

Member Function Documentation

[explicit] KFileFilterCombo::KFileFilterCombo(QWidget *parent = nullptr)

Creates a new filter combo box.

parent The parent widget.

[since 6.0] KFileFilter KFileFilterCombo::currentFilter() const

The currently selected/active filter.

This function was introduced in 6.0.

See also setCurrentFilter().

[since 6.0] KFileFilter KFileFilterCombo::defaultFilter() const

Returns the default filter, used when an empty filter is set.

This function was introduced in 6.0.

See also setDefaultFilter() and setDefaultFileFilter.

[signal] void KFileFilterCombo::filterChanged()

This signal is emitted whenever the filter has been changed.

[since 6.0] QList<KFileFilter> KFileFilterCombo::filters() const

The current filters.

This is not necessarily the same as the list set by setFileFilters() since entries for "All files" and "All supported files" are added automatically as needed.

This function was introduced in 6.0.

See also setFilters().

[since 6.0] void KFileFilterCombo::setCurrentFilter(const KFileFilter &filter)

Sets the current filter. Filter must match one of the filter items passed before to this widget.

This function was introduced in 6.0.

See also currentFilter().

[since 6.0] void KFileFilterCombo::setDefaultFilter(const KFileFilter &filter)

This method allows to set a default-filter, that is used when an empty filter is set. Make sure you call this before calling setFileFilter().

By default, this is set to match all files.

This function was introduced in 6.0.

See also defaultFilter() and defaultFileFilter.

[since 6.0] void KFileFilterCombo::setFilters(const QList<KFileFilter> &filters, const KFileFilter &defaultFilter = KFileFilter())

Sets the filters to be used.

filters each item in the list corresponds to one item in the combobox. Entries for "All files" and "All supported files" are added automatically as needed.

defaultFilter if not empty this will be the by default active filter

This function was introduced in 6.0.

See also filters().

bool KFileFilterCombo::showsAllTypes() const

Returns true if the filter's first item is the list of all MIME types