Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Wiring different events inside QFrame
QtWS25 Last Chance

[SOLVED] Wiring different events inside QFrame

Scheduled Pinned Locked Moved General and Desktop
qframe
3 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ajdinm
    wrote on 17 Oct 2015, 18:30 last edited by ajdinm
    #1

    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,
    Ajdin

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 17 Oct 2015, 19:22 last edited by mrjj
      #2

      Hi and welcome
      This forum is mostly c++ but I assume some also use python.
      There is also
      https://forum.qt.io/category/15/language-bindings
      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
      def buttonClicked(self):
      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 ?
      http://doc.qt.io/qt-5/qtqml-index.html
      Very easy to get animation up an running.

      1 Reply Last reply
      1
      • A Offline
        A Offline
        ajdinm
        wrote on 17 Oct 2015, 19:51 last edited by
        #3

        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.
        Thank you

        1 Reply Last reply
        0

        1/3

        17 Oct 2015, 18:30

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved