mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:23:23 +00:00
profile: scale dive event items according to font print scale
When printing with low DPI, the dive event items become comically large, because they are not resized like the fonts. Therefore, scale using the fontPrintScale. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
6b2e56e513
commit
65580fceda
3 changed files with 7 additions and 6 deletions
|
@ -16,7 +16,7 @@
|
|||
|
||||
DiveEventItem::DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix,
|
||||
DivePlotDataModel *model, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis,
|
||||
int speed, QGraphicsItem *parent) : DivePixmapItem(parent),
|
||||
int speed, double fontPrintScale, QGraphicsItem *parent) : DivePixmapItem(parent),
|
||||
vAxis(vAxis),
|
||||
hAxis(hAxis),
|
||||
dataModel(model),
|
||||
|
@ -25,7 +25,7 @@ DiveEventItem::DiveEventItem(const struct dive *d, struct event *ev, struct gasm
|
|||
{
|
||||
setFlag(ItemIgnoresTransformations);
|
||||
|
||||
setupPixmap(lastgasmix);
|
||||
setupPixmap(lastgasmix, fontPrintScale);
|
||||
setupToolTipString(lastgasmix);
|
||||
recalculatePos(0);
|
||||
|
||||
|
@ -48,7 +48,7 @@ struct event *DiveEventItem::getEventMutable()
|
|||
return ev;
|
||||
}
|
||||
|
||||
void DiveEventItem::setupPixmap(struct gasmix lastgasmix)
|
||||
void DiveEventItem::setupPixmap(struct gasmix lastgasmix, double fontPrintScale)
|
||||
{
|
||||
const IconMetrics& metrics = defaultIconMetrics();
|
||||
#ifndef SUBSURFACE_MOBILE
|
||||
|
@ -63,6 +63,7 @@ void DiveEventItem::setupPixmap(struct gasmix lastgasmix)
|
|||
int sz_bigger = metrics.sz_big + metrics.sz_med;
|
||||
#endif
|
||||
#endif
|
||||
sz_bigger = lrint(sz_bigger * fontPrintScale);
|
||||
int sz_pix = sz_bigger/2; // ex 20px
|
||||
|
||||
#define EVENT_PIXMAP(PIX) QPixmap(QString(PIX)).scaled(sz_pix, sz_pix, Qt::KeepAspectRatio, Qt::SmoothTransformation)
|
||||
|
|
|
@ -13,7 +13,7 @@ class DiveEventItem : public DivePixmapItem {
|
|||
public:
|
||||
DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix,
|
||||
DivePlotDataModel *model, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis,
|
||||
int speed, QGraphicsItem *parent = nullptr);
|
||||
int speed, double fontPrintScale, QGraphicsItem *parent = nullptr);
|
||||
~DiveEventItem();
|
||||
const struct event *getEvent() const;
|
||||
struct event *getEventMutable();
|
||||
|
@ -28,7 +28,7 @@ slots:
|
|||
|
||||
private:
|
||||
void setupToolTipString(struct gasmix lastgasmix);
|
||||
void setupPixmap(struct gasmix lastgasmix);
|
||||
void setupPixmap(struct gasmix lastgasmix, double fontPrintScale);
|
||||
int depthAtTime(int time);
|
||||
DiveCartesianAxis *vAxis;
|
||||
DiveCartesianAxis *hAxis;
|
||||
|
|
|
@ -721,7 +721,7 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, bool doClearPict
|
|||
// printMode is always selected for SUBSURFACE_MOBILE due to font problems
|
||||
// BUT events are wanted.
|
||||
#endif
|
||||
DiveEventItem *item = new DiveEventItem(d, event, lastgasmix, dataModel, timeAxis, profileYAxis, animSpeed);
|
||||
DiveEventItem *item = new DiveEventItem(d, event, lastgasmix, dataModel, timeAxis, profileYAxis, animSpeed, getFontPrintScale());
|
||||
item->setZValue(2);
|
||||
#ifndef SUBSURFACE_MOBILE
|
||||
item->setScale(printMode ? 4 :1);
|
||||
|
|
Loading…
Add table
Reference in a new issue