From cbc6d7f0af969d23af0e319e688b6d59df213b44 Mon Sep 17 00:00:00 2001 From: Matt Keeter Date: Fri, 14 Mar 2014 21:49:38 -0400 Subject: [PATCH] Made QActions const --- src/window.cpp | 9 +++++---- src/window.h | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 885b0a8..203fff9 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -7,7 +7,11 @@ #include "loader.h" Window::Window(QWidget *parent) : - QMainWindow(parent) + QMainWindow(parent), + open_action(new QAction("Open", this)), + about_action(new QAction("About", this)), + quit_action(new QAction("Quit", this)) + { setWindowTitle("fstl"); @@ -22,17 +26,14 @@ Window::Window(QWidget *parent) : canvas = new Canvas(format, this); setCentralWidget(canvas); - open_action = new QAction("Open", this); open_action->setShortcut(QKeySequence::Open); QObject::connect(open_action, &QAction::triggered, this, &Window::on_open); - quit_action = new QAction("Quit", this); quit_action->setShortcut(QKeySequence::Quit); QObject::connect(quit_action, &QAction::triggered, this, &Window::close); - about_action = new QAction("About", this); QObject::connect(about_action, &QAction::triggered, this, &Window::on_about); diff --git a/src/window.h b/src/window.h index 078a7f3..866e103 100644 --- a/src/window.h +++ b/src/window.h @@ -17,9 +17,9 @@ public slots: void on_about(); private: - QAction* open_action; - QAction* about_action; - QAction* quit_action; + QAction* const open_action; + QAction* const about_action; + QAction* const quit_action; Canvas* canvas; }; -- 2.39.5