diff --git a/components/drawer.cpp b/components/drawer.cpp index 4936288..83f32bb 100644 --- a/components/drawer.cpp +++ b/components/drawer.cpp @@ -40,7 +40,7 @@ void Drawer::setDrawerWidth(int width) Q_D(Drawer); d->width = width; - d->stateMachine->assignProperties(); + d->stateMachine->updatePropertyAssignments(); setFixedWidth(width+16); } @@ -84,8 +84,9 @@ bool Drawer::eventFilter(QObject *obj, QEvent *event) const QEvent::Type type = event->type(); if (QEvent::Move == type || QEvent::Resize == type) { - if (layout() && 16 != layout()->contentsMargins().right()) { - layout()->setContentsMargins(0, 0, 16, 0); + QLayout *t = layout(); + if (t && 16 != t->contentsMargins().right()) { + t->setContentsMargins(0, 0, 16, 0); } } return OverlayWidget::eventFilter(obj, event); diff --git a/components/drawer.h b/components/drawer.h index 1d4ae2d..74f4546 100644 --- a/components/drawer.h +++ b/components/drawer.h @@ -28,15 +28,13 @@ protected: bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; - QRect overlayGeometry() const; + QRect overlayGeometry() const Q_DECL_OVERRIDE; const QScopedPointer d_ptr; private: Q_DISABLE_COPY(Drawer) Q_DECLARE_PRIVATE(Drawer) - -// friend class DrawerStateMachine; }; #endif // DRAWER_H diff --git a/components/drawer_internal.cpp b/components/drawer_internal.cpp index 5ca7ee2..aebbc24 100644 --- a/components/drawer_internal.cpp +++ b/components/drawer_internal.cpp @@ -37,7 +37,7 @@ DrawerStateMachine::DrawerStateMachine(Drawer *drawer) animation->setEasingCurve(QEasingCurve::InCirc); transition->addAnimation(animation); - assignProperties(); + updatePropertyAssignments(); } DrawerStateMachine::~DrawerStateMachine() @@ -54,7 +54,7 @@ void DrawerStateMachine::setOffset(int offset) } } -void DrawerStateMachine::assignProperties() +void DrawerStateMachine::updatePropertyAssignments() { m_closedState->assignProperty(this, "offset", -(m_drawer->width()+32)); m_openState->assignProperty(this, "offset", 0); diff --git a/components/drawer_internal.h b/components/drawer_internal.h index 35f1c45..d544cb1 100644 --- a/components/drawer_internal.h +++ b/components/drawer_internal.h @@ -18,7 +18,7 @@ public: void setOffset(int offset); inline int offset() const { return m_offset; } - void assignProperties(); + void updatePropertyAssignments(); signals: void enterOpenedState();