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. Stylesheet for checkboxes animation
Forum Updated to NodeBB v4.3 + New Features

Stylesheet for checkboxes animation

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 3 Posters 2.0k 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.
  • L Offline
    L Offline
    leinad
    wrote on last edited by
    #1

    Hi,

    I checked but couldn't find an answer or perhaps I didn't look in right place, is there a stylesheet setting if a user hovers the mouse pointer over a check box the border color changes and perhaps also the background color of the actual square changes too?

    Thanks!

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      See https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qcheckbox

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • L Offline
        L Offline
        leinad
        wrote on last edited by
        #3

        May I ask in QtCreator, when I create a form with a checkbox widget, and hover my mouse over the checkbox I get animation (the frame color changes)? I'd like to do the same affect unless in QtCreator it is done in code.

        Christian EhrlicherC 1 Reply Last reply
        0
        • L leinad

          May I ask in QtCreator, when I create a form with a checkbox widget, and hover my mouse over the checkbox I get animation (the frame color changes)? I'd like to do the same affect unless in QtCreator it is done in code.

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @leinad Did you actually read my link? There you can see how you can set another style when hover is active...

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • L Offline
            L Offline
            leinad
            wrote on last edited by
            #5

            You don't understand my question. I'm asking how QtCreator creates the animation when I create a checkbox? I'm not talking about stylesheets. I'm not talking about my app.

            Christian EhrlicherC 1 Reply Last reply
            0
            • L leinad

              You don't understand my question. I'm asking how QtCreator creates the animation when I create a checkbox? I'm not talking about stylesheets. I'm not talking about my app.

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @leinad said in Stylesheet for checkboxes animation:

              creates the animation when I create a checkbox?

              What does this mean?

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • L Offline
                L Offline
                leinad
                wrote on last edited by
                #7
                1. Bring up QtCreator
                2. Create a form
                3. Add a Checkbox to the form.
                4. Hover your mouse over the checkbox. You can see the border change color from black to yellow at least in QtCreator.
                  How does that happen? Does QtCreator have built in stylesheets? Does QtCreater have code to change the border color on hover? I'm curious at how it is done in QtCreator. There is no stylesheet it uses that I am aware of.
                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  I don't see anything except a hover effect on the checkbox which can be modified via stylesheets or a QStyle.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  1 Reply Last reply
                  1
                  • L Offline
                    L Offline
                    leinad
                    wrote on last edited by
                    #9

                    Right, the hover affect is what I mean. So I guess QtCreator must be using a QStyle method? If it was using a stylesheet, I can copy the image and use that but I don't see stylesheets for QtCreator. Does that make sense?

                    1 Reply Last reply
                    0
                    • Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      I don't understand your question. QtCreator is an application made with Qt. So it can use a custom QStyle and stylesheets like any other Qt application.

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      1 Reply Last reply
                      0
                      • L Offline
                        L Offline
                        leinad
                        wrote on last edited by
                        #11

                        Right, but there are no stylesheets that I can see for QtCreator so the mouse hover affect must be done using QStyle and not stylesheets. If it was using a stylesheet I can use the image it calls in my application rather than reinvent the wheel. That is my question.

                        1 Reply Last reply
                        0
                        • Christian EhrlicherC Offline
                          Christian EhrlicherC Offline
                          Christian Ehrlicher
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @leinad said in Stylesheet for checkboxes animation:

                          I can see for QtCreator

                          Where do you want to see it? In the code? I wonder what's so hard to implement the hover stylesheet effect I linked in my first post...

                          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                          Visit the Qt Academy at https://academy.qt.io/catalog

                          1 Reply Last reply
                          0
                          • L Offline
                            L Offline
                            leinad
                            wrote on last edited by
                            #13

                            I'm not saying it is difficult. I'm not interested in doing it in the code. Since I saw it in QtCreator I thought there was a stylesheet that already covers it. Just asking the question. If it doesn't exist I'll have to create my own image and use that.

                            mrjjM 1 Reply Last reply
                            0
                            • L leinad

                              I'm not saying it is difficult. I'm not interested in doing it in the code. Since I saw it in QtCreator I thought there was a stylesheet that already covers it. Just asking the question. If it doesn't exist I'll have to create my own image and use that.

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @leinad
                              Hi
                              QCreator is not using a hidden stylesheet. Its all QStyle doings.

                              1 Reply Last reply
                              1
                              • L Offline
                                L Offline
                                leinad
                                wrote on last edited by
                                #15

                                Ok thanks.

                                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