CTRL+X/C/V/A for custom widgets
I'd like to assign cut, copy, paste and select all shortcuts to a QGraphicsView widget.
If I do this using menus (which is how I'd like to) and assign each action with its corresponding shortcut, I override shortcuts for all other widget ( QTextEdit, QLineEdit ...).
How can I solve this?
If possible, I'd like to have this actions listed in QMenu with shortcuts.
I also looked over an alternative, overriding QGraphicsView::keyPressEvent, and may question is, is Qt::key_Copy for ctrl+c?
Thanks in advance.
It works with default widgets. It does not work with inherited QTextEdit and overridden keyPressEvent();
@void ConsoleOutput::keyPressEvent(QKeyEvent *e)
myFirstInput = false;
myOrg = this->toPlainText();
myLen = this->toPlainText().length();
else if(e->key() == Qt::Key_Backspace)
if(toPlainText().size() < myLen)
else if(toPlainText()[(toPlainText().size()-1)] == '\n')
I pinpointed the problem.
It's because I set widget to read only. If I do not, it works as it should.
In my opinion it's a bug. Can someone confirm this? Ctrl + a and ctrl + c should work even if it's read only, since data is not changed.