Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-3385

Shift+Insert in QLineEdit

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Invalid
    • Affects Version/s: 4.4.1
    • Fix Version/s: Some future release
    • Component/s: Core: Event loop
    • Labels:
      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.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              waterdomain Water Domain (Inactive)
              Reporter:
              mch Jervey Kong
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes