AppBar -> md namespace.
Shorten the long, boring classes names.
This commit is contained in:
parent
b752e8a3ae
commit
31a4a59a3f
|
@ -4,6 +4,7 @@
|
|||
#include <QPainter>
|
||||
#include "lib/qtmaterialstyle.h"
|
||||
|
||||
namespace md {
|
||||
/*!
|
||||
* \class QtMaterialAppBarPrivate
|
||||
* \internal
|
||||
|
@ -12,7 +13,7 @@
|
|||
/*!
|
||||
* \internal
|
||||
*/
|
||||
QtMaterialAppBarPrivate::QtMaterialAppBarPrivate(QtMaterialAppBar *q)
|
||||
AppBarPrivate::AppBarPrivate(AppBar *q)
|
||||
: q_ptr(q)
|
||||
{
|
||||
}
|
||||
|
@ -20,16 +21,16 @@ QtMaterialAppBarPrivate::QtMaterialAppBarPrivate(QtMaterialAppBar *q)
|
|||
/*!
|
||||
* \internal
|
||||
*/
|
||||
QtMaterialAppBarPrivate::~QtMaterialAppBarPrivate()
|
||||
AppBarPrivate::~AppBarPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
*/
|
||||
void QtMaterialAppBarPrivate::init()
|
||||
void AppBarPrivate::init()
|
||||
{
|
||||
Q_Q(QtMaterialAppBar);
|
||||
Q_Q(AppBar);
|
||||
|
||||
useThemeColors = true;
|
||||
|
||||
|
@ -48,23 +49,23 @@ void QtMaterialAppBarPrivate::init()
|
|||
* \class QtMaterialAppBar
|
||||
*/
|
||||
|
||||
QtMaterialAppBar::QtMaterialAppBar(QWidget *parent)
|
||||
AppBar::AppBar(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
d_ptr(new QtMaterialAppBarPrivate(this))
|
||||
d_ptr(new AppBarPrivate(this))
|
||||
{
|
||||
d_func()->init();
|
||||
}
|
||||
|
||||
QtMaterialAppBar::~QtMaterialAppBar()
|
||||
AppBar::~AppBar()
|
||||
{
|
||||
}
|
||||
|
||||
QSize QtMaterialAppBar::sizeHint() const
|
||||
QSize AppBar::sizeHint() const
|
||||
{
|
||||
return QSize(-1, 64);
|
||||
}
|
||||
|
||||
void QtMaterialAppBar::paintEvent(QPaintEvent *event)
|
||||
void AppBar::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
|
@ -73,9 +74,9 @@ void QtMaterialAppBar::paintEvent(QPaintEvent *event)
|
|||
painter.fillRect(rect(), backgroundColor());
|
||||
}
|
||||
|
||||
void QtMaterialAppBar::setUseThemeColors(bool value)
|
||||
void AppBar::setUseThemeColors(bool value)
|
||||
{
|
||||
Q_D(QtMaterialAppBar);
|
||||
Q_D(AppBar);
|
||||
|
||||
if (d->useThemeColors == value) {
|
||||
return;
|
||||
|
@ -85,16 +86,16 @@ void QtMaterialAppBar::setUseThemeColors(bool value)
|
|||
update();
|
||||
}
|
||||
|
||||
bool QtMaterialAppBar::useThemeColors() const
|
||||
bool AppBar::useThemeColors() const
|
||||
{
|
||||
Q_D(const QtMaterialAppBar);
|
||||
Q_D(const AppBar);
|
||||
|
||||
return d->useThemeColors;
|
||||
}
|
||||
|
||||
void QtMaterialAppBar::setForegroundColor(const QColor &color)
|
||||
void AppBar::setForegroundColor(const QColor &color)
|
||||
{
|
||||
Q_D(QtMaterialAppBar);
|
||||
Q_D(AppBar);
|
||||
|
||||
d->foregroundColor = color;
|
||||
|
||||
|
@ -104,9 +105,9 @@ void QtMaterialAppBar::setForegroundColor(const QColor &color)
|
|||
update();
|
||||
}
|
||||
|
||||
QColor QtMaterialAppBar::foregroundColor() const
|
||||
QColor AppBar::foregroundColor() const
|
||||
{
|
||||
Q_D(const QtMaterialAppBar);
|
||||
Q_D(const AppBar);
|
||||
|
||||
if (d->useThemeColors || !d->foregroundColor.isValid()) {
|
||||
return QtMaterialStyle::instance().themeColor("primary1");
|
||||
|
@ -115,9 +116,9 @@ QColor QtMaterialAppBar::foregroundColor() const
|
|||
}
|
||||
}
|
||||
|
||||
void QtMaterialAppBar::setBackgroundColor(const QColor &color)
|
||||
void AppBar::setBackgroundColor(const QColor &color)
|
||||
{
|
||||
Q_D(QtMaterialAppBar);
|
||||
Q_D(AppBar);
|
||||
|
||||
d->backgroundColor = color;
|
||||
|
||||
|
@ -127,9 +128,9 @@ void QtMaterialAppBar::setBackgroundColor(const QColor &color)
|
|||
update();
|
||||
}
|
||||
|
||||
QColor QtMaterialAppBar::backgroundColor() const
|
||||
QColor AppBar::backgroundColor() const
|
||||
{
|
||||
Q_D(const QtMaterialAppBar);
|
||||
Q_D(const AppBar);
|
||||
|
||||
if (d->useThemeColors || !d->backgroundColor.isValid()) {
|
||||
return QtMaterialStyle::instance().themeColor("primary1");
|
||||
|
@ -137,3 +138,5 @@ QColor QtMaterialAppBar::backgroundColor() const
|
|||
return d->backgroundColor;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,9 +4,12 @@
|
|||
#include <QtWidgets/QWidget>
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
|
||||
class QtMaterialAppBarPrivate;
|
||||
namespace md
|
||||
{
|
||||
|
||||
class QtMaterialAppBar : public QWidget
|
||||
class AppBarPrivate;
|
||||
|
||||
class AppBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -14,8 +17,8 @@ class QtMaterialAppBar : public QWidget
|
|||
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
|
||||
|
||||
public:
|
||||
explicit QtMaterialAppBar(QWidget *parent = 0);
|
||||
~QtMaterialAppBar();
|
||||
explicit AppBar(QWidget *parent = 0);
|
||||
~AppBar();
|
||||
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
|
||||
|
@ -33,16 +36,18 @@ public:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
const QScopedPointer<QtMaterialAppBarPrivate> d_ptr;
|
||||
const QScopedPointer<AppBarPrivate> d_ptr;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QtMaterialAppBar)
|
||||
Q_DECLARE_PRIVATE(QtMaterialAppBar)
|
||||
Q_DISABLE_COPY(AppBar)
|
||||
Q_DECLARE_PRIVATE(AppBar)
|
||||
};
|
||||
|
||||
inline QHBoxLayout *QtMaterialAppBar::appBarLayout() const
|
||||
inline QHBoxLayout *AppBar::appBarLayout() const
|
||||
{
|
||||
return static_cast<QHBoxLayout *>(layout());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // QTMATERIALAPPBAR_H
|
||||
|
|
|
@ -4,23 +4,28 @@
|
|||
#include <QtGlobal>
|
||||
#include <QColor>
|
||||
|
||||
class QtMaterialAppBar;
|
||||
|
||||
class QtMaterialAppBarPrivate
|
||||
namespace md
|
||||
{
|
||||
Q_DISABLE_COPY(QtMaterialAppBarPrivate)
|
||||
Q_DECLARE_PUBLIC(QtMaterialAppBar)
|
||||
|
||||
class AppBar;
|
||||
|
||||
class AppBarPrivate
|
||||
{
|
||||
Q_DISABLE_COPY(AppBarPrivate)
|
||||
Q_DECLARE_PUBLIC(AppBar)
|
||||
|
||||
public:
|
||||
QtMaterialAppBarPrivate(QtMaterialAppBar *q);
|
||||
~QtMaterialAppBarPrivate();
|
||||
AppBarPrivate(AppBar *q);
|
||||
~AppBarPrivate();
|
||||
|
||||
void init();
|
||||
|
||||
QtMaterialAppBar *const q_ptr;
|
||||
AppBar *const q_ptr;
|
||||
bool useThemeColors;
|
||||
QColor foregroundColor;
|
||||
QColor backgroundColor;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // QTMATERIALAPPBAR_P_H
|
||||
|
|
Loading…
Reference in New Issue