Remove ctor args from QGIView and descendents.
This commit is contained in:
parent
4fe9267eeb
commit
b883434318
|
@ -46,10 +46,8 @@
|
|||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGIProjGroup::QGIProjGroup(const QPoint &pos, QGraphicsScene *scene)
|
||||
:QGIViewCollection(pos, scene)
|
||||
QGIProjGroup::QGIProjGroup()
|
||||
{
|
||||
setPos(pos);
|
||||
origin = new QGraphicsItemGroup();
|
||||
origin->setParentItem(this);
|
||||
|
||||
|
@ -64,10 +62,6 @@ QGIProjGroup::QGIProjGroup(const QPoint &pos, QGraphicsScene *scene)
|
|||
borderVisible = false;
|
||||
}
|
||||
|
||||
QGIProjGroup::~QGIProjGroup()
|
||||
{
|
||||
//TODO: if the QGIVO is deleted, should we clean up any remaining QGIVParts??
|
||||
}
|
||||
|
||||
TechDraw::DrawProjGroup * QGIProjGroup::getDrawView(void) const
|
||||
{
|
||||
|
|
|
@ -47,8 +47,10 @@ class TechDrawGuiExport QGIProjGroup : public QGIViewCollection
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QGIProjGroup(const QPoint &position, QGraphicsScene *scene);
|
||||
~QGIProjGroup();
|
||||
QGIProjGroup();
|
||||
|
||||
// TODO: if the QGIVO is deleted, should we clean up any remaining QGIVParts??
|
||||
~QGIProjGroup() = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 113};
|
||||
int type() const { return Type;}
|
||||
|
@ -74,8 +76,8 @@ private:
|
|||
/// Convenience function
|
||||
TechDraw::DrawProjGroup * getDrawView(void) const;
|
||||
|
||||
QGraphicsRectItem * m_backgroundItem;
|
||||
QGraphicsItem*origin;
|
||||
QGraphicsRectItem *m_backgroundItem;
|
||||
QGraphicsItem *origin;
|
||||
QPoint mousePos;
|
||||
};
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ using namespace TechDrawGui;
|
|||
|
||||
void _debugRect(char* text, QRectF r);
|
||||
|
||||
QGIView::QGIView(const QPoint &pos, QGraphicsScene *scene)
|
||||
QGIView::QGIView()
|
||||
:QGraphicsItemGroup(),
|
||||
locked(false),
|
||||
borderVisible(true),
|
||||
|
@ -70,7 +70,6 @@ QGIView::QGIView(const QPoint &pos, QGraphicsScene *scene)
|
|||
setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
|
||||
setFlag(QGraphicsItem::ItemSendsGeometryChanges,true);
|
||||
setAcceptHoverEvents(true);
|
||||
setPos(pos);
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
|
@ -89,10 +88,6 @@ QGIView::QGIView(const QPoint &pos, QGraphicsScene *scene)
|
|||
m_font.setFamily(QString::fromStdString(fontName));
|
||||
m_font.setPointSize(5.0); //scene units (mm), not points
|
||||
|
||||
//Add object to scene
|
||||
if(scene) // TODO: Get rid of the ctor args as in the refactor attempt
|
||||
scene->addItem(this);
|
||||
|
||||
m_decorPen.setStyle(Qt::DashLine);
|
||||
m_decorPen.setWidth(0); // 0 => 1px "cosmetic pen"
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class TechDrawGuiExport QGIView : public QObject, public QGraphicsItemGroup
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QGIView(const QPoint &position, QGraphicsScene *scene);
|
||||
QGIView();
|
||||
virtual ~QGIView() = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 101};
|
||||
|
|
|
@ -55,8 +55,7 @@
|
|||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGIViewAnnotation::QGIViewAnnotation(const QPoint &pos, QGraphicsScene *scene)
|
||||
:QGIView(pos, scene)
|
||||
QGIViewAnnotation::QGIViewAnnotation()
|
||||
{
|
||||
setHandlesChildEvents(false);
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
|
@ -73,10 +72,6 @@ QGIViewAnnotation::QGIViewAnnotation(const QPoint &pos, QGraphicsScene *scene)
|
|||
|
||||
}
|
||||
|
||||
QGIViewAnnotation::~QGIViewAnnotation()
|
||||
{
|
||||
// m_textItem belongs to this group and will be deleted by Qt
|
||||
}
|
||||
|
||||
QVariant QGIViewAnnotation::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
|
|
|
@ -43,8 +43,10 @@ class TechDrawGuiExport QGIViewAnnotation : public QGIView
|
|||
|
||||
public:
|
||||
|
||||
explicit QGIViewAnnotation(const QPoint &position, QGraphicsScene *scene);
|
||||
~QGIViewAnnotation();
|
||||
explicit QGIViewAnnotation();
|
||||
|
||||
/// m_textItem belongs to this group and will be deleted by Qt
|
||||
~QGIViewAnnotation() = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 120};
|
||||
int type() const override { return Type;}
|
||||
|
|
|
@ -50,8 +50,7 @@
|
|||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGIViewClip::QGIViewClip(const QPoint &pos, QGraphicsScene *scene)
|
||||
:QGIView(pos, scene)
|
||||
QGIViewClip::QGIViewClip()
|
||||
{
|
||||
setHandlesChildEvents(false);
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
|
@ -70,9 +69,6 @@ QGIViewClip::QGIViewClip(const QPoint &pos, QGraphicsScene *scene)
|
|||
m_frame->setRect(0.,0.,5.,5.);
|
||||
}
|
||||
|
||||
QGIViewClip::~QGIViewClip()
|
||||
{
|
||||
}
|
||||
|
||||
QVariant QGIViewClip::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
|
|
|
@ -43,8 +43,8 @@ class TechDrawGuiExport QGIViewClip : public QGIView
|
|||
|
||||
public:
|
||||
|
||||
explicit QGIViewClip(const QPoint &position, QGraphicsScene *scene);
|
||||
~QGIViewClip();
|
||||
QGIViewClip();
|
||||
~QGIViewClip() = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 123};
|
||||
int type() const override { return Type;}
|
||||
|
|
|
@ -43,10 +43,9 @@
|
|||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGIViewCollection::QGIViewCollection(const QPoint &pos, QGraphicsScene *scene) :QGIView(pos, scene)
|
||||
QGIViewCollection::QGIViewCollection()
|
||||
{
|
||||
setFlags(QGraphicsItem::ItemIsSelectable);
|
||||
setPos(pos);
|
||||
|
||||
setHandlesChildEvents(false);
|
||||
|
||||
|
@ -55,10 +54,6 @@ QGIViewCollection::QGIViewCollection(const QPoint &pos, QGraphicsScene *scene) :
|
|||
setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
}
|
||||
|
||||
QGIViewCollection::~QGIViewCollection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QVariant QGIViewCollection::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
|
|
|
@ -47,8 +47,8 @@ class TechDrawGuiExport QGIViewCollection : public QGIView
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QGIViewCollection(const QPoint &position, QGraphicsScene *scene);
|
||||
~QGIViewCollection();
|
||||
QGIViewCollection();
|
||||
~QGIViewCollection() = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 110};
|
||||
int type() const { return Type;}
|
||||
|
|
|
@ -157,8 +157,7 @@ void QGIDatumLabel::mouseReleaseEvent( QGraphicsSceneMouseEvent * event)
|
|||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
QGIViewDimension::QGIViewDimension(const QPoint &pos, QGraphicsScene *scene) :
|
||||
QGIView(pos, scene),
|
||||
QGIViewDimension::QGIViewDimension() :
|
||||
hasHover(false)
|
||||
{
|
||||
setHandlesChildEvents(false);
|
||||
|
@ -209,9 +208,6 @@ QGIViewDimension::QGIViewDimension(const QPoint &pos, QGraphicsScene *scene) :
|
|||
toggleBorder(false);
|
||||
}
|
||||
|
||||
QGIViewDimension::~QGIViewDimension()
|
||||
{
|
||||
}
|
||||
|
||||
void QGIViewDimension::setViewPartFeature(TechDraw::DrawViewDimension *obj)
|
||||
{
|
||||
|
|
|
@ -88,8 +88,8 @@ class TechDrawGuiExport QGIViewDimension : public QGIView
|
|||
public:
|
||||
enum {Type = QGraphicsItem::UserType + 106};
|
||||
|
||||
explicit QGIViewDimension(const QPoint &position, QGraphicsScene *scene);
|
||||
~QGIViewDimension();
|
||||
explicit QGIViewDimension();
|
||||
~QGIViewDimension() = default;
|
||||
|
||||
void setViewPartFeature(TechDraw::DrawViewDimension *obj);
|
||||
int type() const { return Type;}
|
||||
|
|
|
@ -60,8 +60,7 @@ void _dumpPath(const char* text,QPainterPath path);
|
|||
const float lineScaleFactor = 1.; // temp fiddle for devel
|
||||
const float vertexScaleFactor = 2.; // temp fiddle for devel
|
||||
|
||||
QGIViewPart::QGIViewPart(const QPoint &pos, QGraphicsScene *scene)
|
||||
:QGIView(pos, scene)
|
||||
QGIViewPart::QGIViewPart()
|
||||
{
|
||||
setHandlesChildEvents(false);
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
|
|
|
@ -48,7 +48,7 @@ class TechDrawGuiExport QGIViewPart : public QGIView
|
|||
|
||||
public:
|
||||
|
||||
explicit QGIViewPart(const QPoint &position, QGraphicsScene *scene);
|
||||
explicit QGIViewPart();
|
||||
~QGIViewPart();
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 102};
|
||||
|
|
|
@ -47,15 +47,6 @@
|
|||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGIViewSection::QGIViewSection(const QPoint &pos, QGraphicsScene *scene) :QGIViewPart(pos, scene)
|
||||
{
|
||||
}
|
||||
|
||||
QGIViewSection::~QGIViewSection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void QGIViewSection::draw()
|
||||
{
|
||||
if (!isVisible()) {
|
||||
|
|
|
@ -42,8 +42,8 @@ class TechDrawGuiExport QGIViewSection : public QGIViewPart
|
|||
|
||||
public:
|
||||
|
||||
explicit QGIViewSection(const QPoint &position, QGraphicsScene *scene);
|
||||
~QGIViewSection();
|
||||
QGIViewSection() = default;
|
||||
~QGIViewSection() = default;
|
||||
|
||||
virtual void draw() override;
|
||||
void updateView(bool update = false) override;
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGIViewSpreadsheet::QGIViewSpreadsheet() : QGIViewSymbol(QPoint(), nullptr)
|
||||
QGIViewSpreadsheet::QGIViewSpreadsheet()
|
||||
{
|
||||
setHandlesChildEvents(false);
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
|
@ -53,9 +53,6 @@ QGIViewSpreadsheet::QGIViewSpreadsheet() : QGIViewSymbol(QPoint(), nullptr)
|
|||
setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
}
|
||||
|
||||
QGIViewSpreadsheet::~QGIViewSpreadsheet()
|
||||
{
|
||||
}
|
||||
|
||||
void QGIViewSpreadsheet::setViewFeature(TechDraw::DrawViewSpreadsheet *obj)
|
||||
{
|
||||
|
|
|
@ -45,8 +45,8 @@ class TechDrawGuiExport QGIViewSpreadsheet : public QGIViewSymbol
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QGIViewSpreadsheet();
|
||||
~QGIViewSpreadsheet();
|
||||
QGIViewSpreadsheet();
|
||||
~QGIViewSpreadsheet() = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 124};
|
||||
int type() const { return Type;}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGIViewSymbol::QGIViewSymbol(const QPoint &pos, QGraphicsScene *scene) :QGIView(pos, scene)
|
||||
QGIViewSymbol::QGIViewSymbol()
|
||||
{
|
||||
setHandlesChildEvents(false);
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
|
|
|
@ -46,7 +46,7 @@ class TechDrawGuiExport QGIViewSymbol : public QGIView
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QGIViewSymbol(const QPoint &position, QGraphicsScene *scene);
|
||||
QGIViewSymbol();
|
||||
~QGIViewSymbol();
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 121};
|
||||
|
|
|
@ -160,7 +160,13 @@ void QGVPage::drawBackground(QPainter *p, const QRectF &)
|
|||
|
||||
}
|
||||
|
||||
int QGVPage::addView(QGIView * view) {
|
||||
int QGVPage::addView(QGIView *view)
|
||||
{
|
||||
auto ourScene( scene() );
|
||||
assert(ourScene);
|
||||
|
||||
ourScene->addItem(view);
|
||||
|
||||
views.push_back(view);
|
||||
|
||||
// Find if it belongs to a parent
|
||||
|
@ -187,7 +193,8 @@ int QGVPage::addView(QGIView * view) {
|
|||
|
||||
QGIView * QGVPage::addViewPart(TechDraw::DrawViewPart *part)
|
||||
{
|
||||
QGIViewPart *viewPart = new QGIViewPart(QPoint(0,0), scene());
|
||||
auto viewPart( new QGIViewPart );
|
||||
|
||||
viewPart->setViewPartFeature(part);
|
||||
|
||||
addView(viewPart);
|
||||
|
@ -196,7 +203,8 @@ QGIView * QGVPage::addViewPart(TechDraw::DrawViewPart *part)
|
|||
|
||||
QGIView * QGVPage::addViewSection(TechDraw::DrawViewPart *part)
|
||||
{
|
||||
QGIViewSection *viewSection = new QGIViewSection(QPoint(0,0), scene());
|
||||
auto viewSection( new QGIViewSection );
|
||||
|
||||
viewSection->setViewPartFeature(part);
|
||||
|
||||
addView(viewSection);
|
||||
|
@ -204,7 +212,8 @@ QGIView * QGVPage::addViewSection(TechDraw::DrawViewPart *part)
|
|||
}
|
||||
|
||||
QGIView * QGVPage::addProjectionGroup(TechDraw::DrawProjGroup *view) {
|
||||
QGIViewCollection *qview = new QGIProjGroup(QPoint(0,0), scene());
|
||||
auto qview( new QGIProjGroup );
|
||||
|
||||
qview->setViewFeature(view);
|
||||
addView(qview);
|
||||
return qview;
|
||||
|
@ -212,7 +221,8 @@ QGIView * QGVPage::addProjectionGroup(TechDraw::DrawProjGroup *view) {
|
|||
|
||||
QGIView * QGVPage::addDrawView(TechDraw::DrawView *view)
|
||||
{
|
||||
QGIView *qview = new QGIView(QPoint(0,0), scene());
|
||||
auto qview( new QGIView );
|
||||
|
||||
qview->setViewFeature(view);
|
||||
addView(qview);
|
||||
return qview;
|
||||
|
@ -220,7 +230,8 @@ QGIView * QGVPage::addDrawView(TechDraw::DrawView *view)
|
|||
|
||||
QGIView * QGVPage::addDrawViewCollection(TechDraw::DrawViewCollection *view)
|
||||
{
|
||||
QGIViewCollection *qview = new QGIViewCollection(QPoint(0,0), scene());
|
||||
auto qview( new QGIViewCollection );
|
||||
|
||||
qview->setViewFeature(view);
|
||||
addView(qview);
|
||||
return qview;
|
||||
|
@ -230,7 +241,8 @@ QGIView * QGVPage::addDrawViewCollection(TechDraw::DrawViewCollection *view)
|
|||
QGIView * QGVPage::addDrawViewAnnotation(TechDraw::DrawViewAnnotation *view)
|
||||
{
|
||||
// This essentially adds a null view feature to ensure view size is consistent
|
||||
QGIViewAnnotation *qview = new QGIViewAnnotation(QPoint(0,0), this->scene());
|
||||
auto qview( new QGIViewAnnotation );
|
||||
|
||||
qview->setViewAnnoFeature(view);
|
||||
|
||||
addView(qview);
|
||||
|
@ -241,7 +253,8 @@ QGIView * QGVPage::addDrawViewSymbol(TechDraw::DrawViewSymbol *view)
|
|||
{
|
||||
QPoint qp(view->X.getValue(),view->Y.getValue());
|
||||
// This essentially adds a null view feature to ensure view size is consistent
|
||||
QGIViewSymbol *qview = new QGIViewSymbol(qp, scene());
|
||||
auto qview( new QGIViewSymbol );
|
||||
|
||||
qview->setViewFeature(view);
|
||||
|
||||
addView(qview);
|
||||
|
@ -250,8 +263,9 @@ QGIView * QGVPage::addDrawViewSymbol(TechDraw::DrawViewSymbol *view)
|
|||
|
||||
QGIView * QGVPage::addDrawViewClip(TechDraw::DrawViewClip *view)
|
||||
{
|
||||
QPoint qp(view->X.getValue(),view->Y.getValue());
|
||||
QGIViewClip *qview = new QGIViewClip(qp, scene());
|
||||
auto qview( new QGIViewClip );
|
||||
|
||||
qview->setPosition(view->X.getValue(), view->Y.getValue());
|
||||
qview->setViewFeature(view);
|
||||
|
||||
addView(qview);
|
||||
|
@ -260,7 +274,7 @@ QGIView * QGVPage::addDrawViewClip(TechDraw::DrawViewClip *view)
|
|||
|
||||
QGIView * QGVPage::addDrawViewSpreadsheet(TechDraw::DrawViewSpreadsheet *view)
|
||||
{
|
||||
QGIViewSpreadsheet *qview(new QGIViewSpreadsheet);
|
||||
auto qview( new QGIViewSpreadsheet );
|
||||
|
||||
qview->setViewFeature(view);
|
||||
|
||||
|
@ -270,7 +284,12 @@ QGIView * QGVPage::addDrawViewSpreadsheet(TechDraw::DrawViewSpreadsheet *view)
|
|||
|
||||
QGIView * QGVPage::addViewDimension(TechDraw::DrawViewDimension *dim)
|
||||
{
|
||||
QGIViewDimension *dimGroup = new QGIViewDimension(QPoint(0,0), scene());
|
||||
auto dimGroup( new QGIViewDimension );
|
||||
|
||||
auto ourScene( scene() );
|
||||
assert(ourScene);
|
||||
ourScene->addItem(dimGroup);
|
||||
|
||||
dimGroup->setViewPartFeature(dim);
|
||||
|
||||
// TODO consider changing dimension feature to use another property for label position
|
||||
|
|
Loading…
Reference in New Issue
Block a user