mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add legend for the Partial Gass Pressure if active.
This patch adds legend for the partial gass pressures if the graphs are active. when enabling / disabling the square that represents the color of a gas will also appear / disappear. Fixes: #272 [Dirk Hohndel: minor changes to layout and whitespace] Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a7bdf39339
commit
a75168dcc9
2 changed files with 20 additions and 0 deletions
|
@ -590,6 +590,8 @@ void ProfileGraphicsView::plot_pp_gas_profile()
|
|||
setup_pp_limits(&gc);
|
||||
QColor c;
|
||||
QPointF from, to;
|
||||
QPointF legendPos = QPointF(scene()->sceneRect().width() * 0.4, scene()->sceneRect().height() - 15);
|
||||
|
||||
if (prefs.pp_graphs.pn2) {
|
||||
c = getColor(PN2);
|
||||
entry = pi->entry;
|
||||
|
@ -612,6 +614,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
|
|||
else
|
||||
from = QPointF(SCALEGC(entry->sec, entry->pn2));
|
||||
}
|
||||
createPPLegend(tr("Pn2"),getColor(PN2), legendPos);
|
||||
}
|
||||
|
||||
if (prefs.pp_graphs.phe) {
|
||||
|
@ -637,6 +640,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
|
|||
else
|
||||
from = QPointF(SCALEGC(entry->sec, entry->phe));
|
||||
}
|
||||
createPPLegend(tr("PHE"),getColor(PHE), legendPos);
|
||||
}
|
||||
if (prefs.pp_graphs.po2) {
|
||||
c = getColor(PO2);
|
||||
|
@ -660,9 +664,24 @@ void ProfileGraphicsView::plot_pp_gas_profile()
|
|||
else
|
||||
from = QPointF(SCALEGC(entry->sec, entry->po2));
|
||||
}
|
||||
createPPLegend(tr("PO2"),getColor(PO2), legendPos);
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileGraphicsView::createPPLegend(QString title, const QColor& c, QPointF& legendPos)
|
||||
{
|
||||
QGraphicsRectItem *rect = new QGraphicsRectItem(0, 0, 16, 16);
|
||||
rect->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||
rect->setBrush(QBrush(c));
|
||||
rect->setPos(legendPos);
|
||||
QGraphicsSimpleTextItem *text = new QGraphicsSimpleTextItem(title);
|
||||
text->setPos(legendPos.x() + rect->boundingRect().width() + 5, legendPos.y() - 6);
|
||||
text->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||
scene()->addItem(rect);
|
||||
scene()->addItem(text);
|
||||
legendPos.setX( legendPos.x() + 100);
|
||||
}
|
||||
|
||||
void ProfileGraphicsView::plot_deco_text()
|
||||
{
|
||||
if (prefs.profile_calc_ceiling) {
|
||||
|
|
|
@ -185,6 +185,7 @@ private:
|
|||
QColor getColor(const color_indice_t i);
|
||||
QColor get_sac_color(int sac, int avg_sac);
|
||||
void scrollViewTo(const QPoint pos);
|
||||
void createPPLegend(QString tr, const QColor& c, QPointF& legendPos);
|
||||
|
||||
QPen defaultPen;
|
||||
QBrush defaultBrush;
|
||||
|
|
Loading…
Add table
Reference in a new issue