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. Realtime Update of QLineEdit tools
Forum Updated to NodeBB v4.3 + New Features

Realtime Update of QLineEdit tools

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 515 Views 1 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.
  • D Offline
    D Offline
    dencla
    wrote on last edited by
    #1

    I am looking for a way to Update a group of QEditLine tools. using signals and slots to notify me when the data has changed and update the tool. There is a way fjor Views to update when the database changes so there must be a way for Edit tools as well.

    If anyone has any suggestions i would appreciate it.
    Thanks
    jdc

    JonBJ 1 Reply Last reply
    0
    • D dencla

      I am looking for a way to Update a group of QEditLine tools. using signals and slots to notify me when the data has changed and update the tool. There is a way fjor Views to update when the database changes so there must be a way for Edit tools as well.

      If anyone has any suggestions i would appreciate it.
      Thanks
      jdc

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @dencla
      QLineEdits are widgets. Don't know what "tools" is about, nor QEditLine. Either look at QDataWidgetMapper or just attach slots to go setText() in response to your signals.

      D 1 Reply Last reply
      0
      • JonBJ JonB

        @dencla
        QLineEdits are widgets. Don't know what "tools" is about, nor QEditLine. Either look at QDataWidgetMapper or just attach slots to go setText() in response to your signals.

        D Offline
        D Offline
        dencla
        wrote on last edited by
        #3

        @JonB Thanks for the feedback. Sorry for the type-o.
        I meant QLineEdit sorry and tools are just multiple LineEdit instances.
        I can update the tools->setText as you say, but what I am looking for is a way to automatically update the tool when the outside data changed from say a PLC or something where there is no user interaction at the time.

        I am using a timer event signal and slot now to do the update.

        When I update a value in the database remotely my views update with out having to write any code. I was wondering if there is a way to do the same thing with other Classes like QLineEdit.
        jdc

        Pl45m4P JonBJ 2 Replies Last reply
        0
        • D dencla

          @JonB Thanks for the feedback. Sorry for the type-o.
          I meant QLineEdit sorry and tools are just multiple LineEdit instances.
          I can update the tools->setText as you say, but what I am looking for is a way to automatically update the tool when the outside data changed from say a PLC or something where there is no user interaction at the time.

          I am using a timer event signal and slot now to do the update.

          When I update a value in the database remotely my views update with out having to write any code. I was wondering if there is a way to do the same thing with other Classes like QLineEdit.
          jdc

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @dencla said in Realtime Update of QLineEdit tools:

          I can update the tools->setText as you say, but what I am looking for is a way to automatically update the tool when the outside data changed from say a PLC or something where there is no user interaction at the time.
          I am using a timer event signal and slot now to do the update.

          Speaking of "tools" is still confusing in this case.

          I was wondering if there is a way to do the same thing with other Classes like QLineEdit.

          Have a look at Qt's data models and the views, as described here

          • https://doc.qt.io/qt-6/model-view-programming.html

          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          1 Reply Last reply
          0
          • D dencla

            @JonB Thanks for the feedback. Sorry for the type-o.
            I meant QLineEdit sorry and tools are just multiple LineEdit instances.
            I can update the tools->setText as you say, but what I am looking for is a way to automatically update the tool when the outside data changed from say a PLC or something where there is no user interaction at the time.

            I am using a timer event signal and slot now to do the update.

            When I update a value in the database remotely my views update with out having to write any code. I was wondering if there is a way to do the same thing with other Classes like QLineEdit.
            jdc

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @dencla
            I am still struggling to discern your actual question. It now seems QLineEdit is a minor detail, are you asking about: if something else external updates data in a SQL database can your application "see" this and act on it, updating the UI, is that the real query?

            When I update a value in the database remotely my views update with out having to write any code. I

            What do you mean here? What does "remotely" mean? IF you are claiming that something external updates a SQL database and your views immediately update in response, that is simply not true/possible with Qt. The views only change in response to changes in the in-memory model. If that is not updated from the database the view will not update. And the model can only be updated if you explicitly, or something implicitly, issues a SQL SELECT statement to re-read from the database. Either your database provider does not offer any "push" notifications to your application on remote data changes or at least there is no interface to such from the Qt model classes. As you have noted, the only way to achieve something is to re-query on a timer event from your application, which is not ideal. Unless you can arrange for whatever is happening which updates the database to raise a signal in your application you are stuck.

            If you do (somehow) get to update the in-memory data model I have said that QDataWidgetMapper can be used to immediately reflect changes to a number of QLineEdits without you writing code/signals for each one individually if that is what you want. Did you look at that?

            D 1 Reply Last reply
            0
            • JonBJ JonB

              @dencla
              I am still struggling to discern your actual question. It now seems QLineEdit is a minor detail, are you asking about: if something else external updates data in a SQL database can your application "see" this and act on it, updating the UI, is that the real query?

              When I update a value in the database remotely my views update with out having to write any code. I

              What do you mean here? What does "remotely" mean? IF you are claiming that something external updates a SQL database and your views immediately update in response, that is simply not true/possible with Qt. The views only change in response to changes in the in-memory model. If that is not updated from the database the view will not update. And the model can only be updated if you explicitly, or something implicitly, issues a SQL SELECT statement to re-read from the database. Either your database provider does not offer any "push" notifications to your application on remote data changes or at least there is no interface to such from the Qt model classes. As you have noted, the only way to achieve something is to re-query on a timer event from your application, which is not ideal. Unless you can arrange for whatever is happening which updates the database to raise a signal in your application you are stuck.

              If you do (somehow) get to update the in-memory data model I have said that QDataWidgetMapper can be used to immediately reflect changes to a number of QLineEdits without you writing code/signals for each one individually if that is what you want. Did you look at that?

              D Offline
              D Offline
              dencla
              wrote on last edited by
              #6

              @JonB You are correct in your first assumption about the QLineEdit. Also I was referring to the memory model database examples inadvertently.
              I will review the link that you sent me. I have looked at that before, but I have to admit, I'm not well versed in the qt functions yet.
              I have not explored the QDataWidgetMapper, that may be the answer to my question. In the future I will be wanting to receive data from an OPC server which is part of the direction of the question.
              Thanks for your feedback it is helpful and I will explore your suggestions.

              jdc

              1 Reply Last reply
              0
              • D dencla has marked this topic as solved on

              • Login

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