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. QTableWidget - wanna lose focus when clicking away

QTableWidget - wanna lose focus when clicking away

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.4k 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.
  • FluentCodingF Offline
    FluentCodingF Offline
    FluentCoding
    wrote on last edited by
    #1

    Hey!

    Is it possible that if you lose the focus when you click away from the QTableWidget? Currently, it doesn't happen.
    I'm using QT 5 for C++ and I thought about connecting a signal, which gets fired when I click away, to a focus.

    I hope that you can help me!

    JonBJ 1 Reply Last reply
    0
    • FluentCodingF FluentCoding

      Hey!

      Is it possible that if you lose the focus when you click away from the QTableWidget? Currently, it doesn't happen.
      I'm using QT 5 for C++ and I thought about connecting a signal, which gets fired when I click away, to a focus.

      I hope that you can help me!

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

      @FluentCoding
      What have you tried? You should be finding that you do get one of QWidget "focus events" --- note these are events, not signals, so you have to subclass --- or there is QApplication::focusChanged signal which doesn't require subclassing.

      1 Reply Last reply
      0
      • FluentCodingF Offline
        FluentCodingF Offline
        FluentCoding
        wrote on last edited by
        #3

        Yeah, I have already looked for some solutions. As you've said there is the possibility to subclass QWidget to overwrite the focus event or to use the focusXXX signals. I've heard that you can even use an eventfilter. Yeah, I need to try it out, I already forgot what I have tried tbh lol. Thanks for the answer!

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          May I ask why?

          (I smell the stench of setItemWidget)

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          0
          • FluentCodingF Offline
            FluentCodingF Offline
            FluentCoding
            wrote on last edited by
            #5

            Because I want give the user the possibility to unselect his selection and it isn't possible currently, @VRonin.
            Btw @JonB it didn't work :/

            JonBJ VRoninV 2 Replies Last reply
            0
            • FluentCodingF FluentCoding

              Because I want give the user the possibility to unselect his selection and it isn't possible currently, @VRonin.
              Btw @JonB it didn't work :/

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

              @FluentCoding
              What didn't work? If you're not getting a QApplication::focusChanged then you're not managing to change any focus at all.

              1 Reply Last reply
              1
              • FluentCodingF FluentCoding

                Because I want give the user the possibility to unselect his selection and it isn't possible currently, @VRonin.
                Btw @JonB it didn't work :/

                VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #7

                @FluentCoding said in QTableWidget - wanna lose focus when clicking away:

                unselect his selection and it isn't possible currently,

                Crtl+click unselects

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                1 Reply Last reply
                1

                • Login

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