[X2Go-Dev] Font colour in x2goclient in case of dark system theme

John A. Sullivan III jsullivan at opensourcedevel.com
Fri Feb 17 18:13:01 CET 2012


On Fri, 2012-02-17 at 16:33 +0100, Milan Knížek wrote:
> Hello,
> 
> the x2goclient has hardcoded light appearance for the various widgets
> (main window, session list, login window, progress of logging in),
> which does not work well with dark system theme: the white font is not
> distinquishable from the background.
> 
> I have checked the Qt documentation and there seems to be more ways
> on how to accomplish that. So far, I have used three various methods:
> 
>   labelname->setStyleSheet("QLabel { color : black; }");
> 
> or
> 
>   cpal.setColor ( QPalette::Text, Qt::black);
> 
> or
> 
>   QString fonttemplate=("<font color='black'>%1</font>");
>   nameLabel->setTextFormat ( Qt::RichText );
>   nameLabel->setText ( fonttemplate.arg( text ) );
> 
> which kind of works, though it requires to be written repeatedly
> throughout the code (sessionbutton.cpp, onmainwindow.cpp,
> onmainwindow_part4.cpp) for individual widgets and so far I am not able
> to use a single approach for all widget types (QLabel, QMenu,
> QPushButton, etc.). The first method seems to be the most general and
> simplest, however.
> 
> Is there a way to set application-wide font colour for anything
> that appears in the widgets, but not in app menu and other windows
> (Settings, Session Settings, etc.), because these are styled with the
> system-wide dark theme?
> 
> Where in the code?
> 
> P.S. Sorry for possibly stupid question, but since I am not a coder, it
> is rather a trial & error approach and a lot of googling...
<snip>
I don't think it is stupid at all.  I have found myself sometimes
frustrated at white text boxes with no borders on white backgrounds
making it almost impossible to see where to click to enter the field.
Thanks for bringing it to the fore - John




More information about the x2go-dev mailing list