Results 1 to 11 of 11

Thread: QPushButton stylesheet problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPushButton stylesheet problem

    To illustrate, this is how a button with input focus looks in case no stylesheet has been set (the upper button has input focus):


  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QPushButton stylesheet problem

    what style do you use? normally I only know a dashed or dotted rectangle as focus. And how does your complete style sheet looks like? May be you have there other settings causing your problem.

    And please add your images at the thread and not at a 3rd party site, so that your post stays consistent also in future.


    Lykurg

  3. #3
    Join Date
    Jul 2007
    Location
    California, USA
    Posts
    62
    Thanks
    17
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QPushButton stylesheet problem

    You can add a pressed and hover state to your style sheet to make it behave as you wish

    QPushButton { ... }
    QPushButtonressed {...}
    QPushButton:hover {...}
    QPushButton:disabled {...}

    You probably want to put in
    color: red;
    background: (whatever color you want)

  4. #4
    Join Date
    May 2006
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPushButton stylesheet problem

    Quote Originally Posted by ntp View Post
    You can add a pressed and hover state to your style sheet to make it behave as you wish

    QPushButton { ... }
    QPushButtonressed {...}
    QPushButton:hover {...}
    QPushButton:disabled {...}

    You probably want to put in
    color: red;
    background: (whatever color you want)
    I may be able to mimick the default QGtkStyle behaviour, but in case the application runs in a different Gnome environment with different theme settings it's look will not be consistent with other applications. So I don't like this approach although it may work.

  5. #5
    Join Date
    May 2006
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPushButton stylesheet problem

    These are the images that were posted above.
    Attached Images Attached Images

  6. #6
    Join Date
    May 2006
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPushButton stylesheet problem

    Quote Originally Posted by Lykurg View Post
    what style do you use? normally I only know a dashed or dotted rectangle as focus. And how does your complete style sheet looks like? May be you have there other settings causing your problem.

    And please add your images at the thread and not at a 3rd party site, so that your post stays consistent also in future.


    Lykurg
    I'm using Gnome, Ubuntu 9.04. If I understand correctly, Qt defaults to QGtkStyle in my case. For the application in the screenshots above, no other stylesheets have been specified anywhere except for the

    Qt Code:
    1. color: red;
    To copy to clipboard, switch view to plain text mode 

    part. So I expect it is buggy behaviour in the QGtkStyle that such a stylesheet causes a complete change in the input focus rectangle appearance. I'll file a bug for this case.

  7. #7
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QPushButton stylesheet problem

    Quote Originally Posted by blukske View Post
    So I expect it is buggy behaviour in the QGtkStyle that such a stylesheet causes a complete change in the input focus rectangle appearance. I'll file a bug for this case.
    Have you tried an other style? The same there?

  8. #8
    Join Date
    May 2006
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPushButton stylesheet problem

    Quote Originally Posted by Lykurg View Post
    Have you tried an other style? The same there?
    Yes, I just tried QCleanlooksStyle and the problem did not occur. I assume now that QGtkStyle is the problem. I just filed a bug and will post the link here as soon as it is accepted.

Similar Threads

  1. Problem with QPrintPreviewWidget
    By nifei in forum Qt Programming
    Replies: 2
    Last Post: 25th March 2012, 01:18
  2. Replies: 1
    Last Post: 23rd April 2009, 09:05
  3. Replies: 19
    Last Post: 3rd April 2009, 23:17
  4. Replies: 1
    Last Post: 7th October 2007, 23:02
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.