|
本帖最后由 TQ-lkp 于 2012-10-29 11:14 编辑
qmenu.h
#ifdef Q_NO_USING_KEYWORD
inline void addAction(QAction *action) { QWidget::addAction(action); }
#else
using QWidget::addAction;
#endif
QAction *addAction(const QString &text);
QAction *addAction(const QIcon &icon, const QString &text);
QAction *addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0);
QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0);
测试通过的例子:
QMenu *file = menuBar()->addMenu(trUtf8("文件"));
QAction *newAct = new QAction(trUtf8("新建"), this);
newAct->setShortcuts(QKeySequence::New);
newAct->setStatusTip(trUtf8("新建文件"));
connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));
file->addAction(newAct);
|
|