From MainWindow I cretae simple QWidget which has a construct
in the construct i have the code below to call an action on Enter (key), but that does not being called.
ok->setKey(Qt::Key_Enter);
connect(ok, SIGNAL(activated()), this, SLOT(action()));
QShortcut *ok = new QShortcut(this);
ok->setKey(Qt::Key_Enter);
connect(ok, SIGNAL(activated()), this, SLOT(action()));
To copy to clipboard, switch view to plain text mode
in MainWindow:
Dialog *d = new Dialog(this);
d->show();
Dialog *d = new Dialog(this);
d->show();
To copy to clipboard, switch view to plain text mode
Am I doing something wrong, The Dialog should has focus on show() right ? or not ?
when I use:
ok->setKey(QKeySequence::Delete);
To copy to clipboard, switch view to plain text mode
works fine but there is no QKeySequence::Enter ???
Tried also
void Dialog
::keyPressEvent(QKeyEvent * event
)
void Dialog::keyPressEvent(QKeyEvent * event)
To copy to clipboard, switch view to plain text mode
but event->text() returns empty value
Any ideas ??
Bookmarks