diff --git a/README.md b/README.md index edfcfd7..d6f2499 100644 --- a/README.md +++ b/README.md @@ -4,25 +4,234 @@ I finally took the time to go through and clean up this code. The build includes an executable with a preview, and some settings to play around with for each widget. A YouTube video preview is [available here](http://www.youtube.com/watch?v=21UMeNVBPU4). -Component | Preview ------------------ | ------------------------------------------------ -Avatar | ![Avatar](gifs/avatar.gif) -Check Box | ![Check Box](gifs/checkbox.gif) -Circular Progress | ![Circular Progressj](gifs/circularprogress.gif) -Dialog | ![Dialog](gifs/dialog.gif) -Drawer | ![Drawer](gifs/drawer.gif) -FAB | ![FAB](gifs/fab.gif) -Flat Button | ![Flat Button](gifs/flatbutton.gif) -Icon Button | ![Icon Button](gifs/iconbutton.gif) -Progress | ![Progress](gifs/progress.gif) -Radio Button | ![Radio Button](gifs/radiobutton.gif) -Raised Button | ![Raised Button](gifs/raisedbutton.gif) -Scroll Bar | ![Scroll Bar](gifs/scrollbar.gif) -Slider | ![Slider](gifs/slider.gif) -Snackbar | ![Snackbar](gifs/snackbar.gif) -Tabs | ![Tabs](gifs/tabs.gif) -Text Field | ![Text Field](gifs/textfield.gif) -Toggle | ![checkbox](gifs/toggle.gif) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Avatar + + QtMaterialAvatar +
+ +
+ Check Box + + QtMaterialCheckBox +
+ +
+ Circular Progress + + QtMaterialCircularProgress +
+ +
+ Dialog + + QtMaterialDialog +
+ +
+ Drawer + + QtMaterialDrawer +
+ +
+ FAB + + QtMaterialFloatingActionButton +
+ +
+ Flat Button + + QtMaterialFlatButton +
+ +
+ Icon Button + + QtMaterialIconButton +
+ +
+ Progress + + QtMaterialProgress +
+ +
+ Radio Button + + QtMaterialRadioButton +
+ +
+ Raised Button + + QtMaterialRaisedButton +
+ +
+ Scroll Bar + + QtMaterialScrollBar +
+ +
+ Slider + + QtMaterialSlider +
+ +
+ Snackbar + + QtMaterialSnackBar +
+ +
+ Tabs + + QtMaterialTabs +
+ +
+ Text Field + + QtMaterialTextField +
+ +
+ Toggle + + QtMaterialToggle +
+ +
#### Implemented components diff --git a/components/qtmaterialdrawer.cpp b/components/qtmaterialdrawer.cpp index d19262d..973ce9b 100644 --- a/components/qtmaterialdrawer.cpp +++ b/components/qtmaterialdrawer.cpp @@ -14,13 +14,34 @@ * \internal */ +/*! + * \internal + */ QtMaterialDrawerPrivate::QtMaterialDrawerPrivate(QtMaterialDrawer *q) - : q_ptr(q), - stateMachine(new QtMaterialDrawerStateMachine(q)), - window(new QWidget), - width(250), - clickToClose(false) + : q_ptr(q) { +} + +/*! + * \internal + */ +QtMaterialDrawerPrivate::~QtMaterialDrawerPrivate() +{ +} + +/*! + * \internal + */ +void QtMaterialDrawerPrivate::init() +{ + Q_Q(QtMaterialDrawer); + + stateMachine = new QtMaterialDrawerStateMachine(q); + window = new QWidget; + width = 250; + clickToClose = false; + autoRaise = true; + QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(window); @@ -28,7 +49,6 @@ QtMaterialDrawerPrivate::QtMaterialDrawerPrivate(QtMaterialDrawer *q) q->setFixedWidth(width+16); stateMachine->start(); - QCoreApplication::processEvents(); } @@ -40,6 +60,7 @@ QtMaterialDrawer::QtMaterialDrawer(QWidget *parent) : QtMaterialOverlayWidget(parent), d_ptr(new QtMaterialDrawerPrivate(this)) { + d_func()->init(); } QtMaterialDrawer::~QtMaterialDrawer() @@ -90,12 +111,29 @@ bool QtMaterialDrawer::clickOutsideToClose() const return d->clickToClose; } +void QtMaterialDrawer::setAutoRaise(bool state) +{ + Q_D(QtMaterialDrawer); + + d->autoRaise = state; +} + +bool QtMaterialDrawer::autoRaise() const +{ + Q_D(const QtMaterialDrawer); + + return d->autoRaise; +} + void QtMaterialDrawer::openDrawer() { Q_D(QtMaterialDrawer); emit d->stateMachine->enterOpenedState(); - raise(); + + if (d->autoRaise) { + raise(); + } } void QtMaterialDrawer::closeDrawer() diff --git a/components/qtmaterialdrawer.h b/components/qtmaterialdrawer.h index 2ceb1f9..6dd69e8 100644 --- a/components/qtmaterialdrawer.h +++ b/components/qtmaterialdrawer.h @@ -23,6 +23,9 @@ public: void setClickOutsideToClose(bool state); bool clickOutsideToClose() const; + void setAutoRaise(bool state); + bool autoRaise() const; + public slots: void openDrawer(); void closeDrawer(); diff --git a/components/qtmaterialdrawer_p.h b/components/qtmaterialdrawer_p.h index 671ee3b..1a1247f 100644 --- a/components/qtmaterialdrawer_p.h +++ b/components/qtmaterialdrawer_p.h @@ -13,12 +13,16 @@ class QtMaterialDrawerPrivate public: QtMaterialDrawerPrivate(QtMaterialDrawer *q); + ~QtMaterialDrawerPrivate(); + + void init(); QtMaterialDrawer *const q_ptr; - QtMaterialDrawerStateMachine *const stateMachine; - QWidget *const window; - int width; - bool clickToClose; + QtMaterialDrawerStateMachine *stateMachine; + QWidget *window; + int width; + bool clickToClose; + bool autoRaise; }; #endif // DRAWER_P_H