added animation to NotebookPageDropPreview

This commit is contained in:
fourtf
2017-01-16 17:20:48 +01:00
parent d7f98030e1
commit 7901071408
3 changed files with 28 additions and 2 deletions
+18
View File
@@ -4,6 +4,8 @@
NotebookPageDropPreview::NotebookPageDropPreview(QWidget *parent)
: QWidget(parent)
, m_positionAnimation(this, "geometry")
, m_desiredGeometry()
{
setHidden(true);
}
@@ -16,3 +18,19 @@ NotebookPageDropPreview::paintEvent(QPaintEvent *)
painter.fillRect(8, 8, width() - 17, height() - 17,
ColorScheme::instance().DropPreviewBackground);
}
void
NotebookPageDropPreview::setBounds(const QRect &rect)
{
if (rect == m_desiredGeometry) {
return;
}
m_positionAnimation.stop();
m_positionAnimation.setDuration(50);
m_positionAnimation.setStartValue(geometry());
m_positionAnimation.setEndValue(rect);
m_positionAnimation.start();
m_desiredGeometry = rect;
}