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. QToolButton remains highlighted after press.

QToolButton remains highlighted after press.

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 1.6k 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
    Ayush Gupta
    wrote on last edited by
    #1

    I have added one tool button in tool bar. When I press the button and then some action is called like( select a file from open dialog box) after I click cancel button on Open Dialog box . Tht QToolButton still remains highlighted.

    This seems to happen when I try to open the file dialog box to select a file to open or save.

    Please let me know how can i fix this.

    J.HilkJ 1 Reply Last reply
    0
    • A Ayush Gupta

      I have added one tool button in tool bar. When I press the button and then some action is called like( select a file from open dialog box) after I click cancel button on Open Dialog box . Tht QToolButton still remains highlighted.

      This seems to happen when I try to open the file dialog box to select a file to open or save.

      Please let me know how can i fix this.

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      Hi, @Ayush-Gupta

      that's a common enough issue.

      The Button is still highlighted, because it has still the active focus of the application.

      Either force the focus on an other item, or define the stylesheet int such a way that the highlight is removed. That would be "outline:none;"


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Ayush Gupta
        wrote on last edited by Ayush Gupta
        #3

        @J-Hilk
        How can I do through style sheet can you please provide me the code

        J.HilkJ 1 Reply Last reply
        0
        • A Ayush Gupta

          @J-Hilk
          How can I do through style sheet can you please provide me the code

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @Ayush-Gupta I did

          myToolButton->setStyleSheet("outline:none;");
          

          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Ayush Gupta
            wrote on last edited by
            #5

            @J.Hilk said in QToolButton remains highlighted after press.:

            "outline:none;"

            This does not works for me :(

            jsulmJ 1 Reply Last reply
            0
            • A Ayush Gupta

              @J.Hilk said in QToolButton remains highlighted after press.:

              "outline:none;"

              This does not works for me :(

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Ayush-Gupta said in QToolButton remains highlighted after press.:

              This does not works for me

              In what way? Does not compile? Does not change the behaviour?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Ayush Gupta
                wrote on last edited by Ayush Gupta
                #7

                @jsulm It does not change behaviour

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  Sam Thomsen
                  wrote on last edited by
                  #8

                  I had the same problem. Changing the QToolButton connection event from "pressed" to "clicked" solved it for me. Apparently, displaying another window in response to "pressed" cut short the button's view state handling.

                  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