mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Save / Restore the QPainter before operations.
I don't know if this fixes anything, but it is asked of us to do that by the Qt docs. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
774a785a99
commit
d3c0a723b8
2 changed files with 12 additions and 0 deletions
|
@ -353,6 +353,7 @@ void ProfilePrintDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||
const int row = index.row();
|
||||
const int col = index.column();
|
||||
|
||||
painter->save();
|
||||
// grid color
|
||||
painter->setPen(QPen(QColor(0xff999999)));
|
||||
// horizontal lines
|
||||
|
@ -366,6 +367,7 @@ void ProfilePrintDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||
if (col == 4 || (col == 0 && row > 5))
|
||||
painter->drawLine(rect.topRight(), rect.bottomRight());
|
||||
}
|
||||
painter->restore();
|
||||
QStyledItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ void DiveProfileItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
|
|||
if (polygon().isEmpty())
|
||||
return;
|
||||
|
||||
painter->save();
|
||||
// This paints the Polygon + Background. I'm setting the pen to QPen() so we don't get a black line here,
|
||||
// after all we need to plot the correct velocities colors later.
|
||||
setPen(Qt::NoPen);
|
||||
|
@ -138,6 +139,7 @@ void DiveProfileItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
|
|||
painter->setPen(pen);
|
||||
painter->drawLine(poly[i - 1], poly[i]);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
int DiveProfileItem::maxCeiling(int row)
|
||||
|
@ -325,8 +327,10 @@ void DiveHeartrateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
|||
{
|
||||
if (polygon().isEmpty())
|
||||
return;
|
||||
painter->save();
|
||||
painter->setPen(pen());
|
||||
painter->drawPolyline(polygon());
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void DiveHeartrateItem::settingsChanged()
|
||||
|
@ -421,8 +425,10 @@ void DiveTemperatureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
|
|||
{
|
||||
if (polygon().isEmpty())
|
||||
return;
|
||||
painter->save();
|
||||
painter->setPen(pen());
|
||||
painter->drawPolyline(polygon());
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||
|
@ -516,6 +522,7 @@ void DiveGasPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
|
|||
QPen pen;
|
||||
pen.setCosmetic(true);
|
||||
pen.setWidth(2);
|
||||
painter->save();
|
||||
struct plot_data *entry = dataModel->data().entry;
|
||||
Q_FOREACH (const QPolygonF &poly, polygons) {
|
||||
for (int i = 1, count = poly.count(); i < count; i++, entry++) {
|
||||
|
@ -524,6 +531,7 @@ void DiveGasPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
|
|||
painter->drawLine(poly[i - 1], poly[i]);
|
||||
}
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
DiveCalculatedCeiling::DiveCalculatedCeiling() : is3mIncrement(false), gradientFactor(new DiveTextItem(this))
|
||||
|
@ -711,6 +719,7 @@ void PartialPressureGasItem::modelDataChanged(const QModelIndex &topLeft, const
|
|||
void PartialPressureGasItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
const qreal pWidth = 0.0;
|
||||
painter->save();
|
||||
painter->setPen(QPen(normalColor, pWidth));
|
||||
painter->drawPolyline(polygon());
|
||||
|
||||
|
@ -718,6 +727,7 @@ void PartialPressureGasItem::paint(QPainter *painter, const QStyleOptionGraphics
|
|||
painter->setPen(QPen(alertColor, pWidth));
|
||||
Q_FOREACH (const QPolygonF &poly, alertPolygons)
|
||||
painter->drawPolyline(poly);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void PartialPressureGasItem::setThreshouldSettingsKey(const QString &threshouldSettingsKey)
|
||||
|
|
Loading…
Add table
Reference in a new issue