mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 05:49:11 +01:00
51ed9ec971
Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
// Copyright (c) 2011-2013 The Bitcoin developers
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include "monitoreddatamapper.h"
|
|
|
|
#include <QMetaObject>
|
|
#include <QMetaProperty>
|
|
#include <QWidget>
|
|
|
|
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);
|
|
}
|
|
}
|