1

I have a QToolButton

QToolButton* button = new QToolButton();
button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
button->setFocusPolicy(Qt::StrongFocus);
button->setIcon(myIcon);
button->setText("Test");

I want it to have dotted focus rect around it when doing tab focus but it does not show . By default it should show the focus rect but it does not .Does anyone know how to do it?

Rubina
  • 123
  • 1
  • 17
  • I tested your code and it does show focus rect. Maybe you should check other part of your code. Did you add some stylesheet to change it or other actions? – Bobur Jul 03 '18 at 00:36
  • I added background color and border to none in stylesheets – Rubina Jul 03 '18 at 02:47
  • Because of that stylesheets, you are experiencing this behavior of `button`. Take a look at https://stackoverflow.com/questions/17280056/qt-css-decoration-on-focus – Bobur Jul 03 '18 at 07:49
  • I tried setting outline to QToolButton:focus but it did not work – Rubina Jul 08 '18 at 23:36

0 Answers0