Fix Balloon Next Index Persistance
- next sequential number for balloon on Page was not being preserved across save/restore
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include <Mod/TechDraw/App/DrawViewBalloon.h>
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
@@ -150,25 +151,35 @@ void QGIViewBalloon::placeBalloon(QPointF pos)
|
||||
{
|
||||
|
||||
auto balloon( dynamic_cast<TechDraw::DrawViewBalloon*>(getViewObject()) );
|
||||
if( balloon == nullptr )
|
||||
if( balloon == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
DrawView* balloonParent = nullptr;
|
||||
App::DocumentObject* docObj = balloon->sourceView.getValue();
|
||||
if (docObj == nullptr) {
|
||||
return;
|
||||
} else {
|
||||
balloonParent = dynamic_cast<DrawView*>(docObj);
|
||||
}
|
||||
|
||||
auto featPage = balloonParent->findParentPage();
|
||||
if (featPage == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto vp = static_cast<ViewProviderBalloon*>(getViewProvider(getViewObject()));
|
||||
if ( vp == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
MDIViewPage* mdi = getMDIViewPage();
|
||||
QGVPage* page;
|
||||
if (mdi != nullptr) {
|
||||
page = mdi->getQGVPage();
|
||||
|
||||
balloon->OriginX.setValue(mapFromScene(pos).x());
|
||||
balloon->OriginY.setValue(mapFromScene(pos).y());
|
||||
|
||||
QString labelText = QString::fromUtf8(std::to_string(page->balloonIndex).c_str());
|
||||
balloon->Text.setValue(std::to_string(page->balloonIndex++).c_str());
|
||||
|
||||
int idx = featPage->getNextBalloonIndex();
|
||||
QString labelText = QString::number(idx);
|
||||
balloon->Text.setValue(std::to_string(idx).c_str());
|
||||
|
||||
QFont font = balloonLabel->getFont();
|
||||
font.setPointSizeF(Rez::guiX(vp->Fontsize.getValue()));
|
||||
font.setFamily(QString::fromUtf8(vp->Font.getValue()));
|
||||
@@ -178,7 +189,7 @@ void QGIViewBalloon::placeBalloon(QPointF pos)
|
||||
// Default label position
|
||||
balloonLabel->setPosFromCenter(mapFromScene(pos).x() + 200, mapFromScene(pos).y() -200);
|
||||
balloonLabel->setDimString(labelText, Rez::guiX(balloon->TextWrapLen.getValue()));
|
||||
}
|
||||
// }
|
||||
|
||||
draw();
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef DRAWINGGUI_QGRAPHICSITEMVIEWBALLOON_H
|
||||
#define DRAWINGGUI_QGRAPHICSITEMVIEWBALLOON_H
|
||||
#ifndef TECHDRAWGUI_QGIVBALLOON_H
|
||||
#define TECHDRAWGUI_QGIVBALLOON_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QGraphicsView>
|
||||
@@ -121,6 +121,6 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
} // namespace MDIViewPageGui
|
||||
} // namespace
|
||||
|
||||
#endif // DRAWINGGUI_QGRAPHICSITEMVIEWBALLOON_H
|
||||
#endif // TECHDRAWGUI_QGIVBALLOON_H
|
||||
|
||||
@@ -149,8 +149,6 @@ QGVPage::QGVPage(ViewProviderPage *vp, QGraphicsScene* s, QWidget *parent)
|
||||
|
||||
bkgBrush = new QBrush(getBackgroundColor());
|
||||
|
||||
balloonIndex = 1;
|
||||
|
||||
balloonCursor = new QLabel(this);
|
||||
balloonCursor->setPixmap(QPixmap(QString::fromUtf8(":/icons/cursor-balloon.png")));
|
||||
balloonCursor->hide();
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef DRAWINGGUI_CANVASVIEW_H
|
||||
#define DRAWINGGUI_CANVASVIEW_H
|
||||
#ifndef TECHDRAWGUI_QGVIEW_H
|
||||
#define TECHDRAWGUI_QGVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsScene>
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
void saveSvg(QString filename);
|
||||
void postProcessXml(QTemporaryFile* tempFile, QString filename, QString pagename);
|
||||
|
||||
int balloonIndex;
|
||||
/* int balloonIndex;*/
|
||||
|
||||
public Q_SLOTS:
|
||||
void setHighQualityAntialiasing(bool highQualityAntialiasing);
|
||||
@@ -140,7 +140,6 @@ protected:
|
||||
|
||||
|
||||
QGITemplate *pageTemplate;
|
||||
// std::vector<QGIView *> views; //<<< why? scene already has a list of all the views.
|
||||
|
||||
private:
|
||||
RendererType m_renderer;
|
||||
@@ -161,6 +160,6 @@ private:
|
||||
void cancelBalloonPlacing(void);
|
||||
};
|
||||
|
||||
} // namespace MDIViewPageGui
|
||||
} // namespace
|
||||
|
||||
#endif // DRAWINGGUI_CANVASVIEW_H
|
||||
#endif // TECHDRAWGUI_QGVIEW_H
|
||||
|
||||
Reference in New Issue
Block a user