KPropertiesDialogPlugin Class

A Plugin in the Properties dialog. More...

Header: #include <KPropertiesDialogPlugin>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOWidgets)
Inherits: QObject

Public Functions

KPropertiesDialogPlugin(QObject *parent)
virtual void applyChanges()
bool isDirty() const
void setDirty(bool b = true)

Signals

void changed()

Protected Functions

int fontHeight() const

Protected Variables

KPropertiesDialog *const properties

Detailed Description

This is an abstract class. You must inherit from this class to build a new kind of tabbed page for the KPropertiesDialog. A plugin in itself is just a library containing code, not a dialog's page. It's up to the plugin to insert pages into the parent dialog.

To make a plugin available, ensure it has embedded json metadata using K_PLUGIN_CLASS_WITH_JSON and install the plugin in the KDE_INSTALL_PLUGINDIR/kf6/propertiesdialog folder from the KDEInstallDirs CMake module.

The metadata can contain the MIME types for which the plugin should be created. For instance:

{
    "KPlugin": {
        "MimeTypes": ["text/html", "application/x-mymimetype"]
    },
    "X-KDE-Protocols": ["file"]
}

If the MIME types are empty or not specified, the plugin will be created for all MIME types.

You can also include "X-KDE-Protocols" if you want that plugin for instance to be loaded only for local files.

Member Function Documentation

KPropertiesDialogPlugin::KPropertiesDialogPlugin(QObject *parent)

Constructor whos parent will be cast to KPropertiesDialog To insert tabs into the properties dialog, use the add methods provided by KPageDialog (the properties dialog is a KPageDialog).

[virtual] void KPropertiesDialogPlugin::applyChanges()

Applies all changes to the file. This function is called when the user presses 'Ok'. The last plugin inserted is called first.

[signal] void KPropertiesDialogPlugin::changed()

Emit this signal when the user changed anything in the plugin's tabs. The hosting PropertiesDialog will call applyChanges only if the PropsPlugin has emitted this signal or if you have called setDirty() before.

[protected] int KPropertiesDialogPlugin::fontHeight() const

Returns the font height.

bool KPropertiesDialogPlugin::isDirty() const

void KPropertiesDialogPlugin::setDirty(bool b = true)

See also isDirty().

Member Variable Documentation

KPropertiesDialog *const KPropertiesDialogPlugin::properties

Pointer to the dialog