Why is Qt::ShiftModifier important? Wouldn't it be better to use the actual modifiers for the event? I.e.
Qt Code:
event->keyboardModifiers() // instead of Qt::ShiftModifierTo copy to clipboard, switch view to plain text mode
Why is Qt::ShiftModifier important? Wouldn't it be better to use the actual modifiers for the event? I.e.
Qt Code:
event->keyboardModifiers() // instead of Qt::ShiftModifierTo copy to clipboard, switch view to plain text mode
Last edited by jacek; 18th February 2007 at 12:04. Reason: wrapped too long line
It's important because the inner QTextControl ends up using QDropEvent::proposedAction(). The proposed action is determined by a private Qt class called QDragManager according to the modifiers (QDragManager::defaultAction() in src/gui/kernel/qdnd.cpp). I found all this out by simply debugging through the dropEvent() code.
J-P Nurmi
KjellKod (18th February 2007)
I see what you mean - the shift modifier makes it into cut-n-paste rather than copy-n-paste
I've been a bit hesitant to look at Qt's code but I see now that when encountering problems like this that's definitely worthwhile![]()
Thanks again J-P.![]()
Yep, exactly.
Please don't hesitate to do so, it's definitely the most powerful way to find out why something works like it does.I've been a bit hesitant to look at Qt's code but I see now that when encountering problems like this that's definitely worthwhile![]()
The sources throughout Qt are pretty clean and understandable. However, one confusing thing when looking into the sources of Qt for the first time might be the usage of Pimpl. Whether it's a new concept or not, one gets quickly used to the way it's used in Qt.
No problem at all, happy hacking with Qt!Thanks again J-P.![]()
J-P Nurmi
Bookmarks