[TD]fix balloon visibility behaviour

This commit is contained in:
wandererfan
2023-12-26 08:07:57 -05:00
committed by WandererFan
parent 1c7b35ff29
commit 7236d7442a

View File

@@ -325,6 +325,7 @@ void QGIViewBalloon::setGroupSelection(bool isSelected)
setSelected(isSelected);
balloonLabel->setSelected(isSelected);
balloonLines->setSelected(isSelected);
balloonShape->setSelected(isSelected);
arrow->setSelected(isSelected);
}
@@ -377,7 +378,7 @@ void QGIViewBalloon::setViewPartFeature(TechDraw::DrawViewBalloon* balloonFeat)
void QGIViewBalloon::updateView(bool update)
{
// Base::Console().Message("QGIVB::updateView()\n");
// Base::Console().Message("QGIVB::updateView()\n");
Q_UNUSED(update);
auto balloon(dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()));
if (!balloon) {
@@ -402,7 +403,7 @@ void QGIViewBalloon::updateView(bool update)
//update the bubble contents
void QGIViewBalloon::updateBalloon(bool obtuse)
{
// Base::Console().Message("QGIVB::updateBalloon()\n");
// Base::Console().Message("QGIVB::updateBalloon()\n");
(void)obtuse;
const auto balloon(dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()));
if (!balloon) {
@@ -575,36 +576,27 @@ void QGIViewBalloon::placeBalloon(QPointF pos)
void QGIViewBalloon::draw()
{
// Base::Console().Message("QGIVB::draw()\n");
// Base::Console().Message("QGIVB::draw()\n");
// just redirect
drawBalloon(false);
}
void QGIViewBalloon::drawBalloon(bool dragged)
{
// Base::Console().Message("QGIVB::drawBalloon(%d)\n", dragged);
if (!isVisible()) {
return;
}
// Base::Console().Message("QGIVB::drawBalloon(%d)\n", dragged);
prepareGeometryChange();
TechDraw::DrawViewBalloon* balloon = dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject());
if ((!balloon) ||//nothing to draw, don't try
if ((!balloon) ||
(!balloon->isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId()))) {
balloonLabel->hide();
hide();
//nothing to draw, don't try
return;
}
balloonLabel->show();
show();
const TechDraw::DrawView* refObj = balloon->getParentView();
if (!refObj) {
return;
}
auto vp = static_cast<ViewProviderBalloon*>(getViewProvider(getViewObject()));
if (!vp) {
if (!refObj || !vp) {
// can't draw this. probably restoring.
return;
}
@@ -847,6 +839,7 @@ void QGIViewBalloon::drawBalloon(bool dragged)
setPrettyNormal();
}
update();
if (parentItem()) {
parentItem()->update();
}