Skip to content

FormLayout: Activate buddy with ShortcutFocusReason

Kai Uwe Broulik requested to merge work/kbroulik/formlayout-open-popup into master

Just calling forceActiveFocus sets OtherFocusReason. Particularly ComboBox behavior differs between how it got focus, cf qquickcombobox:

// Setting focus on TextField should not be done when drop down indicator was clicked // That is why, if focus is not set with key reason, it should not be passed to textEdit by default. // Focus on Edit Text should be set only intentionally by user.

Using ShortcutFocusReason (which is what did here after all) ensures the ComboBox itself properly gets focus, bringing it in line with behavior of how the Qt Widget world behaves.


Screenshot_20241230_121832

Pressed mnemonic for color accuracy, ComboBox was properly highlighted and I could press Space to open the popup

(Note that KScreen doesn’t have mnemonics on most controls right now but a fix for that is coming up next)

I didn’t find when forceActiveFocus with reason got added so I assume it’s in Qt 6.0. Edit: Oh wow, that’s been in there since Qt 5.1?!

Edited by Kai Uwe Broulik

Merge request reports

Loading