View Full Version : shortcut with more than one key

26th January 2007, 06:35
I am trying to create a shortcut that uses a multi-key combination for a widget.

This works:

(void) new QShortcut(Qt::Key_F5, this, SLOT(refresh())); // refresh

This doesnt:

(void) new QShortcut(Qt::Key_Shift + Qt::Key_C, this, SLOT(clear())); // clear
I also tried this, but it does not work either.

(void) new QShortcut(QKeySequence(Qt::Key_Shift + Qt::Key_C), this, SLOT(clear())); // clear

Do i need to override keyPressEvent or is QShortcut capable of handling Shift+C some other way?

Thanks in advance.

26th January 2007, 06:38
i just realized that I should be using Qt::SHIFT instead of Qt::Key_Shift.

This is somewhat confusing. What is the difference between the two?