Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
monitoreddatamapper.cpp
Go to the documentation of this file.
1 #include "monitoreddatamapper.h"
2 
3 #include <QWidget>
4 #include <QMetaObject>
5 #include <QMetaProperty>
6 
8  QDataWidgetMapper(parent)
9 {
10 }
11 
12 void MonitoredDataMapper::addMapping(QWidget *widget, int section)
13 {
14  QDataWidgetMapper::addMapping(widget, section);
15  addChangeMonitor(widget);
16 }
17 
18 void MonitoredDataMapper::addMapping(QWidget *widget, int section, const QByteArray &propertyName)
19 {
20  QDataWidgetMapper::addMapping(widget, section, propertyName);
21  addChangeMonitor(widget);
22 }
23 
25 {
26  // Watch user property of widget for changes, and connect
27  // the signal to our viewModified signal.
28  QMetaProperty prop = widget->metaObject()->userProperty();
29  int signal = prop.notifySignalIndex();
30  int method = this->metaObject()->indexOfMethod("viewModified()");
31  if(signal != -1 && method != -1)
32  {
33  QMetaObject::connect(widget, signal, this, method);
34  }
35 }
void addMapping(QWidget *widget, int section)
MonitoredDataMapper(QObject *parent=0)
void addChangeMonitor(QWidget *widget)