Build out AppBar layout
This commit is contained in:
parent
b40b8a1a4e
commit
067cf211b3
|
@ -1,7 +1,6 @@
|
||||||
#include "qtmaterialappbar.h"
|
#include "qtmaterialappbar.h"
|
||||||
#include "qtmaterialappbar_p.h"
|
#include "qtmaterialappbar_p.h"
|
||||||
#include <QtWidgets/QGraphicsDropShadowEffect>
|
#include <QtWidgets/QGraphicsDropShadowEffect>
|
||||||
#include <QtWidgets/QHBoxLayout>
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "lib/qtmaterialstyle.h"
|
#include "lib/qtmaterialstyle.h"
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define QTMATERIALAPPBAR_H
|
#define QTMATERIALAPPBAR_H
|
||||||
|
|
||||||
#include <QtWidgets/QWidget>
|
#include <QtWidgets/QWidget>
|
||||||
|
#include <QtWidgets/QHBoxLayout>
|
||||||
|
|
||||||
class QtMaterialAppBarPrivate;
|
class QtMaterialAppBarPrivate;
|
||||||
|
|
||||||
|
@ -27,6 +28,8 @@ public:
|
||||||
void setBackgroundColor(const QColor &color);
|
void setBackgroundColor(const QColor &color);
|
||||||
QColor backgroundColor() const;
|
QColor backgroundColor() const;
|
||||||
|
|
||||||
|
inline QHBoxLayout *appBarLayout() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -37,4 +40,9 @@ private:
|
||||||
Q_DECLARE_PRIVATE(QtMaterialAppBar)
|
Q_DECLARE_PRIVATE(QtMaterialAppBar)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline QHBoxLayout *QtMaterialAppBar::appBarLayout() const
|
||||||
|
{
|
||||||
|
return static_cast<QHBoxLayout *>(layout());
|
||||||
|
}
|
||||||
|
|
||||||
#endif // QTMATERIALAPPBAR_H
|
#endif // QTMATERIALAPPBAR_H
|
||||||
|
|
|
@ -94,6 +94,8 @@ void QtMaterialIconButton::setColor(const QColor &color)
|
||||||
Q_D(QtMaterialIconButton);
|
Q_D(QtMaterialIconButton);
|
||||||
|
|
||||||
d->color = color;
|
d->color = color;
|
||||||
|
|
||||||
|
MATERIAL_DISABLE_THEME_COLORS
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +114,8 @@ void QtMaterialIconButton::setDisabledColor(const QColor &color)
|
||||||
Q_D(QtMaterialIconButton);
|
Q_D(QtMaterialIconButton);
|
||||||
|
|
||||||
d->disabledColor = color;
|
d->disabledColor = color;
|
||||||
|
|
||||||
|
MATERIAL_DISABLE_THEME_COLORS
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <QtWidgets/QVBoxLayout>
|
#include <QtWidgets/QVBoxLayout>
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include <qtmaterialappbar.h>
|
#include <qtmaterialappbar.h>
|
||||||
|
#include <qtmaterialiconbutton.h>
|
||||||
#include <lib/qtmaterialtheme.h>
|
#include <lib/qtmaterialtheme.h>
|
||||||
|
|
||||||
AppBarSettingsEditor::AppBarSettingsEditor(QWidget *parent)
|
AppBarSettingsEditor::AppBarSettingsEditor(QWidget *parent)
|
||||||
|
@ -9,6 +10,12 @@ AppBarSettingsEditor::AppBarSettingsEditor(QWidget *parent)
|
||||||
ui(new Ui::AppBarSettingsForm),
|
ui(new Ui::AppBarSettingsForm),
|
||||||
m_appBar(new QtMaterialAppBar)
|
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;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue