我正在粘贴代码片段:http://qt-project.org/doc/qt-5.0/qtwidgets/mainwindows-menus.html
void MainWindow::createActions()
{
newAct = new QAction(tr("&New"), this);
newAct->setShortcuts(QKeySequence::New);
newAct->setStatusTip(tr("Create a new file"));
connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));
openAct = new QAction(tr("&Open..."), this);
openAct->setShortcuts(QKeySequence::Open);
openAct->setStatusTip(tr("Open an existing file"));
connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
saveAct = new QAction(tr("&Save"), this);
saveAct->setShortcuts(QKeySequence::Save);
saveAct->setStatusTip(tr("Save the document to disk"));
connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
}
现在我想给用户一个选项来自定义“菜单添加”的顺序,即我希望在运行时动态决定新的,打开和保存的序列。 我怎样才能在QT中实现这一目标? 使菜单可自定义的标准方法是什么?