Made QActions const

This commit is contained in:
Matt Keeter 2014-03-14 21:49:38 -04:00
parent c2d07bc40c
commit cbc6d7f0af
2 changed files with 8 additions and 7 deletions

View file

@ -7,7 +7,11 @@
#include "loader.h" #include "loader.h"
Window::Window(QWidget *parent) : 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"); setWindowTitle("fstl");
@ -22,17 +26,14 @@ Window::Window(QWidget *parent) :
canvas = new Canvas(format, this); canvas = new Canvas(format, this);
setCentralWidget(canvas); setCentralWidget(canvas);
open_action = new QAction("Open", this);
open_action->setShortcut(QKeySequence::Open); open_action->setShortcut(QKeySequence::Open);
QObject::connect(open_action, &QAction::triggered, QObject::connect(open_action, &QAction::triggered,
this, &Window::on_open); this, &Window::on_open);
quit_action = new QAction("Quit", this);
quit_action->setShortcut(QKeySequence::Quit); quit_action->setShortcut(QKeySequence::Quit);
QObject::connect(quit_action, &QAction::triggered, QObject::connect(quit_action, &QAction::triggered,
this, &Window::close); this, &Window::close);
about_action = new QAction("About", this);
QObject::connect(about_action, &QAction::triggered, QObject::connect(about_action, &QAction::triggered,
this, &Window::on_about); this, &Window::on_about);

View file

@ -17,9 +17,9 @@ public slots:
void on_about(); void on_about();
private: private:
QAction* open_action; QAction* const open_action;
QAction* about_action; QAction* const about_action;
QAction* quit_action; QAction* const quit_action;
Canvas* canvas; Canvas* canvas;
}; };