[PyQt] QLineEdit vs. menu keyboard shortcuts
Baz Walter
bazwal at ftml.net
Wed Jun 29 23:16:23 BST 2011
On 29/06/11 18:57, Nathan Weston wrote:
> On 6/29/2011 1:32 PM, Baz Walter wrote:
>> going back to your earlier example of dragging in the line-edit to
>> change its value: all you need to do is clearFocus() when the drag
>> starts and setFocus() when the drag ends. that way, whilst the drag is
>> in progress, the line-edit's shortcuts won't work, but your global
>> shortcuts will.
>>
>> if that's not what you want, please try to make it clear what you do
>> want (i.e. with a working example).
[snip]
> Now, when the widget is in its non-editable state, and the user hits
> Ctrl-Z, I want it to trigger the Undo action on the Edit menu.
> Unfortunately, QLineEdit intercepts the Ctrl-Z keystroke and does
> nothing (because it's not editable).
the example you posted earlier works (i.e. Ctrl+Z prints 'action') if
the Foo widget has been set as read-only.
(nb: the setShortcutContext line also needs to be commented out)
> I can't call clearFocus() at the end of the drag, because this would
> break the Up/Down arrow shortcuts.
call clearFocus() at the *start* of the drag, setFocus() at the *end*.
More information about the PyQt
mailing list