Build out AppBar layout

This commit is contained in:
johanneshilden 2017-10-11 23:16:13 +03:00
parent b40b8a1a4e
commit 067cf211b3
4 changed files with 19 additions and 1 deletions

View File

@ -1,7 +1,6 @@
#include "qtmaterialappbar.h"
#include "qtmaterialappbar_p.h"
#include <QtWidgets/QGraphicsDropShadowEffect>
#include <QtWidgets/QHBoxLayout>
#include <QPainter>
#include "lib/qtmaterialstyle.h"

View File

@ -2,6 +2,7 @@
#define QTMATERIALAPPBAR_H
#include <QtWidgets/QWidget>
#include <QtWidgets/QHBoxLayout>
class QtMaterialAppBarPrivate;
@ -27,6 +28,8 @@ public:
void setBackgroundColor(const QColor &color);
QColor backgroundColor() const;
inline QHBoxLayout *appBarLayout() const;
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
@ -37,4 +40,9 @@ private:
Q_DECLARE_PRIVATE(QtMaterialAppBar)
};
inline QHBoxLayout *QtMaterialAppBar::appBarLayout() const
{
return static_cast<QHBoxLayout *>(layout());
}
#endif // QTMATERIALAPPBAR_H

View File

@ -94,6 +94,8 @@ void QtMaterialIconButton::setColor(const QColor &color)
Q_D(QtMaterialIconButton);
d->color = color;
MATERIAL_DISABLE_THEME_COLORS
update();
}
@ -112,6 +114,8 @@ void QtMaterialIconButton::setDisabledColor(const QColor &color)
Q_D(QtMaterialIconButton);
d->disabledColor = color;
MATERIAL_DISABLE_THEME_COLORS
update();
}

View File

@ -2,6 +2,7 @@
#include <QtWidgets/QVBoxLayout>
#include <QColorDialog>
#include <qtmaterialappbar.h>
#include <qtmaterialiconbutton.h>
#include <lib/qtmaterialtheme.h>
AppBarSettingsEditor::AppBarSettingsEditor(QWidget *parent)
@ -9,6 +10,12 @@ AppBarSettingsEditor::AppBarSettingsEditor(QWidget *parent)
ui(new Ui::AppBarSettingsForm),
m_appBar(new QtMaterialAppBar)
{
QtMaterialIconButton *button = new QtMaterialIconButton(QtMaterialTheme::icon("navigation", "menu"));
button->setIconSize(QSize(24, 24));
m_appBar->appBarLayout()->addWidget(button);
m_appBar->appBarLayout()->addStretch(1);
button->setColor(Qt::white);
QVBoxLayout *layout = new QVBoxLayout;
setLayout(layout);