The scaling needs to happen before we draw the profile on the viewport, not
before we render that viewport into the pixmap. This is why prior to this patch
the first time the profile was rendered it was way off, but then if it got
re-rendered things worked better. I'm still not 100% happy with the size and
position of the profile, but this is a huge improvement.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The asynchronous nature of the profile bites us here. plotDive() signals
that it changes model data and expects the rest of the data structures to
respond to that. Very neat and it seems to work perfectly well on the
desktop, but on Android calling render() right after plotDive() resulted
in paint() functions being called before all the elements had been
calculated as a result of the signals being emitted in the model change.
That's why so often the profile was missing parts.
Now admittedly this makes me nervous. Do we now know that all calculations
have finished by the time render() gets called? Not really. It just seems
that in my testing we tend to get lucky and things work out. But that does
not feel like a sane architecture to me.
Messing around with the animation speed is silly as we render the profile
into a pixmap, so let's turn this off globally.
Also, the scaling of the pixmap is still completely bogus.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- paint() can become a hot path, especially when we think about
repainting the item on size changes. In general, it's a really good
idea to keep this function as fast as possible, as we want to be able to
repaint the item when needed. Also, ProfileWidget is pretty heavy to
set up, so rather spend a bit of memory there.
- Rename profile to m_profileWidget, it already was member var.
- Sizing ... I have to admit I don't understand the rendering of the
ProfileWidget. I'd like it to do the following things:
- render at native resolution, we don't want to resize it
- react to item changes - we want to reset the size and
re-render the widget into the item in those cases
- perhaps be able to use a couple more of the profilewidget's
features
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This resizes the dive profile to always maintain an equal width and
height, so that the sizing is the same in all devices.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a better way for showing the profile. The show() and hide()
statements are replaced by a QTransform statement.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Add a C++ class to render the dive profile. The rendered image is then
passed on to QML.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>