Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get rid of Qt's dotted outline on QListView items

I'm trying to remove the dotted border on the text in this QListView::item using stylesheets:

QListView with dotted outline shown on selected item

I've tried variations of border: 0 and show-decoration-selected: 0 on QListView, QListView::item and QListView::item::text to no effect.

I'm using PyQt, but I believe the stylesheet rules are the same as in the C++ libraries.

like image 776
Ross Avatar asked Apr 05 '13 09:04

Ross


2 Answers

After some more testing, I found that the following stylesheet works:

QListView {
    outline: 0;
}
like image 102
Ross Avatar answered Oct 09 '22 00:10

Ross


Setting "outline: 0;" in the stylesheet doesn't work for me (anymore?). The only solution I could find was to set the ListView's FocusPolicy to "Qt::NoFocus", which comes with obvious drawbacks.

like image 4
i know nothing Avatar answered Oct 08 '22 23:10

i know nothing