1

I have the declaration of signal in "tree.h":

...
signals:
void doubleClicked(const QModelIndex & index);
...

then in constructor I connect:

connect(this, SIGNAL(doubleClicked(const QModelIndex&)), SLOT(sm(const QModelIndex&)));

Nothing works and I get runtime message:

QMetaObject::indexOfSignal: signal doubleClicked(QModelIndex) from QTreeView redefined in Tree...

I'm trying to solve it for several hours but in vain!

Thanx in advance!!!

1 Answers1

3

You can not override a signal in a sub class. See also How to process signals in a Qt subclass?. It would not make sense anyway since the signal gets emitted by some code in the parent class, so if you want to react on it simply connect the existing signal from the parent class to your slot and remove the declaration of your signal in the sub class.

The error message you get has been introduced with Qt 4.6, see https://bugreports.qt-project.org/browse/QTBUG-17600 to make sure that you do not accidentally override a signal in a sub class.

Community
  • 1
  • 1
Andreas Fester
  • 36,091
  • 7
  • 95
  • 123