Results 1 to 11 of 11

Thread: ComboBox StyleSheet Help

  1. #1
    Join Date
    Jul 2010
    Posts
    16
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default ComboBox StyleSheet Help

    Hi,

    I'm a bit noob whit stylesheet since I never used before and I can't understand how I can change down-arrow style.

    Please look at attachments to understand.
    The first image is what I have, the second what I would.
    Can someone help me.
    Thanks
    Attached Images Attached Images

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    506
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: ComboBox StyleSheet Help

    Hi, please show us your current style sheet.

    Ginsengelf

  3. #3
    Join Date
    Jul 2010
    Posts
    16
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: ComboBox StyleSheet Help

    At the moment I only have this:

    Qt Code:
    1. QFontComboBox::down-arrow {
    2. image: url(:/buttons/Icons/down_arrow.png);
    3. }
    4.  
    5. border: 1px solid gray;
    6. border-radius: 3px;
    7. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    506
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: ComboBox StyleSheet Help

    Hi, have you tried to use drop-down instead of down-arrow? This should access the whole button, not only the image.

    Ginsengelf

  5. #5
    Join Date
    Jul 2010
    Posts
    16
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: ComboBox StyleSheet Help

    I tried but it replace also the part where the text should be put not only the button.

  6. #6
    Join Date
    Jul 2010
    Posts
    53
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: ComboBox StyleSheet Help

    Quote Originally Posted by ale6111 View Post
    At the moment I only have this:

    Qt Code:
    1. QFontComboBox::down-arrow {
    2. image: url(:/buttons/Icons/down_arrow.png);
    3. }
    4.  
    5. border: 1px solid gray;
    6. border-radius: 3px;
    7. }
    To copy to clipboard, switch view to plain text mode 
    use 'background:' insted of 'image:'

    here example
    Qt Code:
    1. QComboBox::down-arrow {
    2. background: url(:/Resources/mail.png);
    3. };
    To copy to clipboard, switch view to plain text mode 

    or better would be using QComboBox::setIconSize ( const QSize & size ).
    and the best would be reimplementing QComboBox:aintEvent ( QPaintEvent * )
    Last edited by GreenScape; 29th July 2010 at 17:14.

  7. #7
    Join Date
    Jul 2010
    Posts
    16
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: ComboBox StyleSheet Help

    Background doesn't show nothing

  8. #8
    Join Date
    Jul 2010
    Posts
    53
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: ComboBox StyleSheet Help

    Quote Originally Posted by ale6111 View Post
    Background doesn't show nothing
    set desired icon size with QComboBox::setIconSize ( const QSize & size ); before setting your stylesheet for combobox, and be happy.

  9. #9
    Join Date
    Jul 2010
    Posts
    16
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: ComboBox StyleSheet Help

    I solved in this way:
    Qt Code:
    1. border: 1px solid black;
    2. border-radius: 3px;
    3. }
    4.  
    5. QComboBox::drop-down {
    6. width: 32px;
    7. border-top-right-radius: 3px;
    8. border-bottom-right-radius: 3px;
    9. }
    10.  
    11. QComboBox::down-arrow {
    12. image: url(:/buttons/Icons/down_arrow.png);
    13. width: 32;
    14. height: 32;
    15. }
    To copy to clipboard, switch view to plain text mode 

  10. The following user says thank you to ale6111 for this useful post:

    kiss-o-matic (21st March 2011)

  11. #10
    Join Date
    Dec 2010
    Posts
    3
    Qt products
    Qt3
    Platforms
    Symbian S60

    Default Re: ComboBox StyleSheet Help

    Hi All,

    I know this is old thread but my problem is related to Combobox (Qt on Symbian), So I am placing my points here. I have created 1 combo-box in Qt on Symbian S60 5th edition & it is looking fine on N97, Nokia5800 & others. I have ported my application on Nokia N8 device which is new Symbian^3 device, but here the selected item of combo box is not looking proper, you can see the attachment. I am new in Qt, Could you please guide me, how can I fix this issue. I think I have to use custom style-sheet for selected items, but don't know how to do..

    Thanks in advance...
    Shrawan.
    Attached Images Attached Images

  12. #11
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: ComboBox StyleSheet Help

    Hello!

    I'm trying to change width of down-arrow space. Now I have:
    Qt Code:
    1. QComboBox {color: #FFFFFF; background-color:#000000;}
    2. QComboBox::drop-down {border: solid; width: 45px;}
    3. QComboBox::down-arrow {image: url("/downArrow.png"); width: 25px; height: 25px;}
    To copy to clipboard, switch view to plain text mode 

    But the down-arrow space, whatever I do is always very thin. Any idea?

    thanks in advance
    best regards
    Tomasz

Similar Threads

  1. Qtablewidget Combobox
    By aekilic in forum Qt Programming
    Replies: 17
    Last Post: 7th July 2015, 11:22
  2. Help ComboBox
    By vinny gracindo in forum Newbie
    Replies: 3
    Last Post: 20th November 2009, 19:41
  3. ComboBox into String
    By Nefastious in forum Newbie
    Replies: 6
    Last Post: 15th October 2009, 11:50
  4. ComboBox of bmp:s
    By SailinShoes in forum Qt Programming
    Replies: 2
    Last Post: 5th March 2008, 15:22
  5. Color combobox
    By chguy2 in forum Qt Programming
    Replies: 9
    Last Post: 5th April 2007, 14:23

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.