![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
Setting colour of text in QT QLabel
Is there a simple means for setting the colour of text in a QLabel widget? There doesn't seem to be a property for this and the documentation only mentions text colour in the context of displaying small rich text documents.
|
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,208
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Use <span style="color:red">your text</span>
or if you dont want to use rich text label.setStylesheet('QLabel { color: red }') or if you dont want to use stylesheets: pal = QPalette(label.palette()) pal.setColor(QPalette.WindowText, QColor(Qt.red)) label.setPalette(pal) |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
Thanks. I tried the rich text method and it works a treat.
![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Text Colour In Comments Box 7.40 | JayLaFunk | Calibre | 9 | 01-15-2011 03:28 PM |
Colour Kobo ? | PeterT | Kobo Reader | 6 | 11-30-2010 06:38 PM |
Hacks Appeal For Negative Kindle Text Hack/Control/Setting | vugtitan | Amazon Kindle | 20 | 10-04-2010 12:29 PM |
Balloon pop-up text colour | Bob-El | Calibre | 4 | 09-03-2010 04:57 PM |
Colour is on the way | Argel | News | 10 | 10-03-2008 09:36 AM |