diff --git a/appbar.cpp b/appbar.cpp index 68149e9..e8412ad 100644 --- a/appbar.cpp +++ b/appbar.cpp @@ -1 +1,44 @@ +#include +#include +#include +#include #include "appbar.h" + +AppBar::AppBar(QWidget *parent) + : QWidget(parent) +{ + QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect; + effect->setOffset(0, 2); + effect->setBlurRadius(11); + effect->setColor(QColor(0, 0, 0, 50)); + setGraphicsEffect(effect); + + QHBoxLayout *layout = new QHBoxLayout; + setLayout(layout); + + QLabel *label = new QLabel("App"); + layout->addWidget(label); + + QSizePolicy policy; + policy.setHorizontalPolicy(QSizePolicy::MinimumExpanding); + policy.setVerticalPolicy(QSizePolicy::Maximum); + setSizePolicy(policy); + + setMinimumHeight(64); +} + +AppBar::~AppBar() +{ +} + +void AppBar::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event) + + QPainter painter(this); + QBrush brush; + brush.setStyle(Qt::SolidPattern); + brush.setColor(Qt::white); + + painter.fillRect(rect(), brush); +} diff --git a/appbar.h b/appbar.h index e69de29..80cbb77 100644 --- a/appbar.h +++ b/appbar.h @@ -0,0 +1,18 @@ +#ifndef APPBAR_H +#define APPBAR_H + +#include + +class AppBar : public QWidget +{ + Q_OBJECT + +public: + explicit AppBar(QWidget *parent = 0); + ~AppBar(); + +protected: + void paintEvent(QPaintEvent *event); +}; + +#endif // APPBAR_H