KPropertySet

#include <KPropertySet.h>

Inheritance diagram for KPropertySet:

Signals

void aboutToBeCleared ()
 
void aboutToBeDeleted ()
 
void aboutToDeleteProperty (KPropertySet &set, KProperty &property)
 
void propertyChanged (KPropertySet &set, KProperty &property)
 
void propertyChangedInternal (KPropertySet &set, KProperty &property)
 
void propertyReset (KPropertySet &set, KProperty &property)
 
void readOnlyFlagChanged ()
 

Public Slots

void addProperty (KProperty *property, const QByteArray &group="common")
 
void changeProperty (const QByteArray &property, const QVariant &value)
 
void changePropertyIfExists (const QByteArray &property, const QVariant &value)
 
void clear ()
 
void removeProperty (KProperty *property)
 
void removeProperty (const QByteArray &name)
 
void setGroupCaption (const QByteArray &group, const QString &caption)
 
void setGroupIconName (const QByteArray &group, const QString &iconName)
 
void setPreviousSelection (const QByteArray &prevSelection)
 
void setReadOnly (bool readOnly)
 

Public Member Functions

 KPropertySet (QObject *parent=nullptr)
 
 KPropertySet (const KPropertySet &set)
 
void clearModifiedFlags ()
 
bool contains (const QByteArray &name) const
 
int count () const
 
int count (const KPropertySelector &selector) const
 
void debug () const
 
QString groupCaption (const QByteArray &group) const
 
QString groupIconName (const QByteArray &group) const
 
QByteArray groupNameForProperty (const QByteArray &propertyName) const
 
QByteArray groupNameForProperty (const KProperty &property) const
 
QList< QByteArraygroupNames () const
 
bool hasProperties (const KPropertySelector &selector) const
 
bool hasVisibleProperties () const
 
bool isEmpty () const
 
bool isModified () const
 
bool isReadOnly () const
 
KPropertySetoperator= (const KPropertySet &set)
 
KPropertyoperator[] (const QByteArray &name) const
 
QByteArray previousSelection () const
 
KPropertyproperty (const QByteArray &name) const
 
QList< QByteArraypropertyNamesForGroup (const QByteArray &group) const
 
QVariant propertyValue (const QByteArray &name, const QVariant &defaultValue=QVariant()) const
 
QMap< QByteArray, QVariantpropertyValues () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

 KPropertySet (bool propertyOwner)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

Set of properties.

Definition at line 119 of file KPropertySet.h.

Constructor & Destructor Documentation

KPropertySet::KPropertySet ( QObject parent = nullptr)
explicit

Constructs a new property set object.

Definition at line 417 of file KPropertySet.cpp.

KPropertySet::KPropertySet ( const KPropertySet set)
explicit

Constructs a deep copy of set. The new object will not have a QObject parent even if set has such parent.

Definition at line 424 of file KPropertySet.cpp.

KPropertySet::KPropertySet ( bool  propertyOwner)
explicitprotected

Constructs a set which owns or does not own it's properties.

Definition at line 432 of file KPropertySet.cpp.

Member Function Documentation

void KPropertySet::aboutToBeCleared ( )
signal

Emitted when property set object is about to be cleared (using clear()). This signal is also emitted from destructor before emitting aboutToBeDeleted().

void KPropertySet::aboutToBeDeleted ( )
signal

Emitted when property set object is about to be deleted.

void KPropertySet::aboutToDeleteProperty ( KPropertySet set,
KProperty property 
)
signal

Emitted when property is about to be deleted.

void KPropertySet::addProperty ( KProperty property,
const QByteArray group = "common" 
)
slot

Adds the property to the set, in the group. The property becomes owned by the set. Any name can be used for the group. "common" is the default for a basic top-level group.

Definition at line 449 of file KPropertySet.cpp.

void KPropertySet::changeProperty ( const QByteArray property,
const QVariant value 
)
slot

Change the value of property whose key is property to value.

See also
void changePropertyIfExists(const QByteArray &, const QVariant &)

Definition at line 608 of file KPropertySet.cpp.

void KPropertySet::changePropertyIfExists ( const QByteArray property,
const QVariant value 
)
slot

Change the value of property whose key is property to value only if it exists in the set.

See also
void changeProperty(const QByteArray &, const QVariant &)

Definition at line 576 of file KPropertySet.cpp.

void KPropertySet::clear ( )
slot

Removes all property objects from the property set and deletes them.

Definition at line 468 of file KPropertySet.cpp.

void KPropertySet::clearModifiedFlags ( )

Clears "modified" flag of all properties in this set, i.e.

calls clearModifiedFlag() for each property.

Since
3.1
See also
KProperty::clearModifiedFlag()

Definition at line 664 of file KPropertySet.cpp.

bool KPropertySet::contains ( const QByteArray name) const
Returns
true if the set contains property names name.

Definition at line 565 of file KPropertySet.cpp.

int KPropertySet::count ( ) const
Returns
the number of top-level properties in the set.

Definition at line 519 of file KPropertySet.cpp.

int KPropertySet::count ( const KPropertySelector selector) const
Returns
the number of top-level properties in the set matching criteria defined by selector.

Definition at line 524 of file KPropertySet.cpp.

void KPropertySet::debug ( ) const

Prints debug output for this set.

Definition at line 615 of file KPropertySet.cpp.

QString KPropertySet::groupCaption ( const QByteArray group) const
Returns
the user-visible translated caption string for group that will be shown in property editor to represent group. If there is no special caption set for the group, group is just returned.

Definition at line 502 of file KPropertySet.cpp.

QString KPropertySet::groupIconName ( const QByteArray group) const
Returns
icon name for group.

Definition at line 512 of file KPropertySet.cpp.

QByteArray KPropertySet::groupNameForProperty ( const QByteArray propertyName) const
Returns
group name for property propertyName Empty value is returned if there is no such property.
Since
3.1

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
3.1

Definition at line 475 of file KPropertySet.cpp.

QList< QByteArray > KPropertySet::groupNames ( ) const
Returns
a list of all group names. The order of items is undefined.

Definition at line 486 of file KPropertySet.cpp.

bool KPropertySet::hasProperties ( const KPropertySelector selector) const
Returns
true if the set is contains properties matching criteria defined by selector.

Definition at line 543 of file KPropertySet.cpp.

bool KPropertySet::hasVisibleProperties ( ) const
Returns
true if the set is contains visible properties.

Definition at line 538 of file KPropertySet.cpp.

bool KPropertySet::isEmpty ( ) const
Returns
true if the set is empty, i.e. count() is 0; otherwise returns false.

Definition at line 533 of file KPropertySet.cpp.

bool KPropertySet::isModified ( ) const

Returns true if at least one property in this set is modified, i.e.

returns true for isModified()

Since
3.1
See also
clearModifiedFlags() KProperty::isModified()

Definition at line 671 of file KPropertySet.cpp.

bool KPropertySet::isReadOnly ( ) const
Returns
true if the set is read-only when used in a property editor. false by default. In a read-only property set no property can be modified by the user regardless of read-only flag of any property (KProperty::isReadOnly()). On the other hand if KProperty::isReadOnly() is true and KPropertySet::isReadOnly() is false, the property is still read-only. Read-only property set prevents editing in the property editor but it is still possible to change value or other parameters of property programatically using KProperty::setValue(), KProperty::resetValue(), etc.

Definition at line 550 of file KPropertySet.cpp.

KPropertySet & KPropertySet::operator= ( const KPropertySet set)

Creates a deep copy of set and assigns it to this property set.

Definition at line 590 of file KPropertySet.cpp.

KProperty & KPropertySet::operator[] ( const QByteArray name) const

Accesses a property by name. A property reference is returned, so all property modifications are allowed. If there is no such property, null property (KProperty()) is returned, so it's good practice to use contains() if it's not known if the property exists. For example to set a value of a property, use:

...
if (!set.contains("myProperty")) {
dosomething;
}
set["myProperty"].setValue("My Value");
Returns
Property with given name.
See also
changeProperty(const QByteArray &, const QVariant &)
changePropertyIfExists(const QByteArray &, const QVariant &)

Definition at line 584 of file KPropertySet.cpp.

QByteArray KPropertySet::previousSelection ( ) const

Used by property editor to preserve previous selection when this set is assigned again.

Definition at line 645 of file KPropertySet.cpp.

KProperty & KPropertySet::property ( const QByteArray name) const
Returns
property named with name. If no such property is found, null property (KProperty()) is returned.

Definition at line 571 of file KPropertySet.cpp.

void KPropertySet::propertyChanged ( KPropertySet set,
KProperty property 
)
signal

Emitted when the value of the property is changed.

void KPropertySet::propertyChangedInternal ( KPropertySet set,
KProperty property 
)
signal

Exists to be sure that we emitted it before propertyChanged(), so editor object can handle this.

QList< QByteArray > KPropertySet::propertyNamesForGroup ( const QByteArray group) const
Returns
a list of all property names for group group. The order of items is undefined.

Definition at line 491 of file KPropertySet.cpp.

void KPropertySet::propertyReset ( KPropertySet set,
KProperty property 
)
signal

Emitted when the value of the property is reset.

QVariant KPropertySet::propertyValue ( const QByteArray name,
const QVariant defaultValue = QVariant() 
) const
Returns
value for property named with name. If no such property is found, default value defaultValue is returned.

Definition at line 601 of file KPropertySet.cpp.

QMap< QByteArray, QVariant > KPropertySet::propertyValues ( ) const
Returns
property values for this set

Definition at line 655 of file KPropertySet.cpp.

void KPropertySet::readOnlyFlagChanged ( )
signal

Emitted when property set object's read-only flag has changed.

void KPropertySet::removeProperty ( KProperty property)
slot

Removes property from the set and deletes the object. Emits aboutToDeleteProperty before removing.

Definition at line 455 of file KPropertySet.cpp.

void KPropertySet::removeProperty ( const QByteArray name)
slot

Removes property with the given name from the set and deletes the object. Emits aboutToDeleteProperty() before removing.

Definition at line 461 of file KPropertySet.cpp.

void KPropertySet::setGroupCaption ( const QByteArray group,
const QString caption 
)
slot

Sets caption as a user-visible translated string that will be shown in editor to represent group.

Definition at line 497 of file KPropertySet.cpp.

void KPropertySet::setGroupIconName ( const QByteArray group,
const QString iconName 
)
slot

Sets the icon name icon to be displayed for group.

Definition at line 507 of file KPropertySet.cpp.

void KPropertySet::setPreviousSelection ( const QByteArray prevSelection)
slot

Sets previous section.

See also
previousSelection()

Definition at line 650 of file KPropertySet.cpp.

void KPropertySet::setReadOnly ( bool  readOnly)
slot

Sets this set to be read-only.

See also
isReadOnly

Definition at line 556 of file KPropertySet.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 23:05:38 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.