[TD]fix BRect on empty text items
This commit is contained in:
@@ -76,7 +76,8 @@ void QGCustomSvg::paint ( QPainter * painter, const QStyleOptionGraphicsItem * o
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
//painter->drawRect(boundingRect()); //good for debugging
|
||||
// painter->setPen(Qt::yellow);
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
|
||||
QGraphicsSvgItem::paint (painter, &myOption, widget);
|
||||
}
|
||||
|
||||
@@ -95,6 +95,7 @@ QGILeaderLine::QGILeaderLine(QGraphicsItem* myParent,
|
||||
// m_line->setPrettyNormal();
|
||||
|
||||
addToGroup(m_line);
|
||||
m_line->setPos(0.0, 0.0);
|
||||
m_line->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
m_line->setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
setFlag(QGraphicsItem::ItemSendsScenePositionChanges, false);
|
||||
@@ -102,9 +103,11 @@ QGILeaderLine::QGILeaderLine(QGraphicsItem* myParent,
|
||||
|
||||
m_arrow1 = new QGIArrow();
|
||||
addToGroup(m_arrow1);
|
||||
m_arrow1->setPos(0.0,0.0);
|
||||
m_arrow1->hide();
|
||||
m_arrow2 = new QGIArrow();
|
||||
addToGroup(m_arrow2);
|
||||
m_arrow2->setPos(0.0, 0.0);
|
||||
m_arrow2->hide();
|
||||
|
||||
setParentItem(m_parentItem);
|
||||
@@ -128,7 +131,6 @@ QGILeaderLine::QGILeaderLine(QGraphicsItem* myParent,
|
||||
QObject::connect(
|
||||
m_line, SIGNAL(hover(bool)),
|
||||
this , SLOT (hover(bool)));
|
||||
|
||||
}
|
||||
|
||||
QVariant QGILeaderLine::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
#include <QPainter>
|
||||
#include <QGraphicsItem>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
@@ -48,9 +49,9 @@
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGITile::QGITile() :
|
||||
m_textL(QString()),
|
||||
m_textR(QString()),
|
||||
m_textC(QString()),
|
||||
m_textL(QString::fromUtf8(" ")),
|
||||
m_textR(QString::fromUtf8(" ")),
|
||||
m_textC(QString::fromUtf8(" ")),
|
||||
m_scale(1.0),
|
||||
m_row(0),
|
||||
m_col(0),
|
||||
@@ -109,6 +110,7 @@ QVariant QGITile::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
void QGITile::draw(void)
|
||||
{
|
||||
// Base::Console().Message("QGIT::draw()\n");
|
||||
|
||||
prepareGeometryChange();
|
||||
m_wide = getSymbolWidth();
|
||||
m_high = getSymbolHeight() * scaleToFont();
|
||||
@@ -192,7 +194,10 @@ void QGITile::makeText(void)
|
||||
m_qgTextL->setColor(m_colCurrent);
|
||||
double textWidth = m_qgTextL->boundingRect().width();
|
||||
double charWidth = textWidth / m_textL.size(); //not good for non-ASCII chars
|
||||
double hMargin = (m_wide / 2.0) + (charWidth / 2.0);
|
||||
double hMargin = 1;
|
||||
if (!m_textL.isEmpty()) {
|
||||
hMargin = (m_wide / 2.0) + (charWidth / 2.0);
|
||||
}
|
||||
|
||||
double textHeightL = m_qgTextL->boundingRect().height();
|
||||
double vOffset = 0.0;
|
||||
@@ -208,7 +213,10 @@ void QGITile::makeText(void)
|
||||
m_qgTextR->setColor(m_colCurrent);
|
||||
textWidth = m_qgTextR->boundingRect().width();
|
||||
charWidth = textWidth / m_textR.size();
|
||||
hMargin = (m_wide / 2.0) + (charWidth / 2.0);
|
||||
hMargin = 1;
|
||||
if (!m_textR.isEmpty()) {
|
||||
hMargin = (m_wide / 2.0) + (charWidth / 2.0);
|
||||
}
|
||||
double textHeightR = m_qgTextR->boundingRect().height();
|
||||
if (m_row < 0) { // below line
|
||||
vOffset = textHeightR * verticalFudge;
|
||||
|
||||
@@ -96,12 +96,15 @@ QGIWeldSymbol::QGIWeldSymbol(QGILeaderLine* myParent) :
|
||||
setZValue(ZVALUE::DIMENSION);
|
||||
|
||||
m_tailText = new QGCustomText();
|
||||
m_tailText->setPlainText(
|
||||
QString::fromUtf8(" "));
|
||||
addToGroup(m_tailText);
|
||||
m_tailText->hide();
|
||||
m_tailText->setPos(0.0, 0.0); //avoid bRect issues
|
||||
|
||||
m_allAround = new QGIVertex(-1);
|
||||
addToGroup(m_allAround);
|
||||
m_allAround->setPos(0.0, 0.0);
|
||||
m_allAround->setAcceptHoverEvents(false);
|
||||
m_allAround->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
m_allAround->setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
@@ -111,6 +114,7 @@ QGIWeldSymbol::QGIWeldSymbol(QGILeaderLine* myParent) :
|
||||
|
||||
m_fieldFlag = new QGIPrimPath();
|
||||
addToGroup(m_fieldFlag);
|
||||
m_fieldFlag->setPos(0.0, 0.0);
|
||||
m_fieldFlag->setAcceptHoverEvents(false);
|
||||
m_fieldFlag->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
m_fieldFlag->setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
@@ -157,6 +161,7 @@ void QGIWeldSymbol::updateView(bool update)
|
||||
void QGIWeldSymbol::draw()
|
||||
{
|
||||
// Base::Console().Message("QGIWS::draw()- %s\n", getFeature()->getNameInDocument());
|
||||
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
@@ -500,7 +505,7 @@ double QGIWeldSymbol::prefArrowSize()
|
||||
|
||||
QRectF QGIWeldSymbol::boundingRect() const
|
||||
{
|
||||
return customChildrenBoundingRect();
|
||||
return childrenBoundingRect();
|
||||
}
|
||||
|
||||
QPainterPath QGIWeldSymbol::shape() const
|
||||
|
||||
Reference in New Issue
Block a user