mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
For warnings, show icon in infobox
Render a warning sign in front of the event string in the infobox. This is done in rich text. Note: This shows the warning sign for all events, not just warnings. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
d306ba9b38
commit
77a5ca4234
4 changed files with 7 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
|||
infobox: show an icon for warnings
|
||||
import: allow import of divesites without UUID
|
||||
profile: implement panning of the profile
|
||||
planner: allow handle manipulation in zoomed in state
|
||||
|
|
|
@ -170,7 +170,7 @@ void DiveEventItem::setupToolTipString(struct gasmix lastgasmix)
|
|||
name += ev->flags & SAMPLE_FLAGS_BEGIN ? tr(" begin", "Starts with space!") :
|
||||
ev->flags & SAMPLE_FLAGS_END ? tr(" end", "Starts with space!") : "";
|
||||
}
|
||||
setToolTip(name);
|
||||
setToolTip(QString("<img height=\"16\" src=\":status-warning-icon\"> ") + name);
|
||||
}
|
||||
|
||||
void DiveEventItem::eventVisibilityChanged(const QString&, bool)
|
||||
|
|
|
@ -26,9 +26,10 @@ void ToolTipItem::addToolTip(const QString &toolTip, const QPixmap &pixmap)
|
|||
const int sp2 = iconMetrics.spacing * 2;
|
||||
iconItem->setPos(sp2, yValue);
|
||||
|
||||
QGraphicsSimpleTextItem *textItem = new QGraphicsSimpleTextItem(toolTip, this);
|
||||
QGraphicsTextItem *textItem = new QGraphicsTextItem(this);
|
||||
textItem->setHtml(toolTip);
|
||||
textItem->setPos(sp2 + iconMetrics.sz_small + sp2, yValue);
|
||||
textItem->setBrush(QBrush(Qt::white));
|
||||
textItem->setDefaultTextColor(Qt::white);
|
||||
textItem->setFlag(ItemIgnoresTransformations);
|
||||
toolTips.push_back(qMakePair(iconItem, textItem));
|
||||
}
|
||||
|
@ -251,7 +252,7 @@ void ToolTipItem::refresh(const dive *d, const QPointF &pos, bool inPlanner)
|
|||
painter.setPen(QColor(0, 0, 0, 127));
|
||||
for (int i = 0; i < 16; i++)
|
||||
painter.drawLine(i, 60, i, 60 - entry->percentages[i] / 2);
|
||||
entryToolTip.second->setText(QString::fromUtf8(mb.buffer, mb.len));
|
||||
entryToolTip.second->setPlainText(QString::fromUtf8(mb.buffer, mb.len));
|
||||
}
|
||||
entryToolTip.first->setPixmap(tissues);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ slots:
|
|||
void setRect(const QRectF &rect);
|
||||
|
||||
private:
|
||||
typedef QPair<QGraphicsPixmapItem *, QGraphicsSimpleTextItem *> ToolTip;
|
||||
typedef QPair<QGraphicsPixmapItem *, QGraphicsTextItem *> ToolTip;
|
||||
QVector<ToolTip> toolTips;
|
||||
ToolTip entryToolTip;
|
||||
QGraphicsSimpleTextItem *title;
|
||||
|
|
Loading…
Reference in a new issue