mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: pass fontPrintScale at construction time
Instead of intializing the text fields and then changing the font scale via signal-rigmarole, pass down the font-scale at construction time. Since the fontPrintScale is only set in print mode, we also can access it directly instead of testing for printMode. Since the DiveTextItem is not updated using signals anymore, the connected flag can be removed. The commit is larger than I had hoped for, but this makes things ultimately less brittle. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
7744fec0bf
commit
01983c65c3
9 changed files with 88 additions and 98 deletions
|
@ -9,9 +9,10 @@
|
|||
|
||||
static const qreal height = 3.0;
|
||||
|
||||
TankItem::TankItem(const DiveCartesianAxis &axis) :
|
||||
TankItem::TankItem(const DiveCartesianAxis &axis, double fontPrintScale) :
|
||||
hAxis(axis),
|
||||
plotEndTime(-1)
|
||||
plotEndTime(-1),
|
||||
fontPrintScale(fontPrintScale)
|
||||
{
|
||||
QColor red(PERSIANRED1);
|
||||
QColor blue(AIR_BLUE);
|
||||
|
@ -50,7 +51,7 @@ void TankItem::createBar(int startTime, int stopTime, struct gasmix gas)
|
|||
rect->setBrush(nitrox);
|
||||
rect->setPen(QPen(QBrush(), 0.0)); // get rid of the thick line around the rectangle
|
||||
rects.push_back(rect);
|
||||
DiveTextItem *label = new DiveTextItem(rect);
|
||||
DiveTextItem *label = new DiveTextItem(fontPrintScale, rect);
|
||||
label->setText(gasname(gas));
|
||||
label->setBrush(Qt::black);
|
||||
label->setPos(x + 1, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue