Results 1 to 7 of 7

Thread: How to change Text colour in EditText?

  1. #1
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile How to change Text colour in EditText?

    Hi all
    Below i ve pasted my qss file code. I need to change the colour of Text to white in Edit Box. But i cannt figureout where to change.

    So i need ur kind help.

    Thank U All.

    QSS CODE
    ....................

    Qt Code:
    1. background-color: gray;/**********CHANGED beige*/
    2. }
    3.  
    4. /* Nice Windows-XP-style password character. */
    5. QLineEdit[echoMode="2"] {
    6. lineedit-password-character: 9679;
    7. }
    8.  
    9. /* We provide a min-width and min-height for push buttons
    10.   so that they look elegant regardless of the width of the text. */
    11. background-color: gray;/************CHANGED palegoldenrod*/
    12. border-width: 2px;
    13. border-color: darkkhaki;
    14. border-style: solid;
    15. border-radius: 5;
    16. padding: 3px;
    17. min-width: 9ex;
    18. min-height: 2.5ex;
    19. }
    20.  
    21. QPushButton:hover {
    22. background-color: khaki;
    23. }
    24.  
    25. /* Increase the padding, so the text is shifted when the button is
    26.   pressed. */
    27. QPushButton:pressed {
    28. padding-left: 5px;
    29. padding-top: 5px;
    30. background-color: #d0d67c;
    31. }
    32.  
    33. font: bold;
    34. }
    35.  
    36. /* Mark mandatory fields with a brownish color. */
    37. .mandatory {
    38. color: brown;
    39. }
    40.  
    41. /* Bold text on status bar looks awful. */
    42. font: normal;
    43. }
    44.  
    45. QStatusBar::item {
    46. border-width: 1;
    47. border-color: darkkhaki;
    48. border-style: solid;
    49. border-radius: 2;
    50. }
    51.  
    52. background-color: black;/**********CHANGED cornsilk*/
    53. selection-color: #0a214c;
    54. selection-background-color: white;/********CHANGED wheat*/
    55. }
    56.  
    57. /* We reserve 1 pixel space in padding. When we get the focus,
    58.   we kill the padding and enlarge the border. This makes the items
    59.   glow. */
    60. border-width: 2px;
    61. padding: 1px;
    62. border-style: solid;
    63. border-color: darkkhaki;
    64. border-radius: 5px;
    65. }
    66.  
    67. /* As mentioned above, eliminate the padding and increase the border. */
    68. QLineEdit:focus, QFrame:focus {
    69. border-width: 3px;
    70. padding: 0px;
    71. }
    72.  
    73. /* A QLabel is a QFrame ... */
    74. border: none;
    75. padding: 0;
    76. background: none;
    77. }
    78.  
    79. /* A QToolTip is a QLabel ... */
    80. border: 2px solid darkkhaki;
    81. padding: 5px;
    82. border-radius: 3px;
    83. opacity: 200;
    84. }
    85.  
    86. /* Nice to have the background color change when hovered. */
    87. QRadioButton:hover, QCheckBox:hover {
    88. background-color: wheat;
    89. }
    90.  
    91. /* Force the dialog's buttons to follow the Windows guidelines. */
    92. button-layout: 0;
    93. background-color: Gray;/**********ADDED*/
    94. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 6th March 2008 at 06:59. Reason: missing [code] tags
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to change Text colour in EditText?

    J-P Nurmi

  3. #3
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to change Text colour in EditText?

    Hi
    i tried like QTextEdit { selection-background-color: black}. But only background colour is changing. I need to change the text colour to white and background color to black. I could not find How to change the text colour.

    i ll be thankful for ur kind help.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to change Text colour in EditText?

    And what is the name of the property when you follow the link? On the left, in bold.
    J-P Nurmi

  5. #5
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to change Text colour in EditText?

    Quote Originally Posted by jpn View Post
    And what is the name of the property when you follow the link? On the left, in bold.
    selection-background-color* . This i followd.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to change Text colour in EditText?

    Quote Originally Posted by phillip_Qt View Post
    selection-background-color* . This i followd.
    The link I gave does not point there. I gave you a link to property called "color".
    J-P Nurmi

  7. #7
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to change Text colour in EditText?

    Quote Originally Posted by jpn View Post
    The link I gave does not point there. I gave you a link to property called "color".
    Thanx I tried like this color: white ;. and its coming in white colour.
    Thax for ur reply.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Replies: 8
    Last Post: 15th May 2007, 09:21
  3. Can't change the text display of a QTreeview item.
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 2nd June 2006, 01:03
  4. Change the text color tab page
    By gtthang in forum Qt Programming
    Replies: 4
    Last Post: 18th February 2006, 17:38
  5. Change colour of QString
    By Morea in forum Newbie
    Replies: 9
    Last Post: 10th February 2006, 22:31

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.