mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3780 Get rid of debug output from painter
* don't really need the boundingRect override for RiuQwtSymbol * And it needs a painter * Just get rid of it and pass in the painter for the labelBoundingRect
This commit is contained in:
parent
1ffcca8f20
commit
2e8c2e28a8
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include "RiuQwtSymbol.h"
|
#include "RiuQwtSymbol.h"
|
||||||
|
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -130,7 +132,7 @@ void RiuQwtSymbol::renderSymbolLabel(QPainter *painter, const QPointF& position)
|
|||||||
{
|
{
|
||||||
QSize symbolSize = QwtSymbol::size();
|
QSize symbolSize = QwtSymbol::size();
|
||||||
QRect symbolRect (position.x(), position.y(), symbolSize.width(), symbolSize.height());
|
QRect symbolRect (position.x(), position.y(), symbolSize.width(), symbolSize.height());
|
||||||
QRect labelRect = labelBoundingRect(symbolRect);
|
QRect labelRect = labelBoundingRect(painter, symbolRect);
|
||||||
painter->drawText(labelRect.topLeft(), m_label);
|
painter->drawText(labelRect.topLeft(), m_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,24 +147,16 @@ void RiuQwtSymbol::setLabelPosition(LabelPosition labelPosition)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QRect RiuQwtSymbol::boundingRect() const
|
QRect RiuQwtSymbol::labelBoundingRect(const QPainter* painter, const QRect& symbolRect) const
|
||||||
{
|
{
|
||||||
QRect symbolRect = QwtSymbol::boundingRect();
|
CVF_ASSERT(painter);
|
||||||
QRect labelRect = labelBoundingRect(symbolRect);
|
|
||||||
return symbolRect.united(labelRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QRect RiuQwtSymbol::labelBoundingRect(const QRect& symbolRect) const
|
|
||||||
{
|
|
||||||
QPoint symbolPosition = symbolRect.topLeft();
|
QPoint symbolPosition = symbolRect.topLeft();
|
||||||
|
|
||||||
int symbolWidth = symbolRect.width();
|
int symbolWidth = symbolRect.width();
|
||||||
|
|
||||||
int labelWidth = QPainter().fontMetrics().width(m_label);
|
int labelWidth = painter->fontMetrics().width(m_label);
|
||||||
int labelHeight = QPainter().fontMetrics().height();
|
int labelHeight = painter->fontMetrics().height();
|
||||||
|
|
||||||
QPoint labelPosition;
|
QPoint labelPosition;
|
||||||
if (m_labelPosition == LabelAboveSymbol)
|
if (m_labelPosition == LabelAboveSymbol)
|
||||||
|
@ -55,15 +55,13 @@ public:
|
|||||||
|
|
||||||
RiuQwtSymbol(PointSymbolEnum riuStyle, const QString& label, LabelPosition labelPosition = LabelAboveSymbol);
|
RiuQwtSymbol(PointSymbolEnum riuStyle, const QString& label, LabelPosition labelPosition = LabelAboveSymbol);
|
||||||
|
|
||||||
void renderSymbols(QPainter *painter, const QPointF *points, int numPoints) const override;
|
void renderSymbols(QPainter *painter, const QPointF *points, int numPoints) const override;
|
||||||
void renderSymbolLabel(QPainter *painter, const QPointF& position) const;
|
void renderSymbolLabel(QPainter *painter, const QPointF& position) const;
|
||||||
QString label() const { return m_label; }
|
QString label() const { return m_label; }
|
||||||
|
|
||||||
void setLabelPosition(LabelPosition labelPosition);
|
void setLabelPosition(LabelPosition labelPosition);
|
||||||
QRect boundingRect() const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QRect labelBoundingRect(const QRect& symbolRect) const;
|
QRect labelBoundingRect(const QPainter* painter, const QRect& symbolRect) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_label;
|
QString m_label;
|
||||||
|
Loading…
Reference in New Issue
Block a user