Question

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.

Was it helpful?

Solution

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

OTHER TIPS

Maybe also like this way:

ui->treeView->setAttribute(Qt::WA_MacShowFocusRect, 0);

Reference: http://doc.qt.digia.com/4.6/demos-interview-main-cpp.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top