basic AppBar implementation
This commit is contained in:
parent
a91f0714ec
commit
71b47e4849
43
appbar.cpp
43
appbar.cpp
|
@ -1 +1,44 @@
|
||||||
|
#include <QGraphicsDropShadowEffect>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QPainter>
|
||||||
#include "appbar.h"
|
#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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue