[Qt-interest] QPlainTextEdit Ctrl+K shortcut under Windows
Roland Krause
rokrau at yahoo.com
Tue Jan 12 22:36:03 CET 2010
Well, I hate to have to reply to my own post but I dug into the issue a bit and was wondering whether there is
a clean way to change the standard QKeyBindings for QKeySequence::DeleteEndOfLine to get "Ctrl+K" to delete to the end of the line under Windows, i.e. short of changing the source code in the Qt libraries "qkeysequence.cpp" file.
QKeySequence allows access to a QKeySequencePrivate * via its public data_ptr() function but accessing that is no
good because one has to include qkeysequence_p.h which is as I understand a "no no". And when I try it anyway I end up with two unresolved symbols: QKeySequencePrivate::keyBindings and QKeySequencePrivate::numbderOfkeyBindings which as I understand result from the declaration of the QKeySequencePrivate class at build time of the Qt library.
Does anybody have a suggestion what to try now?
I'd be greatful for any ideas.
Thanks,
Roland
----- Original Message ----
> From: Roland Krause <rokrau at yahoo.com>
> To: qt-interest at trolltech.com
> Sent: Mon, January 4, 2010 11:44:05 AM
> Subject: [Qt-interest] QPlainTextEdit Ctrl+K shortcut under Windows
>
> I understand that the Ctrl+K shortcut has been removed under Windows sometime
> since Qt-4.5.x .
>
> What is the easiest way to re-add it? I understand that there is a QKeySequence
> class that defines a
> StandardKey (Ctrl+K) for DeleteEndOfLine for Linux but not for Linux or MacOSX.
>
> On the other hand there is no slot or function that is callable for
> QPlainTextEdit or QTextCursor that can be
> connected to a custom QAction. The implementation of QPlainTextEdit uses its
> event filter to implement
> DeleteEndOfLine.
>
> What do I need to do, create a QShortCut(QKeySequence::DeleteEndOfLine,parent)
> and call setKey("Ctrl+K") on it?
>
> Could someone please enlighten me a bit as to what I need to so that "Ctrl+K"
> deletes the end of the current line under
> Windows. (-: Short of reimplementing the whole thing please :-)
>
> Thanks
> Roland
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list