Added sketch viewer window

This commit is contained in:
0xFEEDC0DE64
2018-04-12 19:57:11 +02:00
parent 61c52b8d77
commit 733d514436
6 changed files with 78 additions and 4 deletions

View File

@@ -0,0 +1,14 @@
#include "sketchmainwindow.h"
#include "ui_sketchmainwindow.h"
SketchMainWindow::SketchMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::SketchMainWindow)
{
ui->setupUi(this);
}
SketchMainWindow::~SketchMainWindow()
{
delete ui;
}

View File

@@ -0,0 +1,22 @@
#ifndef SKETCHMAINWINDOW_H
#define SKETCHMAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class SketchMainWindow;
}
class SketchMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit SketchMainWindow(QWidget *parent = 0);
~SketchMainWindow();
private:
Ui::SketchMainWindow *ui;
};
#endif // SKETCHMAINWINDOW_H

View File

@@ -0,0 +1,24 @@
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>SketchMainWindow</class>
<widget name="SketchMainWindow" class="QMainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget name="menubar" class="QMenuBar"/>
<widget name="centralwidget" class="QWidget"/>
<widget name="statusbar" class="QStatusBar"/>
</widget>
<pixmapfunction/>
<connections/>
</ui>

View File

@@ -8,6 +8,7 @@
#include <QAction>
#include "mainwindow.h"
#include "sketchmainwindow.h"
SketchPlugin::SketchPlugin(QObject *parent) :
ZeiterfassungPlugin(parent)
@@ -31,5 +32,13 @@ SketchPlugin::SketchPlugin(QObject *parent) :
void SketchPlugin::attachTo(MainWindow &mainWindow)
{
mainWindow.menuTools()->addAction(QIcon(QStringLiteral(":/zeiterfassung/plugins/sketchplugin/images/sketch.png")), tr("Open Sketch viewer"));
mainWindow.menuTools()->addAction(QIcon(QStringLiteral(":/zeiterfassung/plugins/sketchplugin/images/sketch.png")), tr("Open Sketch viewer"),
this, &SketchPlugin::openWindow);
}
void SketchPlugin::openWindow()
{
auto window = new SketchMainWindow;
window->setAttribute(Qt::WA_DeleteOnClose);
window->show();
}

View File

@@ -19,6 +19,9 @@ public:
// ZeiterfassungPlugin interface
void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE;
private Q_SLOTS:
void openWindow();
private:
QTranslator m_translator;
};

View File

@@ -4,11 +4,13 @@ TARGET = sketchplugin
DBLIBS += core gui
HEADERS += sketchplugin.h
HEADERS += sketchmainwindow.h \
sketchplugin.h
SOURCES += sketchplugin.cpp
SOURCES += sketchmainwindow.cpp \
sketchplugin.cpp
FORMS +=
FORMS += sketchmainwindow.ui
RESOURCES += sketchplugin_resources.qrc