diff --git a/mainwindow.cpp b/mainwindow.cpp index dd7073b..08a2265 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -17,6 +17,15 @@ MainWindow::MainWindow(QWidget *parent) connect(ui->actionOpen, &QAction::triggered, this, &MainWindow::onOpenButtonClicked); connect(ui->actionSave, &QAction::triggered, this, &MainWindow::onSaveButtonClicked); + + QIcon openIcon = QApplication::style()->standardIcon(QStyle::SP_DialogOpenButton); + QIcon saveIcon = QApplication::style()->standardIcon(QStyle::SP_DialogSaveButton); + + ui->actionOpen->setIcon(openIcon); + ui->actionSave->setIcon(saveIcon); + + ui->actionOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N)); + ui->actionSave->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); } MainWindow::~MainWindow() diff --git a/mainwindow.h b/mainwindow.h index e933317..93f30fb 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -7,6 +7,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } @@ -30,5 +31,7 @@ private slots: private: Ui::MainWindow *ui; QProgressDialog* progressDialog; // 添加进度对话框指针 + QMenu* menuFile; + QAction* actionFile; }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index 3df9490..3416c15 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -33,12 +33,12 @@ 0 0 1400 - 21 + 23 - File + 文件(&F) @@ -48,12 +48,15 @@ - Open + 打开 + + + - Save + 保存