Domanda

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.

È stato utile?

Soluzione

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

QListView {
    outline: 0;
}

Altri suggerimenti

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;
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top