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 disabled QPushButton under Win XP

Stylesheet for disabled QPushButton under Win XP

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 4.2k 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.
  • P Offline
    P Offline
    PatrickS
    wrote on last edited by PatrickS
    #1

    Hi guys,

    in my Qt 5.5.1 application under Windows XP Home SP3, the QPushButtons got a drop-shadow in disabled style (see screenshots). Any ideas how to get rid of this effect? I would prefer a solution via stylesheet, but any help is greatly appreciated.

    I already found this old thread on quite the same topic, but the suggested solution did not work:
    https://forum.qt.io/topic/20803/stylesheet-for-disabled-qpushbutton-under-windows-7-basic-theme

    My stylesheet code:

    QPushButton {
    	background-color: #999;
    	color: #FFF;
    	border-image: none;
    	border-style: outset;
    	font-weight: bold;
    	font-family: "Arial";
    	font-size: 10pt;
    	min-height: 33px;
    	padding: 0px 10px;
    }
    QPushButton:disabled {
    	background-color: #BBB;
    	color: #D8D8D8; /* reps. #F00 in screenshot 2 */
    }
    

    Screenshot 1:
    https://www.dropbox.com/s/lb9sp0932ujqn0c/WinXP_QPushButton_EnabledDisabled_gray.png?dl=0

    Screenshot 2 (just for clarification):
    https://www.dropbox.com/s/mytpi8ms03esqpv/WinXP_QPushButton_EnabledDisabled_red.png?dl=0

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mostefa
      wrote on last edited by
      #2

      Hi @PatrickS

      Are you sure , that all stylesheet is defined in this piece:

      QPushButton {
      	background-color: #999;
      	color: #FFF;
      	border-image: none;
      	border-style: outset;
      	font-weight: bold;
      }
      QPushButton:disabled {
      	background-color: #BBB;
      	color: #D8D8D8; /* reps. #F00 in screenshot 2 */
      }
      

      Don't you have any other stylesheet code?

      1 Reply Last reply
      0
      • P Offline
        P Offline
        PatrickS
        wrote on last edited by PatrickS
        #3

        Hi @mostefa ,

        thanks for your answer.

        Of course there is much more stylesheet code used in my application, but the problem is reproducable with this snippet. To make the buttons look exactly like on the screenshots, just font-family, font-size, min-height and some padding need to be added (the width is done by a QGridLayout); I've updated the code in my first post accordingly.

        M 1 Reply Last reply
        0
        • P PatrickS

          Hi @mostefa ,

          thanks for your answer.

          Of course there is much more stylesheet code used in my application, but the problem is reproducable with this snippet. To make the buttons look exactly like on the screenshots, just font-family, font-size, min-height and some padding need to be added (the width is done by a QGridLayout); I've updated the code in my first post accordingly.

          M Offline
          M Offline
          mostefa
          wrote on last edited by mostefa
          #4

          @PatrickS said in Stylesheet for disabled QPushButton under Win XP:

          Hi @mostefa ,

          thanks for your answer.

          Of course there is much more stylesheet code used in my application, but the problem is reproducable with this snippet. To make the buttons look exactly like on the screenshots, just font-family, font-size, min-height and some padding need to be added (the width is done by a QGridLayout); I've updated the code in my first post accordingly.

          i have just tested your code in windows7 and linux and i am not having this problem, and i don't have win XP to test :(,

          Can you try to delete (Temporarily) your stylesheet for app , and keep only this part :

          QPushButton {
          	background-color: #999;
          	color: #FFF;
          	border-image: none;
          	border-style: outset;
          	font-weight: bold;
          	font-family: "Arial";
          	font-size: 10pt;
          	min-height: 33px;
          	padding: 0px 10px;
          }
          QPushButton:disabled {
          	background-color: #BBB;
          	color: #D8D8D8; /* reps. #F00 in screenshot 2 */
          }
          

          This kind of effect remember me one similar problem , and this was due to double stylesheet definition in different places, i don't know but this can be the same thing for you?

          1 Reply Last reply
          0
          • P Offline
            P Offline
            PatrickS
            wrote on last edited by PatrickS
            #5

            Thanks for testing! On Windows 10, everything looks fine too, it just seems to be Windows XP causing this problem.
            Some time ago, I had a similar case with borders around QFrames: They need to be set explicitely to "none", otherwise they will be shown by default - but only on Windows XP, on no other OS!

            My current guess is that some sort of Win XP-only default stylesheet is applied here because I missed something in my CSS code...

            Yep I've already tested to reduce the stylesheet on just the snippet, problem persists :-(

            1 Reply Last reply
            0
            • P Offline
              P Offline
              PatrickS
              wrote on last edited by PatrickS
              #6

              Ok I made some progress by myself; the problem doesn't seem to be new:
              http://www.qtcentre.org/threads/36417-disabled-QCheckBox-text-stylesheet-how-to-get-rid-of-change-color-of-etch-effect
              http://www.qtcentre.org/threads/11475-Does-etch-disabled-text-work
              http://stuffnobodytoldmeabout.blogspot.de/2012/05/pesky-etching.html

              But unfortunately, neither the suggested sollution to edit the palette in the C++ code like this:

              QPalette p = QApplication::palette();
              p.setColor(QPalette::Disabled, QPalette::Light, QColor(0, 0, 0, 0));
              QApplication::setPalette(p);
              

              does work for me, nor this ominous stylesheet entry:

              QPushButton:disabled { etch-disabled-text: 0; }
              

              Anyone got another idea?

              Update:
              The color of the text shadow seems to be always about 15% brighter (referred to the RGB values) than the color of the disabled QPushButton's background...

              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