jlbrd
5th August 2006, 22:12
Hi,
I want for Qt widgets list all signals with parameters. For this I use :
QLineEdit *line = new QLineEdit;
for(int i=0; i<line->metaObject()->methodCount(); i++)
{
QMetaMethod meta = line->metaObject()->method( i );
if( meta.methodType() == QMetaMethod::Signal )
qDebug() << meta.signature() << meta.parameterTypes() << meta.parameterNames();
}
The result of the example above is :
destroyed(QObject*) ("QObject*") ("")
destroyed() () ()
customContextMenuRequested(QPoint) ("QPoint") ("pos")
textChanged(QString) ("QString") ("")
textEdited(QString) ("QString") ("")
cursorPositionChanged(int,int) ("int", "int") ("", "")
returnPressed() () ()
editingFinished() () ()
selectionChanged() () ()
lostFocus() () ()
The problem is for textChanged, textEdited etc. Indeed the type parameters is present but not the names whereas for customContextMenuRequested the name "pos" is present.
Then why for certain signals the names are present and for others not ?
I would like to have all the names !
Thanks
I want for Qt widgets list all signals with parameters. For this I use :
QLineEdit *line = new QLineEdit;
for(int i=0; i<line->metaObject()->methodCount(); i++)
{
QMetaMethod meta = line->metaObject()->method( i );
if( meta.methodType() == QMetaMethod::Signal )
qDebug() << meta.signature() << meta.parameterTypes() << meta.parameterNames();
}
The result of the example above is :
destroyed(QObject*) ("QObject*") ("")
destroyed() () ()
customContextMenuRequested(QPoint) ("QPoint") ("pos")
textChanged(QString) ("QString") ("")
textEdited(QString) ("QString") ("")
cursorPositionChanged(int,int) ("int", "int") ("", "")
returnPressed() () ()
editingFinished() () ()
selectionChanged() () ()
lostFocus() () ()
The problem is for textChanged, textEdited etc. Indeed the type parameters is present but not the names whereas for customContextMenuRequested the name "pos" is present.
Then why for certain signals the names are present and for others not ?
I would like to have all the names !
Thanks