Question

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.

Was it helpful?

Solution

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

QListView {
    outline: 0;
}

OTHER TIPS

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.

Setting the border to none seems to have done the trick for me.

QListView::item { 
    border: none;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top