0

Why QSpinBox receives focus at pressed Shift + Tab? How to fix? Example:

  1. Create a form as in picture 1.
  2. Set spinBox_2 and pushButton_2 focusPolicy = NoFocus
  3. Start, and try to press Tab several times, and to press Shift+Tab.
  4. We see that spinBox_2 get focus.

OC: windows 10. Qt 5.12.3.

focusPolicy = NoFocus

err

no focus

in *.ui file mainwindow.ui

     <widget class="QSpinBox" name="spinBox_2">
      <property name="focusPolicy">
       <enum>Qt::NoFocus</enum>
      </property>
     </widget>
    </item>
    <item row="1" column="0">
     <widget class="QPushButton" name="pushButton_2">
      <property name="focusPolicy">
       <enum>Qt::NoFocus</enum>
      </property>
      <property name="text">
       <string>PushButton</string>
      </property>
     </widget>
    </item>
Kto To
  • 434
  • 5
  • 11

2 Answers2

1

To answer your question "Why?", it's because it is a bug.

If you have time you can file a bug: https://bugreports.qt.io/

Benjamin T
  • 8,120
  • 20
  • 37
0

Tried to set the tab order to not to letting spinBox_2 selected?

See Qt Designer's Tab Order Editing Mode

xtcuser
  • 7
  • 3