You are not logged in.

1

Monday, May 27th 2013, 10:38am

How to remove QPushButton border on focus?

Hi everybody,
I'm trying to remove the QPushButton border showed in the following image:
http://www.qtforum.org/wcf/images/photos…16-b1e2f9e3.png

I've tried all the following settings without any success:


Source code

1
    ui->exitStandByButton->setFlat(true); ui->exitStandByButton->setStyleSheet("border: none"); ui->exitStandByButton->setAutoFillBackground(true);


Any idea?

2

Monday, June 3rd 2013, 10:15am

I've found solution:
set “focusPolicy” = NoFocus from the GUI editor. Bye

3

Monday, September 25th 2017, 4:10pm

I've found solution:
set “focusPolicy” = NoFocus from the GUI editor. Bye
In case anyone will come here through Google or any other search engine. This solution is just a partial one, and does not fix the problem completely. Instead, it introduced another problem.

When setting focus policy to NoFocus, you disallow users to use "Tab" button to focus some control. If this is the expected behavior you would like to have, then go with this one. However, instead it would be advisable to use the following solution:

Source code

1
2
3
#widgetObjectName { /* Object name of your object. */
	outline: 0; /* By setting ouline to zero, you can remove the focus rectangle. */
}


Using this snipped, you can set outline to zero, and then focus rectangle would go away without losing features provided by setting focus policy.