mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
c99089e1fa
This commit is rather big, and I forgot to cut it in pieces. The first part creates a new 'calculate_gas_information' that will not fill the profile_info->maxpp member ( that should be removed from it as soon as the new dialog is finished ). The reason for that is that all of the profile data will be calculated and the graph needs to update dynamically, so whenever the settings changes, I ask for the model which is the biggest graph and replot only the ones we need. The second part adds a new animation function 'animdelete' to fade-out and delete the item when it's done. the old function 'hide' did just that but a hide shouldn't delete anything. The third part is preferenes awareness for the PP graphs. I created two new functions that receive the settings key for visibility and use the QSettings to show / hide them. This also works quite well for the axis; if no graph is visible, the axis will also hide itself. The fourth part is colors. The pp graphs now have the correct colors. And a bit of code cleanup too. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
32 lines
893 B
C++
32 lines
893 B
C++
#include "animationfunctions.h"
|
|
#include <QPropertyAnimation>
|
|
#include <QPointF>
|
|
|
|
namespace Animations {
|
|
|
|
void hide(QObject* obj)
|
|
{
|
|
QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity");
|
|
animation->setStartValue(1);
|
|
animation->setEndValue(0);
|
|
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
|
}
|
|
|
|
void animDelete(QObject* obj)
|
|
{
|
|
QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity");
|
|
obj->connect(animation, SIGNAL(finished()), SLOT(deleteLater()));
|
|
animation->setStartValue(1);
|
|
animation->setEndValue(0);
|
|
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
|
}
|
|
|
|
void moveTo(QObject* obj, qreal x, qreal y)
|
|
{
|
|
QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos");
|
|
animation->setStartValue(obj->property("pos").toPointF());
|
|
animation->setEndValue(QPointF(x, y));
|
|
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
|
}
|
|
|
|
}
|