KFileCustomDialog Class

This class implement a custom file dialog. More...

Header: #include <KFileCustomDialog>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOFileWidgets)
Since: 5.42
Inherits: QDialog

Public Functions

KFileCustomDialog(QWidget *parent = nullptr)
(since 5.67) KFileCustomDialog(const QUrl &startDir, QWidget *parent = nullptr)
KFileWidget *fileWidget() const
void setCustomWidget(QWidget *widget)
void setOperationMode(KFileWidget::OperationMode op)
void setUrl(const QUrl &url)

Detailed Description

It uses a KFileWidget and allows the application to provide a custom widget.

Member Function Documentation

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

Constructs a custom file dialog

[explicit, since 5.67] KFileCustomDialog::KFileCustomDialog(const QUrl &startDir, QWidget *parent = nullptr)

Constructs a custom file dialog

startDir see the KFileWidget constructor for documentation

This function was introduced in 5.67.

KFileWidget *KFileCustomDialog::fileWidget() const

Returns the filewidget used inside this dialog

void KFileCustomDialog::setCustomWidget(QWidget *widget)

Set a custom widget that should be added to the file dialog.

widget A widget, or a widget of widgets, for displaying custom data in the file widget. This can be used, for example, to display a check box with the title "Open as read-only". When creating this widget, you don't need to specify a parent, since the widget's parent will be set automatically by KFileWidget.

void KFileCustomDialog::setOperationMode(KFileWidget::OperationMode op)

Sets the operational mode of the filedialog to Saving, Opening or Other. This will set some flags that are specific to loading or saving files. E.g. setKeepLocation() makes mostly sense for a save-as dialog. So setOperationMode( KFileWidget::Saving ); sets setKeepLocation for example.

The mode Saving, together with a default filter set via setMimeFilter() will make the filter combobox read-only.

The default mode is Opening.

Call this method right after instantiating KFileWidget.

See also operationMode and KFileWidget::OperationMode.

void KFileCustomDialog::setUrl(const QUrl &url)

Sets the directory to view.

url URL to show.