diff --git a/README.md b/README.md
index c73eed0..5014410 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,7 @@
YouTube video preview [available here](http://www.youtube.com/watch?v=21UMeNVBPU4).
+
diff --git a/components/materiallib/qtmaterialoverlaywidget.cpp b/components/materiallib/qtmaterialoverlaywidget.cpp
index 2511fe2..9ef3647 100644
--- a/components/materiallib/qtmaterialoverlaywidget.cpp
+++ b/components/materiallib/qtmaterialoverlaywidget.cpp
@@ -2,8 +2,8 @@
#include
/*!
- * \class QtMaterialOverlayWidget
- * \internal
+ * @class QtMaterialOverlayWidget
+ * @internal
*/
QtMaterialOverlayWidget::QtMaterialOverlayWidget(QWidget *parent)
@@ -17,7 +17,7 @@ QtMaterialOverlayWidget::QtMaterialOverlayWidget(QWidget *parent)
QtMaterialOverlayWidget::~QtMaterialOverlayWidget() {}
/*!
- * \reimp
+ * @reimp
*/
bool QtMaterialOverlayWidget::event(QEvent *event)
{
@@ -41,7 +41,7 @@ bool QtMaterialOverlayWidget::event(QEvent *event)
}
/*!
- * \reimp
+ * @reimp
*/
bool QtMaterialOverlayWidget::eventFilter(QObject *obj, QEvent *event)
{
diff --git a/components/qtmaterialcircularprogress.cpp b/components/qtmaterialcircularprogress.cpp
index 050e436..aee067d 100644
--- a/components/qtmaterialcircularprogress.cpp
+++ b/components/qtmaterialcircularprogress.cpp
@@ -1,11 +1,11 @@
#include "qtmaterialcircularprogress.h"
+#include "lib/qtmaterialstyle.h"
+#include "qtmaterialcircularprogress_internal.h"
#include "qtmaterialcircularprogress_p.h"
-#include
-#include
#include
#include
-#include "qtmaterialcircularprogress_internal.h"
-#include "lib/qtmaterialstyle.h"
+#include
+#include
/*!
* \class QtMaterialCircularProgressPrivate
@@ -17,22 +17,19 @@ QtMaterialCircularProgressPrivate::QtMaterialCircularProgressPrivate(QtMaterialC
{
}
-QtMaterialCircularProgressPrivate::~QtMaterialCircularProgressPrivate()
-{
-}
+QtMaterialCircularProgressPrivate::~QtMaterialCircularProgressPrivate() {}
void QtMaterialCircularProgressPrivate::init()
{
Q_Q(QtMaterialCircularProgress);
- delegate = new QtMaterialCircularProgressDelegate(q);
- progressType = Material::IndeterminateProgress;
- penWidth = 6.25;
- size = 64;
+ delegate = new QtMaterialCircularProgressDelegate(q);
+ progressType = Material::IndeterminateProgress;
+ penWidth = 6.25;
+ size = 64;
useThemeColors = true;
- q->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,
- QSizePolicy::MinimumExpanding));
+ q->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
QParallelAnimationGroup *group = new QParallelAnimationGroup(q);
group->setLoopCount(-1);
@@ -82,15 +79,13 @@ void QtMaterialCircularProgressPrivate::init()
*/
QtMaterialCircularProgress::QtMaterialCircularProgress(QWidget *parent)
- : QProgressBar(parent),
- d_ptr(new QtMaterialCircularProgressPrivate(this))
+ : QProgressBar(parent)
+ , d_ptr(new QtMaterialCircularProgressPrivate(this))
{
d_func()->init();
}
-QtMaterialCircularProgress::~QtMaterialCircularProgress()
-{
-}
+QtMaterialCircularProgress::~QtMaterialCircularProgress() {}
void QtMaterialCircularProgress::setProgressType(Material::ProgressType type)
{
@@ -186,7 +181,7 @@ QSize QtMaterialCircularProgress::sizeHint() const
{
Q_D(const QtMaterialCircularProgress);
- const qreal s = d->size+d->penWidth+8;
+ const qreal s = d->size + d->penWidth + 8;
return QSize(s, s);
}
@@ -202,21 +197,19 @@ void QtMaterialCircularProgress::paintEvent(QPaintEvent *event)
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
- if (!isEnabled())
- {
+ if (!isEnabled()) {
QPen pen;
pen.setCapStyle(Qt::RoundCap);
pen.setWidthF(d->penWidth);
pen.setColor(QtMaterialStyle::instance().themeColor("border"));
painter.setPen(pen);
- painter.drawLine(rect().center()-QPointF(20, 20), rect().center()+QPointF(20, 20));
- painter.drawLine(rect().center()+QPointF(20, -20), rect().center()-QPointF(20, -20));
+ painter.drawLine(rect().center() - QPointF(20, 20), rect().center() + QPointF(20, 20));
+ painter.drawLine(rect().center() + QPointF(20, -20), rect().center() - QPointF(20, -20));
return;
}
- if (Material::IndeterminateProgress == d->progressType)
- {
- painter.translate(width()/2.0, height()/2.0);
+ if (Material::IndeterminateProgress == d->progressType) {
+ painter.translate(width() / 2.0, height() / 2.0);
painter.rotate(d->delegate->angle());
}
@@ -225,26 +218,23 @@ void QtMaterialCircularProgress::paintEvent(QPaintEvent *event)
pen.setWidthF(d->penWidth);
pen.setColor(color());
- if (Material::IndeterminateProgress == d->progressType)
- {
+ if (Material::IndeterminateProgress == d->progressType) {
QVector pattern;
- pattern << d->delegate->dashLength()*d->size/50 << 30.0*d->size/50;
+ pattern << d->delegate->dashLength() * d->size / 50 << 30.0 * d->size / 50;
- pen.setDashOffset(d->delegate->dashOffset()*d->size/50);
+ pen.setDashOffset(d->delegate->dashOffset() * d->size / 50);
pen.setDashPattern(pattern);
painter.setPen(pen);
- painter.drawEllipse(QPoint(0, 0), d->size/2, d->size/2);
- }
- else
- {
+ painter.drawEllipse(QPoint(0, 0), d->size / 2, d->size / 2);
+ } else {
painter.setPen(pen);
- const qreal x = (width()-d->size)/2.0;
- const qreal y = (height()-d->size)/2.0;
+ const qreal x = (width() - d->size) / 2.0;
+ const qreal y = (height() - d->size) / 2.0;
- const qreal a = 360.0*(value()-minimum())/(maximum()-minimum());
+ const qreal a = 360.0 * (value() - minimum()) / (maximum() - minimum());
QPainterPath path;
path.arcMoveTo(x, y, d->size, d->size, 0);
diff --git a/components/qtmaterialdialog.cpp b/components/qtmaterialdialog.cpp
index 95378a2..7243abf 100644
--- a/components/qtmaterialdialog.cpp
+++ b/components/qtmaterialdialog.cpp
@@ -11,8 +11,8 @@
#include
/*!
- * \class QtMaterialDialogPrivate
- * \internal
+ * @class QtMaterialDialogPrivate
+ * @internal
*/
QtMaterialDialogPrivate::QtMaterialDialogPrivate(QtMaterialDialog *q)
@@ -22,8 +22,10 @@ QtMaterialDialogPrivate::QtMaterialDialogPrivate(QtMaterialDialog *q)
QtMaterialDialogPrivate::~QtMaterialDialogPrivate() {}
+// main
void QtMaterialDialogPrivate::init()
{
+ // get public class
Q_Q(QtMaterialDialog);
dialogWindow = new QtMaterialDialogWindow(q);
@@ -31,6 +33,7 @@ void QtMaterialDialogPrivate::init()
stateMachine = new QStateMachine(q);
proxy = new QtMaterialDialogProxy(dialogWindow, proxyStack, q);
+ // qvbox
QVBoxLayout *layout = new QVBoxLayout;
q->setLayout(layout);
@@ -38,6 +41,7 @@ void QtMaterialDialogPrivate::init()
widget->setLayout(proxyStack);
widget->setMinimumWidth(400);
+ // shadoweffect
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
effect->setColor(QColor(0, 0, 0, 200));
effect->setBlurRadius(64);
@@ -100,7 +104,7 @@ void QtMaterialDialogPrivate::init()
}
/*!
- * \class QtMaterialDialog
+ * @class QtMaterialDialog
*/
QtMaterialDialog::QtMaterialDialog(QWidget *parent)
@@ -143,6 +147,7 @@ void QtMaterialDialog::hideDialog()
d->proxyStack->setCurrentIndex(1);
}
+// just paint shadow
void QtMaterialDialog::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
diff --git a/components/qtmaterialdialog_internal.cpp b/components/qtmaterialdialog_internal.cpp
index 5b89e3f..00733c8 100644
--- a/components/qtmaterialdialog_internal.cpp
+++ b/components/qtmaterialdialog_internal.cpp
@@ -6,8 +6,8 @@
#include
/*!
- * \class QtMaterialDialogProxy
- * \internal
+ * @class QtMaterialDialogProxy
+ * @internal
*/
QtMaterialDialogProxy::QtMaterialDialogProxy(QtMaterialDialogWindow *source,
@@ -80,8 +80,8 @@ void QtMaterialDialogProxy::paintEvent(QPaintEvent *event)
}
/*!
- * \class QtMaterialDialogWindow
- * \internal
+ * @class QtMaterialDialogWindow
+ * @internal
*/
QtMaterialDialogWindow::QtMaterialDialogWindow(QtMaterialDialog *dialog, QWidget *parent)
diff --git a/components/qtmaterialdrawer.cpp b/components/qtmaterialdrawer.cpp
index 7386434..93f23bd 100644
--- a/components/qtmaterialdrawer.cpp
+++ b/components/qtmaterialdrawer.cpp
@@ -11,12 +11,12 @@
#include
/*!
- * \class QtMaterialDrawerPrivate
- * \internal
+ * @class QtMaterialDrawerPrivate
+ * @internal
*/
/*!
- * \internal
+ * @internal
*/
QtMaterialDrawerPrivate::QtMaterialDrawerPrivate(QtMaterialDrawer *q)
: q_ptr(q)
@@ -24,12 +24,12 @@ QtMaterialDrawerPrivate::QtMaterialDrawerPrivate(QtMaterialDrawer *q)
}
/*!
- * \internal
+ * @internal
*/
QtMaterialDrawerPrivate::~QtMaterialDrawerPrivate() {}
/*!
- * \internal
+ * @internal
*/
void QtMaterialDrawerPrivate::init()
{
@@ -57,7 +57,7 @@ void QtMaterialDrawerPrivate::init()
}
/*!
- * \class QtMaterialDrawer
+ * @class QtMaterialDrawer
*/
QtMaterialDrawer::QtMaterialDrawer(QWidget *parent)
@@ -158,9 +158,10 @@ void QtMaterialDrawer::openDrawer()
void QtMaterialDrawer::closeDrawer()
{
Q_D(QtMaterialDrawer);
-
+ // emit signal to close
emit d->stateMachine->signalClose();
+ // reset the attribute
if (d->overlay) {
setAttribute(Qt::WA_TransparentForMouseEvents);
setAttribute(Qt::WA_NoSystemBackground);
@@ -184,6 +185,7 @@ bool QtMaterialDrawer::event(QEvent *event)
return QtMaterialOverlayWidget::event(event);
}
+// size
bool QtMaterialDrawer::eventFilter(QObject *obj, QEvent *event)
{
Q_D(QtMaterialDrawer);
@@ -192,7 +194,9 @@ bool QtMaterialDrawer::eventFilter(QObject *obj, QEvent *event)
case QEvent::MouseButtonPress: {
QMouseEvent *mouseEvent;
if ((mouseEvent = static_cast(event))) {
+ // check canClose
const bool canClose = d->clickToClose || d->overlay;
+ // auto close location
if (!d->widget->geometry().contains(mouseEvent->pos()) && canClose) {
closeDrawer();
}
@@ -222,6 +226,7 @@ void QtMaterialDrawer::paintEvent(QPaintEvent *event)
if (!d->overlay || d->stateMachine->isInClosedState()) {
return;
}
+ // shadow
QPainter painter(this);
painter.setOpacity(d->stateMachine->opacity());
painter.fillRect(rect(), Qt::SolidPattern);
diff --git a/components/qtmaterialdrawer_internal.cpp b/components/qtmaterialdrawer_internal.cpp
index 4482095..2bd2d93 100644
--- a/components/qtmaterialdrawer_internal.cpp
+++ b/components/qtmaterialdrawer_internal.cpp
@@ -7,8 +7,8 @@
#include
/*!
- * \class QtMaterialDrawerStateMachine
- * \internal
+ * @class QtMaterialDrawerStateMachine
+ * @internal
*/
QtMaterialDrawerStateMachine::QtMaterialDrawerStateMachine(QtMaterialDrawerWidget *drawer, QtMaterialDrawer *parent)
diff --git a/components/qtmaterialfab.cpp b/components/qtmaterialfab.cpp
index e76efa7..0a8e4c4 100644
--- a/components/qtmaterialfab.cpp
+++ b/components/qtmaterialfab.cpp
@@ -7,12 +7,12 @@
#include
/*!
- * \class QtMaterialFloatingActionButtonPrivate
- * \internal
+ * @class QtMaterialFloatingActionButtonPrivate
+ * @internal
*/
/*!
- * \internal
+ * @internal
*/
QtMaterialFloatingActionButtonPrivate::QtMaterialFloatingActionButtonPrivate(QtMaterialFloatingActionButton *q)
: QtMaterialRaisedButtonPrivate(q)
@@ -20,12 +20,12 @@ QtMaterialFloatingActionButtonPrivate::QtMaterialFloatingActionButtonPrivate(QtM
}
/*!
- * \internal
+ * @internal
*/
QtMaterialFloatingActionButtonPrivate::~QtMaterialFloatingActionButtonPrivate() {}
/*!
- * \internal
+ * @internal
*/
void QtMaterialFloatingActionButtonPrivate::init()
{
@@ -50,7 +50,7 @@ void QtMaterialFloatingActionButtonPrivate::init()
}
/*!
- * \internal
+ * @internal
*/
QRect QtMaterialFloatingActionButtonPrivate::fabGeometry() const
{
@@ -78,7 +78,7 @@ QRect QtMaterialFloatingActionButtonPrivate::fabGeometry() const
}
/*!
- * \internal
+ * @internal
*/
void QtMaterialFloatingActionButtonPrivate::setupProperties()
{
@@ -98,7 +98,7 @@ void QtMaterialFloatingActionButtonPrivate::setupProperties()
}
/*!
- * \class QtMaterialFloatingActionButton
+ * @class QtMaterialFloatingActionButton
*/
QtMaterialFloatingActionButton::QtMaterialFloatingActionButton(const QIcon &icon, QWidget *parent)
@@ -112,7 +112,7 @@ QtMaterialFloatingActionButton::QtMaterialFloatingActionButton(const QIcon &icon
QtMaterialFloatingActionButton::~QtMaterialFloatingActionButton() {}
/*!
- * \reimp
+ * @reimp
*/
QSize QtMaterialFloatingActionButton::sizeHint() const
{
@@ -222,7 +222,7 @@ int QtMaterialFloatingActionButton::yOffset() const
}
/*!
- * \reimp
+ * @reimp
*/
bool QtMaterialFloatingActionButton::event(QEvent *event)
{
@@ -248,7 +248,7 @@ bool QtMaterialFloatingActionButton::event(QEvent *event)
}
/*!
- * \reimp
+ * @reimp
*/
bool QtMaterialFloatingActionButton::eventFilter(QObject *obj, QEvent *event)
{
@@ -263,7 +263,7 @@ bool QtMaterialFloatingActionButton::eventFilter(QObject *obj, QEvent *event)
}
/*!
- * \reimp
+ * @reimp
*/
void QtMaterialFloatingActionButton::paintEvent(QPaintEvent *event)
{
diff --git a/components/qtmaterialraisedbutton.cpp b/components/qtmaterialraisedbutton.cpp
index 1607c70..95aed59 100644
--- a/components/qtmaterialraisedbutton.cpp
+++ b/components/qtmaterialraisedbutton.cpp
@@ -1,17 +1,17 @@
#include "qtmaterialraisedbutton.h"
#include "qtmaterialraisedbutton_p.h"
+#include
+#include
#include
#include
-#include
-#include
/*!
- * \class QtMaterialRaisedButtonPrivate
- * \internal
+ * @class QtMaterialRaisedButtonPrivate
+ * @internal
*/
/*!
- * \internal
+ * @internal
*/
QtMaterialRaisedButtonPrivate::QtMaterialRaisedButtonPrivate(QtMaterialRaisedButton *q)
: QtMaterialFlatButtonPrivate(q)
@@ -19,23 +19,21 @@ QtMaterialRaisedButtonPrivate::QtMaterialRaisedButtonPrivate(QtMaterialRaisedBut
}
/*!
- * \internal
+ * @internal
*/
-QtMaterialRaisedButtonPrivate::~QtMaterialRaisedButtonPrivate()
-{
-}
+QtMaterialRaisedButtonPrivate::~QtMaterialRaisedButtonPrivate() {}
/*!
- * \internal
+ * @internal
*/
void QtMaterialRaisedButtonPrivate::init()
{
Q_Q(QtMaterialRaisedButton);
shadowStateMachine = new QStateMachine(q);
- normalState = new QState;
- pressedState = new QState;
- effect = new QGraphicsDropShadowEffect;
+ normalState = new QState;
+ pressedState = new QState;
+ effect = new QGraphicsDropShadowEffect;
effect->setBlurRadius(7);
effect->setOffset(QPointF(0, 2));
@@ -84,7 +82,7 @@ void QtMaterialRaisedButtonPrivate::init()
}
/*!
- * \class QtMaterialRaisedButton
+ * @class QtMaterialRaisedButton
*/
QtMaterialRaisedButton::QtMaterialRaisedButton(QWidget *parent)
@@ -101,9 +99,7 @@ QtMaterialRaisedButton::QtMaterialRaisedButton(const QString &text, QWidget *par
setText(text);
}
-QtMaterialRaisedButton::~QtMaterialRaisedButton()
-{
-}
+QtMaterialRaisedButton::~QtMaterialRaisedButton() {}
QtMaterialRaisedButton::QtMaterialRaisedButton(QtMaterialRaisedButtonPrivate &d, QWidget *parent)
: QtMaterialFlatButton(d, parent)
diff --git a/components/qtmaterialraisedbutton_p.h b/components/qtmaterialraisedbutton_p.h
index 12df43c..37c9548 100644
--- a/components/qtmaterialraisedbutton_p.h
+++ b/components/qtmaterialraisedbutton_p.h
@@ -19,10 +19,10 @@ public:
void init();
- QStateMachine *shadowStateMachine;
- QState *normalState;
- QState *pressedState;
+ QStateMachine *shadowStateMachine;
+ QState *normalState;
+ QState *pressedState;
QGraphicsDropShadowEffect *effect;
};
-#endif // QTMATERIALRAISEDBUTTON_P_H
+#endif // QTMATERIALRAISEDBUTTON_P_H
diff --git a/components/qtmaterialscrollbar_p.h b/components/qtmaterialscrollbar_p.h
index 1d22cc0..3eeaf09 100644
--- a/components/qtmaterialscrollbar_p.h
+++ b/components/qtmaterialscrollbar_p.h
@@ -1,8 +1,8 @@
#ifndef QTMATERIALSCROLLBAR_P_H
#define QTMATERIALSCROLLBAR_P_H
-#include
#include
+#include
class QtMaterialScrollBar;
class QtMaterialScrollBarStateMachine;
@@ -18,13 +18,13 @@ public:
void init();
- QtMaterialScrollBar *const q_ptr;
+ QtMaterialScrollBar *const q_ptr;
QtMaterialScrollBarStateMachine *stateMachine;
- QColor backgroundColor;
- QColor sliderColor;
- QColor canvasColor;
- bool hideOnMouseOut;
- bool useThemeColors;
+ QColor backgroundColor;
+ QColor sliderColor;
+ QColor canvasColor;
+ bool hideOnMouseOut;
+ bool useThemeColors;
};
-#endif // QTMATERIALSCROLLBAR_P_H
+#endif // QTMATERIALSCROLLBAR_P_H
diff --git a/components/qtmaterialslider.cpp b/components/qtmaterialslider.cpp
index a0d17dc..8b1b1aa 100644
--- a/components/qtmaterialslider.cpp
+++ b/components/qtmaterialslider.cpp
@@ -1,10 +1,10 @@
#include "qtmaterialslider.h"
-#include "qtmaterialslider_p.h"
-#include
-#include
-#include "qtmaterialslider_internal.h"
-#include "lib/qtmaterialstyle.h"
#include "lib/qtmaterialstatetransitionevent.h"
+#include "lib/qtmaterialstyle.h"
+#include "qtmaterialslider_internal.h"
+#include "qtmaterialslider_p.h"
+#include
+#include
/*!
* \class QtMaterialSliderPrivate
@@ -16,33 +16,30 @@ QtMaterialSliderPrivate::QtMaterialSliderPrivate(QtMaterialSlider *q)
{
}
-QtMaterialSliderPrivate::~QtMaterialSliderPrivate()
-{
-}
+QtMaterialSliderPrivate::~QtMaterialSliderPrivate() {}
void QtMaterialSliderPrivate::init()
{
Q_Q(QtMaterialSlider);
- thumb = new QtMaterialSliderThumb(q);
- track = new QtMaterialSliderTrack(thumb, q);
- stateMachine = new QtMaterialSliderStateMachine(q, thumb, track);
- stepTo = 0;
- oldValue = q->value();
- trackWidth = 2;
- hoverTrack = false;
- hoverThumb = false;
- hover = false;
- step = false;
- pageStepMode = true;
+ thumb = new QtMaterialSliderThumb(q);
+ track = new QtMaterialSliderTrack(thumb, q);
+ stateMachine = new QtMaterialSliderStateMachine(q, thumb, track);
+ stepTo = 0;
+ oldValue = q->value();
+ trackWidth = 2;
+ hoverTrack = false;
+ hoverThumb = false;
+ hover = false;
+ step = false;
+ pageStepMode = true;
useThemeColors = true;
q->setMouseTracking(true);
q->setFocusPolicy(Qt::StrongFocus);
q->setPageStep(1);
- QSizePolicy sp(QSizePolicy::Expanding,
- QSizePolicy::Fixed);
+ QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Fixed);
if (q->orientation() == Qt::Vertical) {
sp.transpose();
@@ -59,24 +56,25 @@ QRectF QtMaterialSliderPrivate::trackBoundingRect() const
{
Q_Q(const QtMaterialSlider);
- qreal hw = static_cast(trackWidth)/2;
+ qreal hw = static_cast(trackWidth) / 2;
- return Qt::Horizontal == q->orientation()
- ? QRectF(QT_MATERIAL_SLIDER_MARGIN, q->height()/2 - hw,
- q->width() - QT_MATERIAL_SLIDER_MARGIN*2, hw*2)
- : QRectF(q->width()/2 - hw, QT_MATERIAL_SLIDER_MARGIN, hw*2,
- q->height() - QT_MATERIAL_SLIDER_MARGIN*2);
+ return Qt::Horizontal == q->orientation() ?
+ QRectF(QT_MATERIAL_SLIDER_MARGIN, q->height() / 2.0 - hw, q->width() - QT_MATERIAL_SLIDER_MARGIN * 2, hw * 2) :
+ QRectF(q->width() / 2.0 - hw, QT_MATERIAL_SLIDER_MARGIN, hw * 2, q->height() - QT_MATERIAL_SLIDER_MARGIN * 2);
}
QRectF QtMaterialSliderPrivate::thumbBoundingRect() const
{
Q_Q(const QtMaterialSlider);
- return Qt::Horizontal == q->orientation()
- ? QRectF(thumb->offset(), q->height()/2 - QT_MATERIAL_SLIDER_MARGIN,
- QT_MATERIAL_SLIDER_MARGIN*2, QT_MATERIAL_SLIDER_MARGIN*2)
- : QRectF(q->width()/2 - QT_MATERIAL_SLIDER_MARGIN, thumb->offset(),
- QT_MATERIAL_SLIDER_MARGIN*2, QT_MATERIAL_SLIDER_MARGIN*2);
+ return Qt::Horizontal == q->orientation() ? QRectF(thumb->offset(),
+ q->height() / 2.0 - QT_MATERIAL_SLIDER_MARGIN,
+ QT_MATERIAL_SLIDER_MARGIN * 2,
+ QT_MATERIAL_SLIDER_MARGIN * 2) :
+ QRectF(q->width() / 2.0 - QT_MATERIAL_SLIDER_MARGIN,
+ thumb->offset(),
+ QT_MATERIAL_SLIDER_MARGIN * 2,
+ QT_MATERIAL_SLIDER_MARGIN * 2);
}
int QtMaterialSliderPrivate::valueFromPosition(const QPoint &pos) const
@@ -85,16 +83,11 @@ int QtMaterialSliderPrivate::valueFromPosition(const QPoint &pos) const
const int position = Qt::Horizontal == q->orientation() ? pos.x() : pos.y();
- const int span = Qt::Horizontal == q->orientation()
- ? q->width() - QT_MATERIAL_SLIDER_MARGIN*2
- : q->height() - QT_MATERIAL_SLIDER_MARGIN*2;
+ const int span = Qt::Horizontal == q->orientation() ? q->width() - QT_MATERIAL_SLIDER_MARGIN * 2 :
+ q->height() - QT_MATERIAL_SLIDER_MARGIN * 2;
return QtMaterialStyle::sliderValueFromPosition(
- q->minimum(),
- q->maximum(),
- position - QT_MATERIAL_SLIDER_MARGIN,
- span,
- q->invertedAppearance());
+ q->minimum(), q->maximum(), position - QT_MATERIAL_SLIDER_MARGIN, span, q->invertedAppearance());
}
void QtMaterialSliderPrivate::setHovered(bool status)
@@ -123,15 +116,13 @@ void QtMaterialSliderPrivate::setHovered(bool status)
*/
QtMaterialSlider::QtMaterialSlider(QWidget *parent)
- : QAbstractSlider(parent),
- d_ptr(new QtMaterialSliderPrivate(this))
+ : QAbstractSlider(parent)
+ , d_ptr(new QtMaterialSliderPrivate(this))
{
d_func()->init();
}
-QtMaterialSlider::~QtMaterialSlider()
-{
-}
+QtMaterialSlider::~QtMaterialSlider() {}
void QtMaterialSlider::setUseThemeColors(bool value)
{
@@ -237,9 +228,7 @@ bool QtMaterialSlider::pageStepMode() const
*/
QSize QtMaterialSlider::minimumSizeHint() const
{
- return Qt::Horizontal == orientation()
- ? QSize(130, 34)
- : QSize(34, 130);
+ return Qt::Horizontal == orientation() ? QSize(130, 34) : QSize(34, 130);
}
void QtMaterialSlider::setInvertedAppearance(bool value)
@@ -256,16 +245,13 @@ void QtMaterialSlider::sliderChange(SliderChange change)
{
Q_D(QtMaterialSlider);
- if (SliderOrientationChange == change)
- {
+ if (SliderOrientationChange == change) {
QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Fixed);
if (orientation() == Qt::Vertical) {
sp.transpose();
}
setSizePolicy(sp);
- }
- else if (SliderValueChange == change)
- {
+ } else if (SliderValueChange == change) {
if (minimum() == value()) {
triggerAction(SliderToMinimum);
d->stateMachine->postEvent(new QtMaterialStateTransitionEvent(SliderChangedToMinimum));
@@ -290,12 +276,9 @@ void QtMaterialSlider::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QtMaterialSlider);
- if (isSliderDown())
- {
+ if (isSliderDown()) {
setSliderPosition(d->valueFromPosition(event->pos()));
- }
- else
- {
+ } else {
QRectF track(d->trackBoundingRect().adjusted(-2, -2, 2, 2));
if (track.contains(event->pos()) != d->hoverTrack) {
@@ -344,9 +327,7 @@ void QtMaterialSlider::mousePressEvent(QMouseEvent *event)
d->step = true;
d->stepTo = d->valueFromPosition(pos);
- SliderAction action = d->stepTo > sliderPosition()
- ? SliderPageStepAdd
- : SliderPageStepSub;
+ SliderAction action = d->stepTo > sliderPosition() ? SliderPageStepAdd : SliderPageStepSub;
triggerAction(action);
setRepeatAction(action, 400, 8);
@@ -398,9 +379,7 @@ void QtMaterialSlider::updateThumbOffset()
minimum(),
maximum(),
sliderPosition(),
- Qt::Horizontal == orientation()
- ? width() - QT_MATERIAL_SLIDER_MARGIN*2
- : height() - QT_MATERIAL_SLIDER_MARGIN*2,
+ Qt::Horizontal == orientation() ? width() - QT_MATERIAL_SLIDER_MARGIN * 2 : height() - QT_MATERIAL_SLIDER_MARGIN * 2,
invertedAppearance());
d->thumb->setOffset(offset);
diff --git a/components/qtmaterialslider_p.h b/components/qtmaterialslider_p.h
index ff6b7ca..baaf745 100644
--- a/components/qtmaterialslider_p.h
+++ b/components/qtmaterialslider_p.h
@@ -1,9 +1,9 @@
#ifndef QTMATERIALSLIDER_P_H
#define QTMATERIALSLIDER_P_H
-#include
#include
#include
+#include
class QtMaterialSlider;
class QtMaterialSliderThumb;
@@ -28,22 +28,22 @@ public:
void setHovered(bool status);
- QtMaterialSlider *const q_ptr;
- QtMaterialSliderThumb *thumb;
- QtMaterialSliderTrack *track;
+ QtMaterialSlider *const q_ptr;
+ QtMaterialSliderThumb *thumb;
+ QtMaterialSliderTrack *track;
QtMaterialSliderStateMachine *stateMachine;
- QColor thumbColor;
- QColor trackColor;
- QColor disabledColor;
- int stepTo;
- int oldValue;
- int trackWidth;
- bool hoverTrack;
- bool hoverThumb;
- bool hover;
- bool step;
- bool pageStepMode;
- bool useThemeColors;
+ QColor thumbColor;
+ QColor trackColor;
+ QColor disabledColor;
+ int stepTo;
+ int oldValue;
+ int trackWidth;
+ bool hoverTrack;
+ bool hoverThumb;
+ bool hover;
+ bool step;
+ bool pageStepMode;
+ bool useThemeColors;
};
-#endif // QTMATERIALSLIDER_P_H
+#endif // QTMATERIALSLIDER_P_H
diff --git a/examples/dialogsettingseditor.cpp b/examples/dialogsettingseditor.cpp
index f4e4916..2bcaa61 100644
--- a/examples/dialogsettingseditor.cpp
+++ b/examples/dialogsettingseditor.cpp
@@ -1,13 +1,13 @@
#include "dialogsettingseditor.h"
-#include
#include
+#include
#include
#include
DialogSettingsEditor::DialogSettingsEditor(QWidget *parent)
- : QWidget(parent),
- ui(new Ui::DialogSettingsForm),
- m_dialog(new QtMaterialDialog)
+ : QWidget(parent)
+ , ui(new Ui::DialogSettingsForm)
+ , m_dialog(new QtMaterialDialog)
{
QVBoxLayout *layout = new QVBoxLayout;
setLayout(layout);
@@ -26,6 +26,7 @@ DialogSettingsEditor::DialogSettingsEditor(QWidget *parent)
canvas->setLayout(layout);
canvas->setMaximumHeight(300);
+ // set parent
m_dialog->setParent(this);
QWidget *dialogWidget = new QWidget;
@@ -56,10 +57,6 @@ DialogSettingsEditor::~DialogSettingsEditor()
delete ui;
}
-void DialogSettingsEditor::setupForm()
-{
-}
+void DialogSettingsEditor::setupForm() {}
-void DialogSettingsEditor::updateWidget()
-{
-}
+void DialogSettingsEditor::updateWidget() {}
diff --git a/examples/dialogsettingseditor.h b/examples/dialogsettingseditor.h
index f922046..18caa64 100644
--- a/examples/dialogsettingseditor.h
+++ b/examples/dialogsettingseditor.h
@@ -1,8 +1,8 @@
#ifndef DIALOGSETTINGSEDITOR_H
#define DIALOGSETTINGSEDITOR_H
-#include
#include "ui_dialogsettingsform.h"
+#include
class QtMaterialDialog;
@@ -20,7 +20,7 @@ protected slots:
private:
Ui::DialogSettingsForm *const ui;
- QtMaterialDialog *const m_dialog;
+ QtMaterialDialog *const m_dialog;
};
-#endif // DIALOGSETTINGSEDITOR_H
+#endif // DIALOGSETTINGSEDITOR_H
diff --git a/examples/drawersettingseditor.h b/examples/drawersettingseditor.h
index 45f21af..f992843 100644
--- a/examples/drawersettingseditor.h
+++ b/examples/drawersettingseditor.h
@@ -1,8 +1,8 @@
#ifndef DRAWERSETTINGSEDITOR_H
#define DRAWERSETTINGSEDITOR_H
-#include
#include "ui_drawersettingsform.h"
+#include
class QtMaterialDrawer;
@@ -20,7 +20,7 @@ protected slots:
private:
Ui::DrawerSettingsForm *const ui;
- QtMaterialDrawer *const m_drawer;
+ QtMaterialDrawer *const m_drawer;
};
-#endif // DRAWERSETTINGSEDITOR_H
+#endif // DRAWERSETTINGSEDITOR_H
diff --git a/examples/iconbuttonsettingseditor.cpp b/examples/iconbuttonsettingseditor.cpp
index 4dbc518..1bd48fc 100644
--- a/examples/iconbuttonsettingseditor.cpp
+++ b/examples/iconbuttonsettingseditor.cpp
@@ -1,12 +1,12 @@
#include "iconbuttonsettingseditor.h"
#include
-#include
#include
+#include
IconButtonSettingsEditor::IconButtonSettingsEditor(QWidget *parent)
- : QWidget(parent),
- ui(new Ui::IconButtonSettingsForm),
- m_button(new QtMaterialIconButton(QtMaterialTheme::icon("toggle", "star")))
+ : QWidget(parent)
+ , ui(new Ui::IconButtonSettingsForm)
+ , m_button(new QtMaterialIconButton(QtMaterialTheme::icon("toggle", "star")))
{
init();
}
@@ -17,9 +17,9 @@ IconButtonSettingsEditor::~IconButtonSettingsEditor()
}
IconButtonSettingsEditor::IconButtonSettingsEditor(QtMaterialIconButton *button, QWidget *parent)
- : QWidget(parent),
- ui(new Ui::IconButtonSettingsForm),
- m_button(button)
+ : QWidget(parent)
+ , ui(new Ui::IconButtonSettingsForm)
+ , m_button(button)
{
init();
}
diff --git a/examples/radiobuttonsettingseditor.h b/examples/radiobuttonsettingseditor.h
index 76ad852..fa7ac82 100644
--- a/examples/radiobuttonsettingseditor.h
+++ b/examples/radiobuttonsettingseditor.h
@@ -1,8 +1,8 @@
#ifndef RADIOBUTTONSETTINGSEDITOR_H
#define RADIOBUTTONSETTINGSEDITOR_H
-#include
#include "ui_radiobuttonsettingsform.h"
+#include
class QtMaterialRadioButton;
class RadioButton;
@@ -22,9 +22,9 @@ protected slots:
private:
Ui::RadioButtonSettingsForm *const ui;
- QtMaterialRadioButton *const m_radioButton1;
- QtMaterialRadioButton *const m_radioButton2;
- QtMaterialRadioButton *const m_radioButton3;
+ QtMaterialRadioButton *const m_radioButton1;
+ QtMaterialRadioButton *const m_radioButton2;
+ QtMaterialRadioButton *const m_radioButton3;
};
-#endif // RADIOBUTTONSETTINGSEDITOR_H
+#endif // RADIOBUTTONSETTINGSEDITOR_H
diff --git a/examples/togglesettingseditor.h b/examples/togglesettingseditor.h
index a74553e..7cf5a56 100644
--- a/examples/togglesettingseditor.h
+++ b/examples/togglesettingseditor.h
@@ -1,8 +1,8 @@
#ifndef TOGGLESETTINGSEDITOR_H
#define TOGGLESETTINGSEDITOR_H
-#include
#include "ui_togglesettingsform.h"
+#include
class QtMaterialToggle;
@@ -21,7 +21,7 @@ protected slots:
private:
Ui::ToggleSettingsForm *const ui;
- QtMaterialToggle *const m_toggle;
+ QtMaterialToggle *const m_toggle;
};
-#endif // TOGGLESETTINGSEDITOR_H
+#endif // TOGGLESETTINGSEDITOR_H