diff --git a/plugins/sketchplugin/sketchmainwindow.cpp b/plugins/sketchplugin/sketchmainwindow.cpp index fc8f26a..c9e23c4 100644 --- a/plugins/sketchplugin/sketchmainwindow.cpp +++ b/plugins/sketchplugin/sketchmainwindow.cpp @@ -1,14 +1,26 @@ #include "sketchmainwindow.h" #include "ui_sketchmainwindow.h" +#include + SketchMainWindow::SketchMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::SketchMainWindow) { ui->setupUi(this); + + ui->actionOpen->setShortcut(QKeySequence::Open); + ui->actionQuit->setShortcut(QKeySequence::Quit); + + connect(ui->actionOpen, &QAction::triggered, this, &SketchMainWindow::openPressed); } SketchMainWindow::~SketchMainWindow() { delete ui; } + +void SketchMainWindow::openPressed() +{ + QFileDialog::getOpenFileName(this, tr("Select a sketch file"), QString(), QStringLiteral("%0 (*.sketch)").arg(tr("Sketch file"))); +} diff --git a/plugins/sketchplugin/sketchmainwindow.h b/plugins/sketchplugin/sketchmainwindow.h index ede19cb..d2970a4 100644 --- a/plugins/sketchplugin/sketchmainwindow.h +++ b/plugins/sketchplugin/sketchmainwindow.h @@ -15,6 +15,9 @@ public: explicit SketchMainWindow(QWidget *parent = 0); ~SketchMainWindow(); +private Q_SLOTS: + void openPressed(); + private: Ui::SketchMainWindow *ui; }; diff --git a/plugins/sketchplugin/sketchmainwindow.ui b/plugins/sketchplugin/sketchmainwindow.ui index 71a9d3b..0fe15fa 100644 --- a/plugins/sketchplugin/sketchmainwindow.ui +++ b/plugins/sketchplugin/sketchmainwindow.ui @@ -1,9 +1,7 @@ + - - - SketchMainWindow - + 0 @@ -13,12 +11,63 @@ - MainWindow + Sketch Viewer - - - + + + + + + + + + + + 0 + 0 + 800 + 20 + + + + + &File + + + + + + + + + + + &Open + + + + + &Quit + + - - + + + + actionQuit + triggered() + SketchMainWindow + close() + + + -1 + -1 + + + 399 + 299 + + + +