linuxmint / cinnamon

A Linux desktop featuring a traditional layout, built from modern technology and introducing brand new innovative features.
GNU General Public License v2.0
4.57k stars 744 forks source link

Selected text lines in Qt applications becoming white after loosing focus #11434

Open florisvdh opened 1 year ago

florisvdh commented 1 year ago

Issue

In some Qt applications, e.g. QGit and QGIS, line selections in one panel become white (hence not readable) when focus is brought to another panel (in the same application window). I could easily reproduce this in a live session of Mint 21.1, see below.

Steps to reproduce

Below can be reproduced in a live session of Mint 21.1, taking QGit as an example, but I expect other Qt applications with multiple interdependent panels to suffer too (confirmed for QGIS).

  1. apt install qgit
  2. Open QGit, click Ctrl+O and select a folder that is a git repository, and click Choose. Accept the proposed default in the window that follows. Now you get to the main window with the commit history displayed.
  3. Select one commit. For example it looks like this:

Screenshot from 2023-01-17 07-40-48

  1. Now click a line in the bottom right window. See what happens in the top panel (screenshot below): the black text as well as the selection background becomes white; this is true for all columns. The decorations (coloured boxes) in this specific case (line) still remain.

Screenshot from 2023-01-17 07-41-11

Repeating the same for another line:

Screenshot from 2023-01-17 07-41-21

Expected behaviour

Selected text and the selection background should never disappear when a panel looses its focus.

Other information

The issue did not exist in Linux Mint 20 and before, it appeared since I freshly installed Linux Mint 21.

mtwebster commented 1 year ago

As a workaround until we can figure this out you can change the 'style' selector in the qt5 configuration tool to use a neutral color theme. (maybe you know this already)

Thanks

florisvdh commented 1 year ago

OK thanks, the workaround works! (I wasn't aware of it)

bongochong commented 1 year ago

Thought I was going crazy, but then I found this issue report. The problem also affects selected items in Qt list views and tree views by the way. This seems to happen in all Qt5 applications when set to use the GTK style. A work-around I've found for list and tree views is to make and apply a QSS style sheet in qt5ct that matches your current theme (one can use Gpick or a similar tool to quickly get the RGB value for selected items). This is mine right now: QTreeView::item:selected { background: rgb(146, 179, 114); } I have yet to figure out a work-around which matches up nicely with GTK for the text highlighting issue, but this makes the bug less noticeable.

bongochong commented 1 year ago

Just updating for anyone interested, but I was able to mash together a more comprehensive fix that matches the theme I'm currently using with Cinnamon. Some Qt5 applications still exhibit the issue, but a good number are fixed and it's a lot more tolerable now. Remember that you must replace the colors in the QSS stylesheet with one that matches your theme. Anyway, the following has helped me out a lot: QTreeView::item:selected { background: rgb(146, 179, 114); } QListView::item:selected { background: rgb(146, 179, 114); } QLineEdit { selection-background-color: #92B372; } QTextEdit { selection-background-color: #92B372; } QTableView { selection-background-color: #92B372; }