Add in the begining parts of a settings system.
This commit is contained in:
@@ -24,6 +24,10 @@ void MainWindow::createActions()
|
||||
exitAct->setShortcuts(QKeySequence::Quit);
|
||||
connect(exitAct, &QAction::triggered, this, &QWidget::close);
|
||||
|
||||
settingsAct = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::WeatherSnow),
|
||||
tr("&Settings"), this);
|
||||
connect(settingsAct, &QAction::triggered, this, &MainWindow::settings);
|
||||
|
||||
aboutAct = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::HelpAbout),
|
||||
tr("&About"), this);
|
||||
connect(aboutAct, &QAction::triggered, this, &MainWindow::about);
|
||||
@@ -38,6 +42,9 @@ void MainWindow::createMenus()
|
||||
fileMenu = menuBar()->addMenu(tr("&File"));
|
||||
fileMenu->addAction(exitAct);
|
||||
|
||||
editMenu = menuBar()->addMenu(tr("&Edit"));
|
||||
editMenu->addAction(settingsAct);
|
||||
|
||||
helpMenu = menuBar()->addMenu(tr("&Help"));
|
||||
helpMenu->addAction(aboutAct);
|
||||
helpMenu->addAction(aboutQtAct);
|
||||
@@ -73,3 +80,11 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
saveSettings();
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
void MainWindow::settings()
|
||||
{
|
||||
QWidget *settingsWin = new QWidget();
|
||||
settingsWin->setWindowTitle("Settings");
|
||||
settingsWin->resize(300, 200);
|
||||
settingsWin->show();
|
||||
}
|
||||
|
||||
@@ -33,9 +33,11 @@ private:
|
||||
QAction *exitAct;
|
||||
QAction *aboutAct;
|
||||
QAction *aboutQtAct;
|
||||
QAction *settingsAct;
|
||||
|
||||
private slots:
|
||||
void about();
|
||||
void settings();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
Reference in New Issue
Block a user