Added WeatherWidget

This commit is contained in:
0xFEEDC0DE64
2017-12-19 21:34:44 +01:00
parent 68909a15f9
commit 602ec86127
5 changed files with 44 additions and 2 deletions

View File

@@ -1,9 +1,19 @@
#include "weatherplugin.h"
#include <QDebug>
#include <QStatusBar>
#include "mainwindow.h"
#include "weatherwidget.h"
WeatherPlugin::WeatherPlugin(QObject *parent) :
ZeiterfassungPlugin(parent)
{
qDebug() << "called";
}
void WeatherPlugin::attachTo(MainWindow &mainWindow)
{
mainWindow.statusBar()->addWidget(new WeatherWidget(mainWindow));
}

View File

@@ -15,6 +15,7 @@ public:
explicit WeatherPlugin(QObject *parent = Q_NULLPTR);
// ZeiterfassungPlugin interface
void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE;
};
#endif // WEATHERPLUGIN_H

View File

@@ -14,8 +14,10 @@ DEPENDPATH += $$PWD/../../zeiterfassunglib
DEFINES += QT_DEPRECATED_WARNINGS QT_DISABLE_DEPRECATED_BEFORE=0x060000 QT_MESSAGELOGCONTEXT
HEADERS += weatherplugin.h
HEADERS += weatherplugin.h \
weatherwidget.h
SOURCES += weatherplugin.cpp
SOURCES += weatherplugin.cpp \
weatherwidget.cpp
OTHER_FILES += weatherplugin.json

View File

@@ -0,0 +1,10 @@
#include "weatherwidget.h"
#include "mainwindow.h"
WeatherWidget::WeatherWidget(MainWindow &mainWindow) :
QLabel(&mainWindow),
m_mainWindow(mainWindow)
{
setText(tr("Weather"));
}

View File

@@ -0,0 +1,19 @@
#ifndef WEATHERWIDGET_H
#define WEATHERWIDGET_H
#include <QLabel>
class MainWindow;
class WeatherWidget : public QLabel
{
Q_OBJECT
public:
explicit WeatherWidget(MainWindow &mainWindow);
private:
MainWindow &m_mainWindow;
};
#endif // WEATHERWIDGET_H