##// END OF EJS Templates
Adds marker rectangle scaling according to font
Michal Klocek -
r1539:f6dc00682b80
parent child
Show More
@@ -75,6 +75,8 QBrush LegendMarker::brush() const
75 void LegendMarker::setFont(const QFont &font)
75 void LegendMarker::setFont(const QFont &font)
76 {
76 {
77 m_textItem->setFont(font);
77 m_textItem->setFont(font);
78 QFontMetrics fn(font);
79 m_markerRect = QRectF(0,0,fn.height()/2,fn.height()/2);
78 updateGeometry();
80 updateGeometry();
79 }
81 }
80
82
@@ -114,6 +116,7 void LegendMarker::setGeometry(const QRectF& rect)
114 const QRectF& textRect = m_textItem->boundingRect();
116 const QRectF& textRect = m_textItem->boundingRect();
115
117
116 m_textItem->setPos(m_markerRect.width() + m_space + m_margin,rect.height()/2 - textRect.height()/2);
118 m_textItem->setPos(m_markerRect.width() + m_space + m_margin,rect.height()/2 - textRect.height()/2);
119 m_rectItem->setRect(m_markerRect);
117 m_rectItem->setPos(m_margin,rect.height()/2 - m_markerRect.height()/2);
120 m_rectItem->setPos(m_margin,rect.height()/2 - m_markerRect.height()/2);
118
121
119 prepareGeometryChange();
122 prepareGeometryChange();
General Comments 0
You need to be logged in to leave comments. Login now