mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: for printing/mobile access ProfileScene directly
Instead of using the interactive ProfileWidget2, just use the ProfileScene to render the profile for printing, export and mobile. One layer (QWidget) less. This removes all the kludges for handling DPR on mobile. Thus, the rendering will now be off and have to be fixed by redoing the scaling code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
84ebd1d67a
commit
51dc5113c2
10 changed files with 70 additions and 136 deletions
|
@ -16,7 +16,7 @@
|
|||
#include "core/selection.h"
|
||||
#include "core/taxonomy.h"
|
||||
#include "core/sample.h"
|
||||
#include "profile-widget/profilewidget2.h"
|
||||
#include "profile-widget/profilescene.h"
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QtConcurrent>
|
||||
|
@ -39,10 +39,9 @@ static constexpr int profileScale = 4;
|
|||
static constexpr int profileWidth = 800 * profileScale;
|
||||
static constexpr int profileHeight = 600 * profileScale;
|
||||
|
||||
static void exportProfile(ProfileWidget2 *profile, const struct dive *dive, const QString &filename)
|
||||
static void exportProfile(ProfileScene *profile, const struct dive *dive, const QString &filename)
|
||||
{
|
||||
profile->setProfileState(dive, 0);
|
||||
profile->plotDive(dive, 0, false, true);
|
||||
profile->plotDive(dive, 0, nullptr, false, true);
|
||||
QImage image = QImage(QSize(profileWidth, profileHeight), QImage::Format_RGB32);
|
||||
QPainter paint;
|
||||
paint.begin(&image);
|
||||
|
@ -50,11 +49,9 @@ static void exportProfile(ProfileWidget2 *profile, const struct dive *dive, cons
|
|||
image.save(filename);
|
||||
}
|
||||
|
||||
static std::unique_ptr<ProfileWidget2> getPrintProfile()
|
||||
static std::unique_ptr<ProfileScene> getPrintProfile()
|
||||
{
|
||||
auto profile = std::make_unique<ProfileWidget2>(nullptr, (double)profileScale, nullptr);
|
||||
profile->setPrintMode();
|
||||
return profile;
|
||||
return std::make_unique<ProfileScene>((double)profileScale, true, false);
|
||||
}
|
||||
|
||||
void exportProfile(QString filename, bool selected_only, ExportCallback &cb)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue