KPreviewWidgetBase Class
Abstract baseclass for all preview widgets. More...
Header: | #include <KPreviewWidgetBase> |
CMake: | find_package(KF6 REQUIRED COMPONENTS KIO) target_link_libraries(mytarget PRIVATE KF6::KIOFileWidgets) |
Inherits: | QWidget |
Inherited By: |
Public Functions
KPreviewWidgetBase(QWidget *parent) | |
QStringList | supportedMimeTypes() const |
Public Slots
virtual void | clearPreview() = 0 |
virtual void | showPreview(const QUrl &url) = 0 |
Protected Functions
void | setSupportedMimeTypes(const QStringList &mimeTypes) |
Detailed Description
Abstract baseclass for all preview widgets which shall be used via KFileDialog::setPreviewWidget(const KPreviewWidgetBase *). Ownership will be transferred to KFileDialog, so you have to create the preview with "new" and let KFileDialog delete it.
Just derive your custom preview widget from KPreviewWidgetBase and implement all the pure virtual methods. The slot showPreview(const QUrl &) is called every time the file selection changes.
Member Function Documentation
[explicit]
KPreviewWidgetBase::KPreviewWidgetBase(QWidget *parent)
Constructor. Construct the user interface of your preview widget here and pass the KFileDialog this preview widget is going to be used in as the parent.
parent The KFileDialog this preview widget is going to be used in
[pure virtual slot]
void KPreviewWidgetBase::clearPreview()
Reimplement this to clear the preview. This is called when e.g. the selection is cleared or when multiple selections exist, or the directory is changed.
[protected]
void KPreviewWidgetBase::setSupportedMimeTypes(const QStringList &mimeTypes)
See also supportedMimeTypes().
[pure virtual slot]
void KPreviewWidgetBase::showPreview(const QUrl &url)
This slot is called every time the user selects another file in the file dialog. Implement the stuff necessary to reflect the change here.
url The URL of the currently selected file.
QStringList KPreviewWidgetBase::supportedMimeTypes() const
See also setSupportedMimeTypes().