]> Git Repo - VerusCoin.git/blob - src/qt/monitoreddatamapper.cpp
checkpoints.cpp depends on main, it can use mapBlockIndex directly
[VerusCoin.git] / src / qt / monitoreddatamapper.cpp
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5 #include "monitoreddatamapper.h"
6
7 #include <QMetaObject>
8 #include <QMetaProperty>
9 #include <QWidget>
10
11 MonitoredDataMapper::MonitoredDataMapper(QObject *parent) :
12     QDataWidgetMapper(parent)
13 {
14 }
15
16 void MonitoredDataMapper::addMapping(QWidget *widget, int section)
17 {
18     QDataWidgetMapper::addMapping(widget, section);
19     addChangeMonitor(widget);
20 }
21
22 void MonitoredDataMapper::addMapping(QWidget *widget, int section, const QByteArray &propertyName)
23 {
24     QDataWidgetMapper::addMapping(widget, section, propertyName);
25     addChangeMonitor(widget);
26 }
27
28 void MonitoredDataMapper::addChangeMonitor(QWidget *widget)
29 {
30     // Watch user property of widget for changes, and connect
31     //  the signal to our viewModified signal.
32     QMetaProperty prop = widget->metaObject()->userProperty();
33     int signal = prop.notifySignalIndex();
34     int method = this->metaObject()->indexOfMethod("viewModified()");
35     if(signal != -1 && method != -1)
36     {
37         QMetaObject::connect(widget, signal, this, method);
38     }
39 }
This page took 0.045092 seconds and 4 git commands to generate.