Hi, now I have to connect several SIGNALS to one SLOT, but how can I distinguish which QWidget emit the SIGNAL in the SLOT function??
Is there any way to find the sender??
Thanks !!
Hi, now I have to connect several SIGNALS to one SLOT, but how can I distinguish which QWidget emit the SIGNAL in the SLOT function??
Is there any way to find the sender??
Thanks !!
one way is QObject::sender()other possibilities might be classes like QSignalMapper
sophister (24th April 2009)
Thanks!!
Could I ask you one more question?
when I use the QMap, something is always wrong. Following is my codes:
in the .h file :
And I have added the declare at the beginning of the header file like this:
But I just can't pass the compiler.
you need to write
Qt Code:
#include <QMap> #include <QString> class QToolButton; // forward decl ok as you just use a ptr to itTo copy to clipboard, switch view to plain text mode
Thank you !!
yeah, but I have forward declare for class QToolButton, and it's ok.
if I haven't include QMap, and just forward declare it using , the compiler will give some errors.
The only way to use QMap in the header file is to , while just using forward declare won't work.
I'm really puzzled
well, the compiler needs to know more here: QMap is a templated type.
If you write QMap, the compiler assumes QMap is a 'plain' type and then writing QMap<T1,T2> is not ok, just as you may not write QString<int>.
Bookmarks