check for slots existence before blindly connecting
This commit is contained in:
parent
3d77ac5008
commit
140d066021
@ -141,9 +141,11 @@ public:
|
||||
*/
|
||||
Q_INVOKABLE void disconnectSource(const QString &source);
|
||||
|
||||
protected Q_SLOTS:
|
||||
public Q_SLOTS:
|
||||
void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
|
||||
void modelChanged(const QString &sourceName, QAbstractItemModel *model);
|
||||
|
||||
protected Q_SLOTS:
|
||||
void removeSource(const QString &source);
|
||||
void setupData();
|
||||
|
||||
|
@ -155,10 +155,14 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt
|
||||
if (pollingInterval < 1) {
|
||||
//qDebug() << " connecting directly";
|
||||
d->relayObjects[visualization] = 0;
|
||||
connect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
connect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
if (visualization->metaObject()->indexOfSlot("dataUpdated(QString,Plasma::DataEngine::Data)") >= 0) {
|
||||
connect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
|
||||
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
|
||||
}
|
||||
if (visualization->metaObject()->indexOfSlot("modelChanged(QString,QAbstractItemModel*)") >= 0) {
|
||||
connect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
|
||||
visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
|
||||
}
|
||||
} else {
|
||||
//qDebug() << " connecting to a relay";
|
||||
// we only want to do an imediate update if this is not the first object to connect to us
|
||||
|
Loading…
Reference in New Issue
Block a user