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. Blinking background
Qt 6.11 is out! See what's new in the release blog

Blinking background

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 3 Posters 6.0k Views 3 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.
  • C Corvette653

    I recorded it by my phone, I can't insert video here, so it's link to my google drive:
    video

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

    @Corvette653
    Ok that looks indeed odd.

    • Is it possible, that my computer/screen is the reason?
      well it would have to be a really, really old flat screen for it to be the redraw time.

    I can see you have multiply MyWidets on screen.

    I only tried one. let me see with more.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #7

      Hi
      Nope even with your new test code
      and full screen window size i dont get that effect.

      Could you try

          label1->setAutoFillBackground(false);
          label2->setAutoFillBackground(false);
          label3->setAutoFillBackground(false);
      

      inside myWidget ?
      Should be off but just to be sure.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Corvette653
        wrote on last edited by Corvette653
        #8

        @mrjj, I don't know how it was set originally, but adding "setAutoFillBackground" changes nothing :/
        Edit: I ran this app on another computer and it's visible there too.

        mrjjM 1 Reply Last reply
        0
        • C Corvette653

          @mrjj, I don't know how it was set originally, but adding "setAutoFillBackground" changes nothing :/
          Edit: I ran this app on another computer and it's visible there too.

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

          @Corvette653
          Hi
          Ok, was the only thing i could think of.

          Im not sure what you see.
          If you move mouse more slowly, does it also happen ?

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Corvette653
            wrote on last edited by
            #10

            @mrjj
            Me neither.
            When I move mouse very slow, everything is alright.
            How often is it checked if mouse is over widget?
            Is it possible that it happens when I move mouse: label -> out of widget,
            but if I move: margin -> out of widget, everything is ok?

            widget_with_margins.png

            mrjjM 1 Reply Last reply
            0
            • C Corvette653

              @mrjj
              Me neither.
              When I move mouse very slow, everything is alright.
              How often is it checked if mouse is over widget?
              Is it possible that it happens when I move mouse: label -> out of widget,
              but if I move: margin -> out of widget, everything is ok?

              widget_with_margins.png

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

              @Corvette653
              Hi
              I think on every mouse move event as to check its still over it.
              Well both the main Widget and the Labels are affected by your stylesheet but
              Labels are transparent so not sure it would do so much.

              But yes from the video , it does seem related to the labels background as the
              white ghost thing seems to be where the labels are.

              1 Reply Last reply
              0
              • C Offline
                C Offline
                Corvette653
                wrote on last edited by
                #12

                :/ It's strange, I wanted to change font color, of the whole widget(3 labels), but it doesn't work in the way I want

                setStyleSheet(":hover{background-color: red; color: white;}");
                
                mrjjM 1 Reply Last reply
                0
                • C Corvette653

                  :/ It's strange, I wanted to change font color, of the whole widget(3 labels), but it doesn't work in the way I want

                  setStyleSheet(":hover{background-color: red; color: white;}");
                  
                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #13

                  Hi
                  What happens ?

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Corvette653
                    wrote on last edited by Corvette653
                    #14

                    widget.png

                    Only label I directly hover has the white text, I want the whole widget to has.
                    Background color is set in the same line, but works good (except that strange white ghosts which I have already ignored)

                    mrjjM 1 Reply Last reply
                    0
                    • C Corvette653

                      widget.png

                      Only label I directly hover has the white text, I want the whole widget to has.
                      Background color is set in the same line, but works good (except that strange white ghosts which I have already ignored)

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

                      @Corvette653
                      Well that is kinda to be expected as only one widget is actually "hovered" at a given time.
                      You do see the red all over as labels are transparent so we see the master widget in red under it.

                      You could add the function to class MyWidget : public QWidget

                      to handle hover directly and in there then set style sheet to master widget to turn red and
                      then set style sheet to each label to turn white at same time.

                      in ctor
                      this->setAttribute(Qt::WA_HOVER, true);
                      
                      void MyWidget ::enterEvent(QEvent * event)
                      {
                          // set style sheet
                          QWidget::enterEvent(event);
                      }
                      
                      void MyWidget ::leaveEvent(QEvent * event)
                      {
                          // other style sheet to return to nomral color for text
                          QWidget::leaveEvent(event);
                      }
                      

                      https://stackoverflow.com/questions/411823/how-do-i-implement-qhoverevent-in-qt

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        Corvette653
                        wrote on last edited by
                        #16

                        @mrjj
                        Maybe it's not exactly answear to first question, but it resolves that.
                        I moved bckground-color to those functions and it works correctly

                        mrjjM 1 Reply Last reply
                        0
                        • C Corvette653

                          @mrjj
                          Maybe it's not exactly answear to first question, but it resolves that.
                          I moved bckground-color to those functions and it works correctly

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

                          @Corvette653
                          Hi
                          well it's not really possible to hover more than one widget at a time so
                          pure style sheet would not be able to make all labels use white on hover.

                          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