Added toolButton for lunchmealplugin
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "stripswidget.h"
|
#include "stripswidget.h"
|
||||||
|
|
||||||
#include "advancedviewwidget.h"
|
#include "advancedviewwidget.h"
|
||||||
|
|
||||||
AdvancedViewPlugin::AdvancedViewPlugin(QObject *parent) :
|
AdvancedViewPlugin::AdvancedViewPlugin(QObject *parent) :
|
||||||
|
@@ -6,10 +6,11 @@
|
|||||||
#include "advancedviewdialog.h"
|
#include "advancedviewdialog.h"
|
||||||
|
|
||||||
AdvancedViewWidget::AdvancedViewWidget(StripsWidget &stripsWidget) :
|
AdvancedViewWidget::AdvancedViewWidget(StripsWidget &stripsWidget) :
|
||||||
QPushButton(&stripsWidget),
|
QToolButton(&stripsWidget),
|
||||||
m_stripsWidget(stripsWidget)
|
m_stripsWidget(stripsWidget)
|
||||||
{
|
{
|
||||||
setIcon(QIcon(QStringLiteral(":/zeiterfassung/plugins/advancedviewplugin/images/advanced-view.png")));
|
setIcon(QIcon(QStringLiteral(":/zeiterfassung/plugins/advancedviewplugin/images/advanced-view.png")));
|
||||||
|
setText(tr("Advanced view"));
|
||||||
|
|
||||||
connect(&stripsWidget, &StripsWidget::dateChanged, this, &AdvancedViewWidget::dateChanged);
|
connect(&stripsWidget, &StripsWidget::dateChanged, this, &AdvancedViewWidget::dateChanged);
|
||||||
dateChanged(stripsWidget.date());
|
dateChanged(stripsWidget.date());
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
#ifndef ADVANCEDVIEWWIDGET_H
|
#ifndef ADVANCEDVIEWWIDGET_H
|
||||||
#define ADVANCEDVIEWWIDGET_H
|
#define ADVANCEDVIEWWIDGET_H
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QToolButton>
|
||||||
|
|
||||||
class StripsWidget;
|
class StripsWidget;
|
||||||
|
|
||||||
class AdvancedViewWidget : public QPushButton
|
class AdvancedViewWidget : public QToolButton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
BIN
plugins/lunchmealplugin/images/lunch-meal.png
Normal file
BIN
plugins/lunchmealplugin/images/lunch-meal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
@@ -1,9 +1,21 @@
|
|||||||
#include "lunchmealplugin.h"
|
#include "lunchmealplugin.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QBoxLayout>
|
||||||
|
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#include "stripswidget.h"
|
||||||
|
|
||||||
|
#include "lunchmealwidget.h"
|
||||||
|
|
||||||
LunchMealPlugin::LunchMealPlugin(QObject *parent) :
|
LunchMealPlugin::LunchMealPlugin(QObject *parent) :
|
||||||
ZeiterfassungPlugin(parent)
|
ZeiterfassungPlugin(parent)
|
||||||
{
|
{
|
||||||
qDebug() << "called";
|
qDebug() << "called";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LunchMealPlugin::attachTo(MainWindow &mainWindow)
|
||||||
|
{
|
||||||
|
for(auto stripsWidget : mainWindow.stripsWidgets())
|
||||||
|
stripsWidget->headerLayout()->addWidget(new LunchMealWidget(*stripsWidget));
|
||||||
|
}
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "zeiterfassungplugin.h"
|
#include "zeiterfassungplugin.h"
|
||||||
|
|
||||||
|
class MainWindow;
|
||||||
|
|
||||||
class Q_DECL_EXPORT LunchMealPlugin : public ZeiterfassungPlugin
|
class Q_DECL_EXPORT LunchMealPlugin : public ZeiterfassungPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -15,6 +17,7 @@ public:
|
|||||||
explicit LunchMealPlugin(QObject *parent = Q_NULLPTR);
|
explicit LunchMealPlugin(QObject *parent = Q_NULLPTR);
|
||||||
|
|
||||||
// ZeiterfassungPlugin interface
|
// ZeiterfassungPlugin interface
|
||||||
|
void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LUNCHMEALPLUGIN_H
|
#endif // LUNCHMEALPLUGIN_H
|
||||||
|
@@ -14,8 +14,16 @@ DEPENDPATH += $$PWD/../../zeiterfassunglib
|
|||||||
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS QT_DISABLE_DEPRECATED_BEFORE=0x060000 QT_MESSAGELOGCONTEXT
|
DEFINES += QT_DEPRECATED_WARNINGS QT_DISABLE_DEPRECATED_BEFORE=0x060000 QT_MESSAGELOGCONTEXT
|
||||||
|
|
||||||
HEADERS += lunchmealplugin.h
|
HEADERS += lunchmealplugin.h \
|
||||||
|
lunchmealwidget.h
|
||||||
|
|
||||||
SOURCES += lunchmealplugin.cpp
|
SOURCES += lunchmealplugin.cpp \
|
||||||
|
lunchmealwidget.cpp
|
||||||
|
|
||||||
|
FORMS +=
|
||||||
|
|
||||||
|
RESOURCES += lunchmealplugin_resources.qrc
|
||||||
|
|
||||||
|
TRANSLATIONS +=
|
||||||
|
|
||||||
OTHER_FILES += lunchmealplugin.json
|
OTHER_FILES += lunchmealplugin.json
|
||||||
|
5
plugins/lunchmealplugin/lunchmealplugin_resources.qrc
Normal file
5
plugins/lunchmealplugin/lunchmealplugin_resources.qrc
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/zeiterfassung/plugins/lunchmealplugin">
|
||||||
|
<file>images/lunch-meal.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
22
plugins/lunchmealplugin/lunchmealwidget.cpp
Normal file
22
plugins/lunchmealplugin/lunchmealwidget.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "lunchmealwidget.h"
|
||||||
|
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
|
#include "stripswidget.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#include "zeiterfassungapi.h"
|
||||||
|
|
||||||
|
LunchMealWidget::LunchMealWidget(StripsWidget &stripsWidget) :
|
||||||
|
QToolButton(&stripsWidget),
|
||||||
|
m_stripsWidget(stripsWidget)
|
||||||
|
{
|
||||||
|
setIcon(QIcon(QStringLiteral(":/zeiterfassung/plugins/lunchmealplugin/images/lunch-meal.png")));
|
||||||
|
setText(tr("Lunch meal"));
|
||||||
|
|
||||||
|
connect(this, &QAbstractButton::pressed, this, &LunchMealWidget::pressedSlot);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LunchMealWidget::pressedSlot()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
21
plugins/lunchmealplugin/lunchmealwidget.h
Normal file
21
plugins/lunchmealplugin/lunchmealwidget.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef LUNCHMEALWIDGET_H
|
||||||
|
#define LUNCHMEALWIDGET_H
|
||||||
|
|
||||||
|
#include <QToolButton>
|
||||||
|
|
||||||
|
class StripsWidget;
|
||||||
|
|
||||||
|
class LunchMealWidget : public QToolButton
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit LunchMealWidget(StripsWidget &stripsWidget);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void pressedSlot();
|
||||||
|
|
||||||
|
private:
|
||||||
|
StripsWidget &m_stripsWidget;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LUNCHMEALWIDGET_H
|
Reference in New Issue
Block a user