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. Qt wrapper around non-Qt class
Forum Updated to NodeBB v4.3 + New Features

Qt wrapper around non-Qt class

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.9k Views 2 Watching
  • 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.
  • -vix-- Offline
    -vix-- Offline
    -vix-
    wrote on last edited by
    #1

    I created a Qt wrapper around a non-Qt class (by composition), basically to implement a GUI/HMI for the class.
    I can easily forward (pass-down) user actions from the Qt wrapper to the non-Qt class, but I can't find an easy and clean way to handle the uiRedraw() event (I mean, redraw the ui only when something changed in the non-Qt class and not on polling base).

    Thank you very much for your support.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Does that non-Qt class offer any feedback mechanism ? e.g. a callback etc.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • -vix-- Offline
        -vix-- Offline
        -vix-
        wrote on last edited by
        #3

        Hi;
        it doesn't offer any callback (at the moment), but I can modify the code, if needed.
        The only restriction is that this class must contain c++ standard code only.
        Could you provide a link on how to add a feedback mechanism?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          It depends a bit on the design of your other classes. They could also use some sort of IPC channel like sockets to communicate etc.

          What are these classes doing that you are writing a wrapper for ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • -vix-- Offline
            -vix-- Offline
            -vix-
            wrote on last edited by
            #5

            The classes implement a state machine with some input methods/commands (used to control the state machine itself).
            Some of the states produce or update data and I've already implemented an observer pattern to notify other classes for new data availability.
            Maybe this internal observer pattern can be used to notify somehow the wrapper too, but I can't find a way (I'm not an expert of Qt).

            kshegunovK 1 Reply Last reply
            0
            • -vix-- -vix-

              The classes implement a state machine with some input methods/commands (used to control the state machine itself).
              Some of the states produce or update data and I've already implemented an observer pattern to notify other classes for new data availability.
              Maybe this internal observer pattern can be used to notify somehow the wrapper too, but I can't find a way (I'm not an expert of Qt).

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #6

              @-vix- said in Qt wrapper around non-Qt class:

              Maybe this internal observer pattern can be used to notify somehow the wrapper too, but I can't find a way (I'm not an expert of Qt).

              Can't you push an observer from the Qt code by which to monitor the non-Qt code, which (observer) in turn would call the QWidget::update or raise a signal or something?

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              1
              • -vix-- Offline
                -vix-- Offline
                -vix-
                wrote on last edited by
                #7

                @kshegunov said

                Can't you push an observer from the Qt code by which to monitor the non-Qt code, which (observer) in turn would call the QWidget::update or raise a signal or something?

                This can be a good idea; I need some time to expose to the Qt wrapper the methods to attach is as an observer.

                1 Reply Last reply
                0

                • Login

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