Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPushbutton
Qt 6.12 LTS is out! See what's new in the release blog

QPushbutton

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 4 Posters 1.8k 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.
  • S Offline
    S Offline
    satyanarayana143
    wrote on last edited by
    #1

    Hi friends,

    I want to display color flashing for QPushbutton can anybody give example code to solve this problem.

    jsulmJ 1 Reply Last reply
    0
    • S satyanarayana143

      Hi friends,

      I want to display color flashing for QPushbutton can anybody give example code to solve this problem.

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

      @satyanarayana143 said in QPushbutton:

      color flashing

      Do you mean an animation? Check this: https://doc.qt.io/qt-5/animation.html

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

      1 Reply Last reply
      0
      • S Offline
        S Offline
        satyanarayana143
        wrote on last edited by
        #3

        while playing audio by clicking Qpushbutton untill playing it should blink .

        jsulmJ 1 Reply Last reply
        0
        • S satyanarayana143

          while playing audio by clicking Qpushbutton untill playing it should blink .

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

          @satyanarayana143 Check the link I provided...

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

          JonBJ 1 Reply Last reply
          1
          • jsulmJ jsulm

            @satyanarayana143 Check the link I provided...

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

            @jsulm
            I didn't know about this class. I have widgets (FWIW, QSpinBoxes) which I want to flash for a few seconds, when their value changes, and then stop. Sometimes many of them flash simultaneously. I implemented this via my own QTimer (just one instance of that) code.

            Am I missing out on anything? I like to keep the application "lightweight", so don't have any need to call QAnimation stuff.

            S jsulmJ 3 Replies Last reply
            0
            • JonBJ JonB

              @jsulm
              I didn't know about this class. I have widgets (FWIW, QSpinBoxes) which I want to flash for a few seconds, when their value changes, and then stop. Sometimes many of them flash simultaneously. I implemented this via my own QTimer (just one instance of that) code.

              Am I missing out on anything? I like to keep the application "lightweight", so don't have any need to call QAnimation stuff.

              S Offline
              S Offline
              satyanarayana143
              wrote on last edited by
              #6

              @JonB

              some example code

              JonBJ 1 Reply Last reply
              0
              • JonBJ JonB

                @jsulm
                I didn't know about this class. I have widgets (FWIW, QSpinBoxes) which I want to flash for a few seconds, when their value changes, and then stop. Sometimes many of them flash simultaneously. I implemented this via my own QTimer (just one instance of that) code.

                Am I missing out on anything? I like to keep the application "lightweight", so don't have any need to call QAnimation stuff.

                S Offline
                S Offline
                satyanarayana143
                wrote on last edited by
                #7

                @JonB

                for Qpushbutton i had set color green it should blink untill i stop for button any example code

                1 Reply Last reply
                0
                • S satyanarayana143

                  @JonB

                  some example code

                  JonBJ Online
                  JonBJ Online
                  JonB
                  wrote on last edited by JonB
                  #8

                  @satyanarayana143
                  Why do you want example code? It would be quite a bit. I maintain a list of all widgets I wish to flash, to which I add & remove. I have a single QTimer. On elapsation I go through the list toggling the flash state, or removing items if they have flashed enough times. Flashing color is achieved by toggling the alpha state on widget->setPalette().

                  Oh, maybe you mean you example code of mine to give to you? Wait until @jsulm answers me. But if you are writing from scratch, unlike me, you should probably follow the link he gave you and do yours via animation instead.

                  1 Reply Last reply
                  0
                  • JonBJ JonB

                    @jsulm
                    I didn't know about this class. I have widgets (FWIW, QSpinBoxes) which I want to flash for a few seconds, when their value changes, and then stop. Sometimes many of them flash simultaneously. I implemented this via my own QTimer (just one instance of that) code.

                    Am I missing out on anything? I like to keep the application "lightweight", so don't have any need to call QAnimation stuff.

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

                    @JonB Nothing wrong with your approach. But I think these animation classes can be quite handy.

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

                    1 Reply Last reply
                    3
                    • J.HilkJ Offline
                      J.HilkJ Offline
                      J.Hilk
                      Moderators
                      wrote on last edited by
                      #10

                      I answered this previously, with an examlple for QFrame as base class here:
                      https://forum.qt.io/topic/96728/change-button-color/3

                      You should be able to adjust it for QPushButton.


                      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
                      2

                      • Login

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