49 if (pObjConnections.contains(pname)) {
53 if ((*it).target == Property) {
54 (*it).object->setProperty((*it).targetName, newValue);
55 }
else if ((*it).target == Slot) {
59 qWarning()<<
KLF_FUNC_NAME<<
": Unknown target type "<<(*it).target<<
" !";
73 connectQObject(configPropertyName,
object, Property, objPropName);
78 connectQObject(configPropertyName,
object, Slot, slotName);
83 disconnectQObject(configPropertyName,
object, Property, objPropName);
88 disconnectQObject(configPropertyName,
object, Slot, slotName);
95 klfDbg(
"Connecting prop "<<configPropertyName<<
" to object "<<
object<<
", targettype="<<target
96 <<
", targetName="<<targetName ) ;
101 if ((*it)->propName() == configPropertyName) {
106 KLF_ASSERT_NOT_NULL(p,
"Invalid config property name: "<<configPropertyName<<
".",
return; ) ;
111 c.targetName = targetName;
117 qWarning()<<
KLF_FUNC_NAME<<
": "<<configPropertyName<<
" already connected to "<<
object<<
"/"<<targetName;
122 pObjConnections[configPropertyName].
append(c);
126 if (c.target == Property) {
127 object->setProperty(targetName, value);
128 }
else if (c.target == Slot) {
145 klfDbg(
"removed QObject-connection target-type "<<(*it).target<<
", target-name "<<(*it).targetName) ;
151 qWarning()<<
KLF_FUNC_NAME<<
": "<<configPropertyName<<
" is not connected to "<<
object<<
"/"<<targetName;
157 for (pit = pObjConnections.
begin(); pit != pObjConnections.
end(); ++pit) {
162 if ((*it).object ==
object) {
163 klfDbg(
"Removing connection between object "<<
object<<
" and config property "<<pname) ;
183 klfWarning(
"Requesting property instance for empty name !?! Program might crash!") ;
190 qWarning()<<
KLF_FUNC_NAME<<
": Can't find config property name "<<name<<
" !";
const Key key(const T &value) const
virtual void disconnectQObjectSlot(const QString &configPropertyName, QObject *object, const QByteArray &slotMethodName)
#define klfDbg(streamableItems)
print debug stream items
#define KLF_DEBUG_BLOCK(msg)
Utility to debug the execution of a block.
iterator erase(iterator pos)
void connectQObject(const QString &configPropertyName, QObject *object, ConnectionTarget target, const QByteArray &targetName)
virtual void disconnectQObject(QObject *object)
#define KLF_ASSERT_NOT_NULL(ptr, msg, failaction)
Asserting Non-NULL pointers (NON-FATAL)
virtual void connectQObjectSlot(const QString &configPropertyName, QObject *object, const QByteArray &slotMethodName)
#define klfWarning(streamableItems)
virtual ~KLFConfigPropBase()
virtual void propertyChanged(KLFConfigPropBase *property, const QVariant &oldValue, const QVariant &newValue)
virtual QVariant toVariant() const =0
virtual void connectQObjectProperty(const QString &configPropertyName, QObject *object, const QByteArray &objPropName)
QByteArray & append(char ch)
const T value(const Key &key) const
virtual bool okChangeProperty(KLFConfigPropBase *property, const QVariant &oldValue, const QVariant &newValue)
virtual void propertyValueRequested(const KLFConfigPropBase *property)
const char * typeName() const
virtual QStringList propertyList() const
virtual void disconnectQObjectProperty(const QString &configPropertyName, QObject *object, const QByteArray &objPropName)
virtual QString propName() const
KLFConfigPropBase * property(const QString &name)