Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/skin/propertybinder.cpp

Go to the documentation of this file.
00001 #include "skin/propertybinder.h"
00002 #include "controlobject.h"
00003 #include "controlobjectthreadmain.h"
00004 
00005 PropertyBinder::PropertyBinder(QWidget* pWidget, QString propertyName, ControlObject* pControl)
00006         : QObject(pWidget),
00007           m_propertyName(propertyName),
00008           m_pWidget(pWidget),
00009           m_pControlThreadMain(new ControlObjectThreadMain(pControl)) {
00010     connect(m_pControlThreadMain, SIGNAL(valueChanged(double)),
00011             this, SLOT(slotValueChanged(double)));
00012     connect(this, SIGNAL(setWidgetProperty(const char*, const QVariant&)),
00013             pWidget, SLOT(setProperty(const char*, const QVariant&)));
00014     slotValueChanged(m_pControlThreadMain->get());
00015 }
00016 
00017 PropertyBinder::~PropertyBinder() {
00018     delete m_pControlThreadMain;
00019 }
00020 
00021 void PropertyBinder::slotValueChanged(double dValue) {
00022     //qDebug() << this << m_propertyName << "valueChanged" << dValue;
00023     QVariant value(dValue);
00024     QByteArray propertyAscii = m_propertyName.toAscii();
00025     if (!m_pWidget->setProperty(propertyAscii.constData(), value)) {
00026         qDebug() << "Setting property" << m_propertyName << "to widget failed. Value:" << value;
00027     }
00028 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines