Visual clue chartbar tab has a menu

.. hover shows the menu indicator as subtly as possible, but will
   indicate to user there is a menu popup there as they hover.
This commit is contained in:
Mark Liversedge
2020-06-17 14:34:47 +01:00
parent 3be603a9ee
commit 9dbfc10e04

View File

@@ -465,15 +465,23 @@ ChartBarItem::paintEvent(QPaintEvent *)
if (checked) painter.fillRect(QRect(0,0,geometry().width(), 3*dpiXFactor), QBrush(GColor(CPLOTMARKER)));
// draw the menu indicator
if (underMouse() && checked) {
if (underMouse()) {
QPoint mouse = mapFromGlobal(QCursor::pos());
QBrush brush(Qt::darkGray);
painter.setPen (Qt :: NoPen);
// different color if under mouse
if (hotspot.contains(mouse)) brush.setColor(GColor(CPLOTMARKER));
painter.fillPath (triangle, brush);
if (checked) {
// different color if under mouse
QBrush brush(Qt::darkGray);
if (hotspot.contains(mouse)) brush.setColor(GColor(CPLOTMARKER));
painter.fillPath (triangle, brush);
} else {
// visual clue there is a menu option when tab selected
QBrush brush(Qt::lightGray);
painter.fillPath (triangle, brush);
}
}
painter.restore();
}