Search for usage in LXR

KPropertyEditorItemEvent Class Reference

#include <KPropertyEditorItemEvent.h>

Public Member Functions

 KPropertyEditorItemEvent (const KProperty &property, const QString &name, const QVariantMap &parameters)
bool hasResult () const
QString name () const
QVariantMap parameters () const
const KPropertyproperty () const
QVariant result () const
void setResult (const QVariant &result)

Detailed Description

The KPropertyEditorItemEvent class describes request for handling a single property editor widget item's event.

Handling editor events is useful to customize behavior of the property editors.

For example Url property editor can offer overriding the default file dialog.

Currently supported events are:

  • "getOpenFileUrl" for editors of KProperty::Url. Overrides the default file dialog for files or directories. For this event own file dialog can be displayed. In this case event's result should be set to result of the file dialog. Note that even if the dialog has been canceled result should be set (to empty QUrl), otherwise the property editor will not "realize" that the dialog has been overriden and will display the built-in dialog. It is recommended to take values of the "fileMode" and "confirmOverwrites" property options into account and display file dialog in appropriate mode. See KProperty::setOption() for documentation of property options. This event provides the following parameters: "url" equal to QUrl value of the editor for use in the dialog as default value; "caption" equal to the default window's caption for the dialog, depending on variant of the dialog, e.g. "Select Existing File" if "fileMode" option is "existingfile".
See also

Definition at line 58 of file KPropertyEditorItemEvent.h.

Constructor & Destructor Documentation

◆ KPropertyEditorItemEvent()

KPropertyEditorItemEvent::KPropertyEditorItemEvent ( const KProperty & property,
const QString & name,
const QVariantMap & parameters )

Creates a new request object.

propertyProperty related to the request
nameName of the event
parametersParameters of the event

Definition at line 35 of file KPropertyEditorItemEvent.cpp.

◆ ~KPropertyEditorItemEvent()

KPropertyEditorItemEvent::~KPropertyEditorItemEvent ( )

Definition at line 44 of file KPropertyEditorItemEvent.cpp.

Member Function Documentation

◆ hasResult()

bool KPropertyEditorItemEvent::hasResult ( ) const

Returns true if event's result has been set with setResult()

See also

Definition at line 74 of file KPropertyEditorItemEvent.cpp.

◆ name()

QString KPropertyEditorItemEvent::name ( ) const

Returns name of event that requests the override.

Definition at line 53 of file KPropertyEditorItemEvent.cpp.

◆ parameters()

QVariantMap KPropertyEditorItemEvent::parameters ( ) const

Returns zero or more parameters associated with this specific event.

See description of the KPropertyEditorItemEvent class for parameters supported by given events.

Definition at line 58 of file KPropertyEditorItemEvent.cpp.

◆ property()

const KProperty * KPropertyEditorItemEvent::property ( ) const

Returns property assiciated with editor which requests the override.

Definition at line 48 of file KPropertyEditorItemEvent.cpp.

◆ result()

QVariant KPropertyEditorItemEvent::result ( ) const

Returns result set by the user of the editor.

It is null until user sets result with setResult().

See also

Definition at line 69 of file KPropertyEditorItemEvent.cpp.

◆ setResult()

void KPropertyEditorItemEvent::setResult ( const QVariant & result)

Sets result of the event.

In order to override behavior of the editor users have to call this method even if the result is null. Editor will note that and accept the override. For example, URL editor will not attempt to display its built-in file dialog assuming that custom dialog has been used.

Once setResult() is called for given event object, there is no way to unset the result. it is only possible to replace the result with other.

Definition at line 63 of file KPropertyEditorItemEvent.cpp.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 19 2024 12:00:42 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.