mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: add width() function to DiveCartesian axis
To properly layout the profile we need to know the expected space required by the vertical axes. In the general case, format the the text "999". For the partial-pressure-axis, use "0.99". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f713858ba4
commit
7dd9b65df0
4 changed files with 36 additions and 7 deletions
|
@ -59,15 +59,11 @@ const QString &DiveTextItem::text()
|
|||
return internalText;
|
||||
}
|
||||
|
||||
void DiveTextItem::updateText()
|
||||
QFont DiveTextItem::getFont(double dpr, double scale)
|
||||
{
|
||||
double size;
|
||||
if (internalText.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QFont fnt(qApp->font());
|
||||
if ((size = fnt.pixelSize()) > 0) {
|
||||
double size = fnt.pixelSize();
|
||||
if (size > 0) {
|
||||
// set in pixels - so the scale factor may not make a difference if it's too close to 1
|
||||
size *= scale * dpr;
|
||||
fnt.setPixelSize(lrint(size));
|
||||
|
@ -76,6 +72,15 @@ void DiveTextItem::updateText()
|
|||
size *= scale * dpr;
|
||||
fnt.setPointSizeF(size);
|
||||
}
|
||||
return fnt;
|
||||
}
|
||||
|
||||
void DiveTextItem::updateText()
|
||||
{
|
||||
if (internalText.isEmpty())
|
||||
return;
|
||||
|
||||
QFont fnt = getFont(dpr, scale);
|
||||
QFontMetrics fm(fnt);
|
||||
|
||||
QPainterPath textPath;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue