Saar Drimer
Saar Drimer

Reputation: 1191

Remove 'selected' highlighting of Qt/PySide widget

I'm using a stylesheet to customise the look of my Qt/Pyside buttons. When I open the application, the first button is 'highlighted' with a coloured overlay (it moves through the GUI elements when I use the arrow keys). I want to remove this highlighting. I tried:

QPushButton, QPushButton:selected { 
  color: rgb(50, 50, 50); 
  background-color: rgba(188, 188, 188, 50); 
  border: 1px solid rgba(188, 188, 188, 250); 
  border-radius: 3px;
} 

but the overlay doesn't go away. I've also tried the most relevant the pseusostates specified here

http://qt-project.org/doc/qt-4.8/stylesheet-reference.html#list-of-pseudo-states

instead of ':selected' but with no luck. How can I get rid of this highlighting?

Upvotes: 0

Views: 3211

Answers (1)

NoDataDumpNoContribution
NoDataDumpNoContribution

Reputation: 10860

As a simple workaround you could disable the focus on all elements you don't want to be highlighted:

QWidget.setFocusPolicy(QtCore.Qt.NoFocus)

Upvotes: 2

Related Questions