16,240
社区成员
发帖
与我相关
我的任务
分享
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
setWindowTitle(tr("Main Window"));
openAction = new QAction(QIcon(":/images/docopen"),tr("&Open..."),this);
openAction->setShortcuts(QKeySequence::Open);//定义快捷键
openAction->setStatusTip(tr("Open an existing file"));//鼠标划过按钮时,状态栏显示的提示
connect(openAction, &QAction::triggered, this, &MainWindow::open);
QMenu *file = menuBar()->addMenu(tr("&File"));
file->addAction(openAction);
QToolBar *toolBar = addToolBar(tr("&File"));
toolBar->addAction(openAction);
statusBar() ;
}