Ok… Since I’m close to getting out of Annie Hell, I was able to take a closer look at the dialog behaviors last night.
Here’s the good news - as I forgot about the formula validation routine - there’s no issue with setting the focus to the 1st text field. Could be a QLineEdit (such as in the Move dialog) or a QPlainText field. For as everytime a formula field gains focus, or the text contents changes, a validation routine is run which if the formula is valid, then the OK button is enabled. In other words, even though another field may be initially set as the focus, the validation routine will still activate the OK and allow one to press Enter to save and exit the dialog.
So @anteater, as per how I described on Github how to set the focus for a given field there should be no issue.
Now we come to the selection / highlighting the text in the text field. Currently the behavior is the place rhe cursor at the end. If we want to have to he option to select the text when focus is gained then heres what I suggest. Modify the CursorToEnd() routine to check a (bool) pref setting whether to select the text or to set the cursor to the end by default. I’d rename the routine to something more descriptive (using lower snake case not upper snake case which should be used for class names). Should be able to use ui->[field name] ->selectAll() to select the text. The highlighting is automatic. This way a user has the choice of cursor at end OR select all text.
In regards to using the Tab in a dialog. This is the behavior in Windows… not sure what it does in Linux or MacOs. When you press Tab, the focus is moved to the next “input” type object / widget. Things like labels and icons are skipped, where text fields, drop downs, spin boxes, tool buttons, etc will gain focus. Also the widget is highlighted… in the case of text boxes line edit or plaintext, the box frame is highlighted (blue). The default behavior is that the text contents is also selected and highlighted. This is the case with lineedits, but do to the CursorToEnd() routine on the plaintextedits, the selection and highting is overridden. Drop downs, spin boxes and tool button will frame either the button or contents with a dashed (black) line… to indicate WHICH object has focus. Tool buttons when highlighted, should execute their action when pressing enter. This is the case with the expansion button, but not the fx button. I don’t know why at this time. The other widgets will execute the OK (as per above with the validation routine) when Enter is pressed - provided text data fields are valid.