Results 1 to 4 of 4

Thread: [Qt 4.3.1]A problem with combobox style

  1. #1
    Join Date
    Feb 2007
    Location
    Russia, Novosibirsk
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default [Qt 4.3.1]A problem with combobox style

    For my application I use Cleanlooks style.
    And I have one problem with it: making combobox uneditable changes its color to gray and up-down arrow to down arrow.
    My chief don't like such behaviour and I want to make uneditable combobox looks like editable (i.e. I want to set combobox stylesheet to 'QComboBox::!editable {QComboBox::editable}'). How can I do it in most simple way? I don't want to inherit combobox to change its behaviour, I hope that there is more simple way.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [Qt 4.3.1]A problem with combobox style

    Modify the style. It should be as easy as reimplementing a single method (QStyle::drawComplexControl) and changing the behaviour for drawing a disabled combobox.

  3. #3
    Join Date
    Feb 2007
    Location
    Russia, Novosibirsk
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [Qt 4.3.1]A problem with combobox style

    I should wrote my own style inheriting QStyle and reimplementing drawComplexControl and set my combobox style to the style. Do i understand you correctly?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [Qt 4.3.1]A problem with combobox style

    Inherit the cleanlooks style (not QStyle) and reimplement drawComplexControl. Then set your application's style to the new style (it will have all features of Cleanlooks with that only difference that disabled comboboxes will be rendered like active ones).

Similar Threads

  1. QToolBox qss style sheet problem
    By eskil in forum Qt Programming
    Replies: 1
    Last Post: 17th August 2007, 17:45
  2. Problem with a combobox
    By Tindor in forum Qt Programming
    Replies: 2
    Last Post: 22nd November 2006, 19:18

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.