From a396e030e8c05f35422ae5d9046149a26553f77c Mon Sep 17 00:00:00 2001 From: Matt Keeter Date: Fri, 7 Mar 2014 11:45:00 -0600 Subject: [PATCH] Adding about box --- src/window.cpp | 17 +++++++++++++++++ src/window.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/window.cpp b/src/window.cpp index 5c5e1c3..6b12563 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1,4 +1,5 @@ #include +#include #include #include "window.h" @@ -27,10 +28,17 @@ Window::Window(QWidget *parent) : QObject::connect(quit_action, SIGNAL(triggered()), this, SLOT(close())); + about_action = new QAction("About", this); + QObject::connect(about_action, SIGNAL(triggered()), + this, SLOT(on_about())); + auto file_menu = menuBar()->addMenu("File"); file_menu->addAction(open_action); file_menu->addAction(quit_action); + auto help_menu = menuBar()->addMenu("Help"); + help_menu->addAction(about_action); + resize(600, 400); } @@ -44,6 +52,15 @@ void Window::on_open() } } +void Window::on_about() +{ + QMessageBox::about(this, "About fstl", "fstl

" + "A fast viewer for .stl files.
" + "https://github.com/mkeeter/fstl

" + "© 2014 Matthew Keeter
" + "matt.j.keeter@gmail.com
"); +} + void Window::enable_open_action() { diff --git a/src/window.h b/src/window.h index eefaece..cb4aeb3 100644 --- a/src/window.h +++ b/src/window.h @@ -14,11 +14,13 @@ public: public slots: void on_open(); + void on_about(); void disable_open_action(); void enable_open_action(); private: QAction* open_action; + QAction* about_action; QAction* quit_action; Canvas* canvas; -- 2.39.5