twisterp2pblockchainnetworkbittorrentipv6microbloggingsocial-networkdhtdecentralizedtwister-coretwisterarmyp2p-networktwister-servertwister-ipv6
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.0 KiB
38 lines
1.0 KiB
#include "monitoreddatamapper.h" |
|
|
|
#include <QWidget> |
|
#include <QMetaObject> |
|
#include <QMetaProperty> |
|
#include <QDebug> |
|
|
|
|
|
MonitoredDataMapper::MonitoredDataMapper(QObject *parent) : |
|
QDataWidgetMapper(parent) |
|
{ |
|
} |
|
|
|
|
|
void MonitoredDataMapper::addMapping(QWidget *widget, int section) |
|
{ |
|
QDataWidgetMapper::addMapping(widget, section); |
|
addChangeMonitor(widget); |
|
} |
|
|
|
void MonitoredDataMapper::addMapping(QWidget *widget, int section, const QByteArray &propertyName) |
|
{ |
|
QDataWidgetMapper::addMapping(widget, section, propertyName); |
|
addChangeMonitor(widget); |
|
} |
|
|
|
void MonitoredDataMapper::addChangeMonitor(QWidget *widget) |
|
{ |
|
// Watch user property of widget for changes, and connect |
|
// the signal to our viewModified signal. |
|
QMetaProperty prop = widget->metaObject()->userProperty(); |
|
int signal = prop.notifySignalIndex(); |
|
int method = this->metaObject()->indexOfMethod("viewModified()"); |
|
if(signal != -1 && method != -1) |
|
{ |
|
QMetaObject::connect(widget, signal, this, method); |
|
} |
|
}
|
|
|