Qt question: hard-coded shortcuts

Posted by miLo on Programmers See other posts from Programmers or by miLo
Published on 2012-11-12T19:05:03Z Indexed on 2012/11/12 23:13 UTC
Read the original article Hit count: 369

Filed under:
|

I have asked this question on several places but I still can't figure it out. What I am trying to do is to have a QKeySequence(Qt::CTRL + Qt::Key_X, Qt::CTRL + Qt::Key_C) in a MainWindow with QTextEdit as a central widget. The problem is that I have a shorcut for Cut(Ctrl+X) and when I press Ctrl+X,Ctrl+C it doesn't work. When the focus is on diffrent widget the shorcut works perfectly. I tried with overriding the QWidget::keyPressEvent and QWidget::event but it is the same. I have one more question: if I have these two shorcuts Ctrl+X and Ctrl+XCtrl+C why I don't receive the signal activatedAmbigiously() when I press Ctrl+X? According to the Qt documentation

When a key sequence is being typed at the keyboard, it is said to be ambiguous as long as it matches the start of more than one shortcut.

© Programmers or respective owner

Related posts about c++

Related posts about qt