how to define a macro function with included the signals key words?
-
when I used the macro liked this
#define FUNCTION(NAME)\ signals:\ void on##NAME##Function();
it dosent work. so is it possible that the macro could include the signals key words?
-
hi
doesn't work this way. There's no need of macros for this. the onSomeEvent method is an autoconnection pattern that allows you to create a method that acts like a slot and autoconnects to the matching signal.
just name your signal "someEvent", and then you can create an autoconnection to that signal by naming the method "onSomeEvent". That's all. -
Hi,
@nicker-player what exactly are you trying to do ? With which version of Qt ?
@CassD that's wrong, the onXYZ pattern is used in QML however that's not the case for C++. If you are thinking about the Designer auto connect feature, the pattern is different and it's anyway no recommended to use it.
-
I just dont want to input so many codes. i found that if the macro contains the signals key words wouldnt work.so just forget it.
-
I just dont want to input so many codes. i found that if the macro contains the signals key words wouldnt work.so just forget it.
@nicker-player You can also use "Q_SIGNALS" instead of "signals".
"it dosent work" - is not a problem description.
Btw. signals is not a keyword. -
I just dont want to input so many codes. i found that if the macro contains the signals key words wouldnt work.so just forget it.
@nicker-player said in how to define a macro function with included the signals key words?:
I just dont want to input so many codes. i found that if the macro contains the signals key words wouldnt work.so just forget it.
I don't understand what you want to achieve (and I'm obviously not the only one). Please explain us clearly and correctly what you are trying to do.
No matter what you are trying to do, the way you are trying to do it is a non-sense. -
@nicker-player You can also use "Q_SIGNALS" instead of "signals".
"it dosent work" - is not a problem description.
Btw. signals is not a keyword.@jsulm
thanks.you just helped me.