Details
-
Bug
-
Resolution: Invalid
-
P3: Somewhat important
-
4.4.1
-
None
Description
Shift+Insert does not paste like Ctrl+V does in QLineEdit if the shortcut is set in the application's shortcut list. Tested on Linux and Windows on 4.4.
#include <QtGui> class Widget : public QMainWindow { Q_OBJECT public: Widget(QWidget *parent = 0) : QMainWindow(parent) { QList<QKeySequence> shortcutList; shortcutList.push_back(QKeySequence("Ctrl+V")); shortcutList.push_back(QKeySequence("Shift+Insert")); QAction *action = new QAction(this); action->setShortcuts(shortcutList); action->setShortcutContext(Qt::ApplicationShortcut); connect(action, SIGNAL(triggered()), this, SLOT(onActivated())); addAction(action); setCentralWidget(new QPushButton("foobar", this)); QDialog *dialog = new QDialog(this); QVBoxLayout *dLayout = new QVBoxLayout(dialog); dLayout->addWidget(new QLineEdit(dialog)); dialog->show(); } public slots: void onActivated() { qDebug() << "foobar"; } }; #include "main.moc" int main(int argc, char **argv) { QApplication a(argc, argv); Widget w; w.show(); w.setFocus(); return a.exec(); }
Update: QLineEdit accepts the shortcut override for this combination. It might be fixable in Qt, but you can also work around this bug by creating a subclass of QLineEdit, reimplement event(), and call ignore() on the ShortcutOverride event for that combination. Make sure to call the base implementation.