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. How do I connect to an event of line edit completion/exit and catch it in a QTreeView?

How do I connect to an event of line edit completion/exit and catch it in a QTreeView?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qlinedittableviewline editeventqtreeview
6 Posts 3 Posters 2.9k 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.
  • L Offline
    L Offline
    lancelotrose
    wrote on 3 Mar 2016, 16:57 last edited by A Former User
    #1

    So I have a tree view that updates a panel of content after selection change, however I'm running into an issue of after line edit it is updating the name of that item, and it's not properly saving the change to that item and reopening it with the new info, in fact it completely looses context and its not even open anymore. Is there a way for me to catch the line edit event and call my own function?

    K 1 Reply Last reply 3 Mar 2016, 17:33
    0
    • L lancelotrose
      3 Mar 2016, 16:57

      So I have a tree view that updates a panel of content after selection change, however I'm running into an issue of after line edit it is updating the name of that item, and it's not properly saving the change to that item and reopening it with the new info, in fact it completely looses context and its not even open anymore. Is there a way for me to catch the line edit event and call my own function?

      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 3 Mar 2016, 17:33 last edited by
      #2

      @lancelotrose
      Hello,
      You can intercept the line edit's events by installing an event filter, although I didn't quite catch what you're trying to do and why you need to do that.

      Kind regards.

      Read and abide by the Qt Code of Conduct

      L 1 Reply Last reply 3 Mar 2016, 21:10
      1
      • K kshegunov
        3 Mar 2016, 17:33

        @lancelotrose
        Hello,
        You can intercept the line edit's events by installing an event filter, although I didn't quite catch what you're trying to do and why you need to do that.

        Kind regards.

        L Offline
        L Offline
        lancelotrose
        wrote on 3 Mar 2016, 21:10 last edited by
        #3

        @kshegunov Hi thanks that mostly fixed the issue need to do a little more debugging but was able to get a subevent type and handle it properly given one condition.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 3 Mar 2016, 21:50 last edited by
          #4

          Hi and welcome to devnet,

          Something sounds fishy here. Looks like you are editing an entry in your QTreeView and that it doesn't get stored in your model, right ? If so, what model are you using ? Are you using a custom QStyledItemDelegate ?

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

          L 1 Reply Last reply 4 Mar 2016, 13:15
          0
          • S SGaist
            3 Mar 2016, 21:50

            Hi and welcome to devnet,

            Something sounds fishy here. Looks like you are editing an entry in your QTreeView and that it doesn't get stored in your model, right ? If so, what model are you using ? Are you using a custom QStyledItemDelegate ?

            L Offline
            L Offline
            lancelotrose
            wrote on 4 Mar 2016, 13:15 last edited by
            #5

            @SGaist It's actually not originally my code base. They created objects that it refers to, but I'm not sure if they are actually dispatching/handling the signals correctly when the item is changed. So I know what the problem is whenever an item is changed it is released(which deletes the current existing model and returns a "updated/reverted" model at the same index), so the panel is still pointing to the old non-existent model, which happens to be at the same index, but they aren't necessarily catching the change and correctly updating the reference to the model when they change it in the tree, so I'm trying to fix that, adding the event listener and filtering events has helped allot, and I'm sure it's the solution I just haven't handled all plausible event cases yet, where these changes may occur.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 4 Mar 2016, 21:42 last edited by
              #6

              Sounds pretty crazy...

              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

              1/6

              3 Mar 2016, 16:57

              • Login

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