Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent the default blue border being drawn on QLineEdit focus

I am trying to achieve a borderless QLineEdit through CSS. It works fine when the QLineEdit is not in focus but when in focus the default blue border always comes up. The simple CSS I am using:

QLineEdit, QLineEdit:focus { border: none; }

I have tried with different background color through CSS for focus and not-in-focus, it works but I am unable to remove the blue border while in focus. Just to inform, I am working on a Mac.

like image 326
Soumya Das Avatar asked Nov 11 '12 01:11

Soumya Das


1 Answers

You might get rid of the focus border by setting:

QLineEdit.setAttribute(Qt::WA_MacShowFocusRect, 0)

Read the documentation, there are plenty of other Mac specific settings WidgetAttribute-enum

There is rather a similar question too Refer this question

like image 126
warunanc Avatar answered Sep 25 '22 00:09

warunanc