added animation to NotebookPageDropPreview
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user