1 year ago

#370771

test-img

Dennis

Adjust width of Focus Rectangle around QLineEdit on Mac

When a QLineEdit has focus on a Mac, the Mac automatically puts what seems like a 3px-4px wide Focus Rectangle around it. I read Qt4 Stylesheets and Focus Rect but I only want to adjust the width of the Focus Rectangle (to maybe 1px-2 px), not remove it.

enter image description here

using a for loop for all of my widgets, I also tried

if isinstance(widget, QLineEdit):
   widget.setAttribute(QtCore.Qt.WA_MacShowFocusRect, 1)

thinking that the "1" would set the width of the rectangle to 1px, but the code did nothing (my syntax may also be wrong).

Is it possible to set the width in pixels of the focus rectangle on a Mac.

pyqt5

macos-catalina

0 Answers

Your Answer

Accepted video resources