PDA

View Full Version : QShortcut not work!



leeeryan
16th December 2010, 08:18
hello, i want to use a hot key in my widget and i do it like this:


TextEdit::TextEdit(QWidget *parent)
: QsciScintilla(parent)
{
QShortcut *shortCut = new QShortcut(QKeySequence("F1"),this);
connect( shortCut, SIGNAL(activated() ), this, SLOT( wrap_word()) );
}

it not work, can anyone help me?

Thanks.
Ryan Lee

wysota
16th December 2010, 09:27
You are probably creating the shortcut on a wrong widget. The viewport is the widget having focus. At least if your base class follows standard patterns.