disabled drop preview animation

This commit is contained in:
fourtf
2018-05-08 20:35:31 +02:00
parent 463a1f1945
commit 5fcf42f1fc
6 changed files with 37 additions and 28 deletions
+21 -19
View File
@@ -1,4 +1,5 @@
#include "widgets/helper/droppreview.hpp"
#include "application.hpp"
#include "singletons/thememanager.hpp"
#include <QDebug>
@@ -9,9 +10,9 @@ namespace widgets {
NotebookPageDropPreview::NotebookPageDropPreview(BaseWidget *parent)
: BaseWidget(parent)
, positionAnimation(this, "geometry")
// , positionAnimation(this, "geometry")
{
this->positionAnimation.setEasingCurve(QEasingCurve(QEasingCurve::InCubic));
// this->positionAnimation.setEasingCurve(QEasingCurve(QEasingCurve::InCubic));
this->setHidden(true);
}
@@ -19,34 +20,35 @@ void NotebookPageDropPreview::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.fillRect(8, 8, this->width() - 17, this->height() - 17,
this->themeManager->splits.dropPreview);
painter.setPen(getApp()->themes->splits.dropPreviewBorder);
painter.setBrush(getApp()->themes->splits.dropPreview);
painter.drawRect(8, 8, this->width() - 17, this->height() - 17);
}
void NotebookPageDropPreview::hideEvent(QHideEvent *)
{
this->animate = false;
// this->animate = false;
}
void NotebookPageDropPreview::setBounds(const QRect &rect)
{
if (rect == this->desiredGeometry) {
return;
}
// if (rect == this->desiredGeometry) {
// return;
// }
if (this->animate) {
this->positionAnimation.stop();
this->positionAnimation.setDuration(50);
this->positionAnimation.setStartValue(this->geometry());
this->positionAnimation.setEndValue(rect);
this->positionAnimation.start();
} else {
this->setGeometry(rect);
}
// if (this->animate) {
// this->positionAnimation.stop();
// this->positionAnimation.setDuration(50);
// this->positionAnimation.setStartValue(this->geometry());
// this->positionAnimation.setEndValue(rect);
// this->positionAnimation.start();
// } else {
this->setGeometry(rect);
// }
this->desiredGeometry = rect;
// this->desiredGeometry = rect;
this->animate = true;
// this->animate = true;
}
} // namespace widgets