Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] Wiring different events inside QFrame
ajdinm last edited by ajdinm
Hello Qt community.
I'm new to Qt, so if I wrote on wrong forum or anything, please pardon me. Also, I have tried googling help to this, but I couldn't find any.
Anyway, I created simple ui with interface designer, which only has 1 frame and 3 push buttons inside. I wanted to add different click events to these buttons (for starters, 1st button should print 1, 2nd 2, etc..).
However, my code manages to wire these events to function i want, but all there buttons print 3 (last value of i). How can I solve this issue ?
Btw, my original problem is to have way to add any number of nodes (let them be buttons for now) to UI, than read them inside code and apply some logic to them. I want to use this to model DFA and do some simple animation when transitioning states. Is there maybe better way to solve this (with Qt and Python) ?
Thanks in advance,
Hi and welcome
This forum is mostly c++ but I assume some also use python.
There is also
Where more python seems to hang out.
So if not lucky here then also try there :)
I have never used Python, but I wondered about the syntax for the lambda as it seems you
reference external function (f). Will It will still create an inline version for each invocation ? (for all children)
Anyway, when a signal is send (like clicked), you can get the sender
sender = self.sender()
so you should be able to hook your DFAWidget up in a dynamic fashion and
then let the class do what you want when transitioning.
That said, did you see QML ?
Very easy to get animation up an running.
ajdinm last edited by
Thanks for the reply. :D
self.sender() get me button that called function, that should be enough for now.
No, I haven't seen QML, I will definitelly check it out.