新建成员变量QAction *act;然后在构造函数中:
act = new QAction(QString(tr("Ok")), this);
act->setSoftKeyRole(QAction::NegativeSoftKey);
this->addAction(act);
connect(act, SIGNAL(triggered()), this, SLOT(accept()));
ok,可以使用ok键了。
softkeyrole有以下四种:
NoSoftKey, PositiveSoftKey, NegativeSoftKey, SelectSoftKey
PositiveSoftKey:右键
NegativeSoftKey:左键
SelectSoftKey:中键