Results 1 to 4 of 4

Thread: QSS, trying to make the text on the combo box WHITE not black.

  1. #1
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Default QSS, trying to make the text on the combo box WHITE not black.

    hi guys, I've spent HOURS trying ot figure this out and no luck.

    Basically I want the combo boxe's font color to be white.
    Currently when the user clicks the combo box all the drop down items font color will be WHITE which is correct.
    But once they select the item they want, the drop down will dissapear and the item will be in the combobox but it will be black.

    So drop down works, but when its not in drop down mode the font color is black which I'm trying to make white.

    Here is the QSS I'm using:

    Qt Code:
    1. myWidget QComboBox
    2. {
    3.  
    4.  
    5. selection-color: rgb(255, 255, 255);
    6.  
    7. color: rgb(255, 255, 255);
    8. background-color: rgb(0, 28, 53);
    9.  
    10.  
    11. font: 18pt "Arial";
    12. border: 1px black;
    13. border-image: url(:/Resources/down.png) 10 10 10 10;
    14.  
    15. }
    16.  
    17. myWidget QComboBox:on
    18. { /*shift the text when the popup opens */
    19. selection-background-color: rgb(108, 149, 59);
    20. color: rgb(255, 255, 255);
    21. }
    22.  
    23. myWidget QComboBox:!on
    24. { /* shift the text when the popup opens */
    25. selection-background-color: rgb(108, 149, 59);
    26. color: rgb(255, 255, 255);
    27. }
    28.  
    29. {
    30. background-color: rgb(0, 28, 53);
    31. }
    To copy to clipboard, switch view to plain text mode 


    I also had a image I wnated to use instead of using the standard icon for the down arrow on the combo box but for some reason that isn't showing up either.
    Any help would be great.

  2. #2
    Join Date
    May 2010
    Posts
    61
    Thanks
    2
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QSS, trying to make the text on the combo box WHITE not black.

    Hi technoViking,

    Instead of the "myWidget QComboBox" syntax try using "QComboBox#myWidget".
    I have just created a test widget an i believe the result is the one you are expecting.

    Please see the attached screenshot.

    Regards,
    Wladek.


    Here is the complete QSS code:

    QComboBox#myWidget
    {
    selection-color: rgb(255, 255, 255);
    color: rgb(255, 255, 255);
    background-color: rgb(0, 28, 53);
    font: 18pt "Arial";
    border: 1px black;
    border-image: url(:/Resources/down.png) 10 10 10 10;

    }

    QComboBox#myWidgetn
    { /*shift the text when the popup opens */
    selection-background-color: rgb(108, 149, 59);
    color: rgb(255, 255, 255);
    }

    QComboBox#myWidget :!on
    { /* shift the text when the popup opens */
    selection-background-color: rgb(108, 149, 59);
    color: rgb(255, 255, 255);
    }

    QComboBox QListView
    {
    background-color: rgb(0, 28, 53);
    }
    Attached Images Attached Images
    Last edited by wladek; 21st June 2010 at 23:45. Reason: updated contents

  3. #3
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Default Re: QSS, trying to make the text on the combo box WHITE not black.

    Awesome thanks, when you select one of the items and its the only thing showing in the combo box (no drop down), is the text white or black?

    I'm still having issues

  4. #4
    Join Date
    May 2010
    Posts
    61
    Thanks
    2
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QSS, trying to make the text on the combo box WHITE not black.

    Hi,

    The text is always white for me.
    Please post some screenshots and the exact qss code you are using.

    Regards,
    Wladek.

    Quote Originally Posted by technoViking View Post
    Awesome thanks, when you select one of the items and its the only thing showing in the combo box (no drop down), is the text white or black?

    I'm still having issues

Similar Threads

  1. Image conversion black and white
    By offline in forum Qt Programming
    Replies: 1
    Last Post: 25th March 2010, 01:21
  2. İmage Convert Black and White
    By offline in forum Qt Programming
    Replies: 1
    Last Post: 8th March 2010, 05:08
  3. Displaying Text on Black and White Screen
    By Stobie in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 8th December 2009, 01:03
  4. How to make a QString text underlined?
    By blonde in forum Newbie
    Replies: 5
    Last Post: 29th October 2009, 08:19
  5. Printing plot black & white
    By maybe78 in forum Qwt
    Replies: 4
    Last Post: 9th October 2009, 07:39

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.