change some names etc.

This commit is contained in:
laserpants 2016-06-24 08:06:14 +03:00
parent 03f2571f34
commit ba81f09252
4 changed files with 8 additions and 9 deletions

View File

@ -40,7 +40,7 @@ void Drawer::setDrawerWidth(int width)
Q_D(Drawer); Q_D(Drawer);
d->width = width; d->width = width;
d->stateMachine->assignProperties(); d->stateMachine->updatePropertyAssignments();
setFixedWidth(width+16); setFixedWidth(width+16);
} }
@ -84,8 +84,9 @@ bool Drawer::eventFilter(QObject *obj, QEvent *event)
const QEvent::Type type = event->type(); const QEvent::Type type = event->type();
if (QEvent::Move == type || QEvent::Resize == type) { if (QEvent::Move == type || QEvent::Resize == type) {
if (layout() && 16 != layout()->contentsMargins().right()) { QLayout *t = layout();
layout()->setContentsMargins(0, 0, 16, 0); if (t && 16 != t->contentsMargins().right()) {
t->setContentsMargins(0, 0, 16, 0);
} }
} }
return OverlayWidget::eventFilter(obj, event); return OverlayWidget::eventFilter(obj, event);

View File

@ -28,15 +28,13 @@ protected:
bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE; bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
QRect overlayGeometry() const; QRect overlayGeometry() const Q_DECL_OVERRIDE;
const QScopedPointer<DrawerPrivate> d_ptr; const QScopedPointer<DrawerPrivate> d_ptr;
private: private:
Q_DISABLE_COPY(Drawer) Q_DISABLE_COPY(Drawer)
Q_DECLARE_PRIVATE(Drawer) Q_DECLARE_PRIVATE(Drawer)
// friend class DrawerStateMachine;
}; };
#endif // DRAWER_H #endif // DRAWER_H

View File

@ -37,7 +37,7 @@ DrawerStateMachine::DrawerStateMachine(Drawer *drawer)
animation->setEasingCurve(QEasingCurve::InCirc); animation->setEasingCurve(QEasingCurve::InCirc);
transition->addAnimation(animation); transition->addAnimation(animation);
assignProperties(); updatePropertyAssignments();
} }
DrawerStateMachine::~DrawerStateMachine() 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_closedState->assignProperty(this, "offset", -(m_drawer->width()+32));
m_openState->assignProperty(this, "offset", 0); m_openState->assignProperty(this, "offset", 0);

View File

@ -18,7 +18,7 @@ public:
void setOffset(int offset); void setOffset(int offset);
inline int offset() const { return m_offset; } inline int offset() const { return m_offset; }
void assignProperties(); void updatePropertyAssignments();
signals: signals:
void enterOpenedState(); void enterOpenedState();