[Development] [SPAM] Re: QDialog vs QPushButton and it's autoDefault default

Bernhard Lindner private at bernhard-lindner.de
Tue Feb 19 22:31:42 CET 2019


> Did you try to accept the Enter in your line edit instead? That way, it 
> would not propagate up. You could simply eat it or make it focus the 
> next item in the focus chain or something that makes sense in your context.

I thought about that. But it means a workaround out of position. What about line edits in 
delegates? Or in editable comboboxes, etc.? This can get nasty. Some kind of dialog-global 
option would be necessary.

I did a lot of research and found several people having the same issue with the current
implementation. Alas I could not find a clean way to solve it. 

So as a workound I finally changed the significantly complex dialog .ui files from QDialog
to QWidget, introduced a custom base class, threw away the QDialogButtonBoxes and added
the dialog buttons as normal buttons in a separate layout. This way the standardized
dialog behaviour and design is down the drain but for non-trivial dialogs this is much
better than frustrating users using <Enter> by accident.

A new option to disable the autoDefault feature for entire dialogs would be very helpful.
I considered writing a corresponding suggestion but I guess it would rot in the issue
tracker forever.

-- 
Best Regards, 
Bernhard Lindner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190219/015df2c4/attachment.sig>


More information about the Development mailing list