12 return QRectF(
geometry(canvas_rect).topRight(), QSize(8,-8) );
14 return QRectF(
geometry(canvas_rect).topLeft(), QSize(-8,-8) );
19 const QRectF &rect)
const 33 painter->setPen( col );
34 painter->setBrush( QBrush(col, Qt::SolidPattern) );
35 painter->drawRect( iconRect );
37 QPen black_pen (Qt::black);
38 black_pen.setWidth(2);
39 painter->setPen( black_pen );
42 painter->drawEllipse( iconRect );
50 const QRectF &rect )
const 55 const QRectF r = rect.toRect().adjusted( m, m, -m, -m );
57 painter->setClipRect( r, Qt::IntersectClip );
64 QRectF iconRect( r.topLeft(), graphic.
defaultSize() );
67 QPoint( iconRect.center().x(), rect.center().y() ) );
71 graphic.
render( painter, iconRect, Qt::KeepAspectRatio );
74 titleOff += iconRect.width() +
spacing();
83 pen.setColor( Qt::gray );
85 painter->setPen( pen );
86 painter->setFont(
font() );
88 const QRectF textRect = r.adjusted( titleOff, 0, 0, 0 );
89 text.
draw( painter, textRect );
96 if ( mouse_event->modifiers() == Qt::ControlModifier &&
isVisible() )
99 auto legend_rect =
geometry( canvas_rect );
100 if( legend_rect.contains( mouse_event->pos()) )
102 int point_size =
font().pointSize();
103 if( mouse_event->delta() > 0 && point_size < 14)
107 if( mouse_event->delta() < 0 && point_size > 6)
120 const QPoint press_point = mouse_event->pos();
122 if(
isVisible() && mouse_event->modifiers() == Qt::NoModifier)
129 if( item_rect.contains( press_point ))
const QwtPlotItem * processMousePressEvent(QMouseEvent *mouse_event)
void render(QPainter *) const
Replay all recorded painter commands.
QSizeF defaultSize() const
Default size.
virtual QRect geometry(const QRectF &canvasRect) const
virtual void replot()
Redraw the plot.
void draw(QPainter *painter, const QRectF &rect) const
virtual void draw(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &rect) const
virtual void drawLegendData(QPainter *painter, const QwtPlotItem *, const QwtLegendData &, const QRectF &) const override
QList< const QwtPlotItem * > plotItems() const
A class representing a text.
A paint device for scalable graphics.
QRectF hideButtonRect() const
virtual void draw(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &rect) const override
Base class for items on the plot canvas.
QList< QRect > legendGeometries(const QwtPlotItem *) const
bool processWheelEvent(QWheelEvent *ev)
Qt::Alignment alignment() const
Attributes of an entry on a legend.
void legendSizeChanged(int point_size)