TechDraw: centralize usertype constants
This commit is contained in:
committed by
Benjamin Nauck
parent
41c750be47
commit
9af522c085
@@ -324,6 +324,7 @@ SET(TechDrawGuiView_SRCS
|
||||
QGIWeldSymbol.cpp
|
||||
QGITile.h
|
||||
QGITile.cpp
|
||||
QGIUserTypes.h
|
||||
TemplateTextField.cpp
|
||||
TemplateTextField.h
|
||||
ZVALUE.h
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QPointF>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
class QStyleOptionGraphicsItem;
|
||||
@@ -43,7 +45,7 @@ public:
|
||||
explicit QGCustomBorder();
|
||||
~QGCustomBorder() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 136};
|
||||
enum {Type = UserType::QGCustomBorder};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
class QStyleOptionGraphicsItem;
|
||||
@@ -45,7 +47,7 @@ public:
|
||||
explicit QGCustomClip();
|
||||
~QGCustomClip() override {}
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 132};
|
||||
enum {Type = UserType::QGCustomClip};
|
||||
int type() const override { return Type;}
|
||||
QRectF boundingRect() const override;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <QPointF>
|
||||
#include <QSize>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
@@ -46,7 +47,7 @@ public:
|
||||
explicit QGCustomImage();
|
||||
~QGCustomImage() override;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 201};
|
||||
enum {Type = UserType::QGCustomImage};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void paint( QPainter *painter,
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <QGraphicsItem>
|
||||
#include <QGraphicsTextItem>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
@@ -43,7 +45,7 @@ public:
|
||||
explicit QGCustomLabel();
|
||||
~QGCustomLabel() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 135};
|
||||
enum {Type = UserType::QGCustomLabel};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QPointF>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
class QStyleOptionGraphicsItem;
|
||||
@@ -43,7 +45,7 @@ public:
|
||||
explicit QGCustomRect();
|
||||
~QGCustomRect() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 133};
|
||||
enum {Type = UserType::QGCustomRect};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <QPointF>
|
||||
#include <QSvgRenderer>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
@@ -46,7 +47,7 @@ public:
|
||||
explicit QGCustomSvg();
|
||||
~QGCustomSvg() override;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 131};
|
||||
enum {Type = UserType::QGCustomSvg};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void paint( QPainter *painter,
|
||||
|
||||
@@ -37,6 +37,8 @@ QT_END_NAMESPACE
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
|
||||
@@ -46,7 +48,7 @@ public:
|
||||
explicit QGCustomText(QGraphicsItem* parent = nullptr);
|
||||
~QGCustomText() override {}
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 130};
|
||||
enum {Type = UserType::QGCustomText};
|
||||
int type() const override { return Type;}
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include <QPointF>
|
||||
#include <QRectF>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
class QStyleOptionGraphicsItem;
|
||||
@@ -43,7 +45,7 @@ public:
|
||||
explicit QGDisplayArea();
|
||||
~QGDisplayArea() override {}
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 137};
|
||||
enum {Type = UserType::QGDisplayArea};
|
||||
int type() const override { return Type;}
|
||||
QRectF boundingRect() const override;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <QObject>
|
||||
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGIUserTypes.h"
|
||||
#include "QGIVertex.h"
|
||||
|
||||
namespace TechDrawGui
|
||||
@@ -48,7 +49,7 @@ public:
|
||||
explicit QGMarker(int idx);
|
||||
~QGMarker() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 302};
|
||||
enum {Type = UserType::QGMarker};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
@@ -84,7 +85,7 @@ public:
|
||||
explicit QGEPath();
|
||||
~QGEPath() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 301};
|
||||
enum {Type = UserType::QGEPath};
|
||||
int type() const override { return Type;}
|
||||
QRectF boundingRect() const override;
|
||||
QPainterPath shape() const override;
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
# include "QGIPrimPath.h"
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
@@ -44,7 +45,7 @@ public:
|
||||
explicit QGIArrow();
|
||||
~QGIArrow() override {}
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 109};
|
||||
enum {Type = UserType::QGIArrow};
|
||||
int type() const override { return Type;}
|
||||
|
||||
public:
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "QGCustomText.h"
|
||||
#include "QGIDecoration.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
using BreakType = TechDraw::DrawBrokenView::BreakType;
|
||||
|
||||
@@ -47,7 +48,7 @@ public:
|
||||
explicit QGIBreakLine();
|
||||
~QGIBreakLine() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 250};
|
||||
enum {Type = UserType::QGIBreakLine};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
# include "QGIVertex.h"
|
||||
#include "QGIUserTypes.h"
|
||||
#include "QGIVertex.h"
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
@@ -36,7 +37,7 @@ public:
|
||||
explicit QGICMark(int index);
|
||||
~QGICMark() override {}
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 171};
|
||||
enum {Type = UserType::QGICMark};
|
||||
int type() const override { return Type;}
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "QGCustomText.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
@@ -36,7 +37,7 @@ public:
|
||||
explicit QGICaption();
|
||||
~QGICaption() override {}
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 180};
|
||||
enum {Type = UserType::QGICaption};
|
||||
int type() const override { return Type;}
|
||||
|
||||
};
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QPointF>
|
||||
|
||||
#include "QGIDecoration.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
@@ -39,7 +40,7 @@ public:
|
||||
explicit QGICenterLine();
|
||||
~QGICenterLine() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 174};
|
||||
enum {Type = UserType::QGICenterLine};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "Enums.h"
|
||||
#include "QGCustomText.h"
|
||||
#include "QGIUserTypes.h"
|
||||
#include "QGIViewDimension.h"
|
||||
|
||||
|
||||
@@ -40,7 +41,7 @@ public:
|
||||
QGIDatumLabel();
|
||||
~QGIDatumLabel() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 107};
|
||||
enum {Type = UserType::QGIDatumLabel};
|
||||
int type() const override { return Type;}
|
||||
|
||||
QRectF boundingRect() const override;
|
||||
|
||||
@@ -41,6 +41,7 @@ QT_END_NAMESPACE
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "Enums.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
@@ -50,7 +51,7 @@ class TechDrawGuiExport QGIDecoration : public QGraphicsItemGroup
|
||||
public:
|
||||
explicit QGIDecoration();
|
||||
~QGIDecoration() override = default;
|
||||
enum {Type = QGraphicsItem::UserType + 173};
|
||||
enum {Type = UserType::QGIDecoration};
|
||||
int type() const override { return Type;}
|
||||
|
||||
QRectF boundingRect() const override;
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
# include "QGIPrimPath.h"
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
@@ -41,7 +42,7 @@ public:
|
||||
explicit QGIDimLines();
|
||||
~QGIDimLines() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 175};
|
||||
enum {Type = UserType::QGIDimLines};
|
||||
int type() const override { return Type;}
|
||||
QRectF boundingRect() const override;
|
||||
QPainterPath shape() const override;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "QGITemplate.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QGraphicsScene;
|
||||
@@ -48,7 +49,7 @@ public:
|
||||
explicit QGIDrawingTemplate(QGSPage *);
|
||||
~QGIDrawingTemplate() override;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 151};
|
||||
enum {Type = UserType::QGIDrawingTemplate};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void clearContents();
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
@@ -37,7 +38,7 @@ public:
|
||||
explicit QGIEdge(int index);
|
||||
~QGIEdge() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 103};
|
||||
enum {Type = UserType::QGIEdge};
|
||||
|
||||
int type() const override { return Type;}
|
||||
QRectF boundingRect() const override;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "PATPathMaker.h"
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
namespace TechDrawGui
|
||||
@@ -57,7 +58,7 @@ public:
|
||||
explicit QGIFace(int index = -1);
|
||||
~QGIFace() override;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 104};
|
||||
enum {Type = UserType::QGIFace};
|
||||
int type() const override { return Type;}
|
||||
QRectF boundingRect() const override;
|
||||
QPainterPath shape() const override;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <QPointF>
|
||||
|
||||
#include "QGIHighlight.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
//a movable, selectable surrogate for detail highlights in QGIVPart
|
||||
@@ -44,7 +45,7 @@ public:
|
||||
explicit QGIGhostHighlight();
|
||||
~QGIGhostHighlight() override;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 177};
|
||||
enum {Type = UserType::QGIGhostHighlight};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void setInteractive(bool state);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "QGCustomText.h"
|
||||
#include "QGCustomRect.h"
|
||||
#include "QGIDecoration.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
namespace TechDrawGui
|
||||
@@ -45,7 +46,7 @@ public:
|
||||
explicit QGIHighlight();
|
||||
~QGIHighlight() override;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 176};
|
||||
enum {Type = UserType::QGIHighlight};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void paint(QPainter * painter,
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "QGIView.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
namespace TechDraw
|
||||
@@ -56,10 +57,7 @@ class TechDrawGuiExport QGILeaderLine: public QGIView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
Type = QGraphicsItem::UserType + 232
|
||||
};
|
||||
enum {Type = UserType::QGILeaderLine};
|
||||
|
||||
explicit QGILeaderLine();
|
||||
~QGILeaderLine() override = default;
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
@@ -47,7 +49,7 @@ public:
|
||||
explicit QGIMatting();
|
||||
~QGIMatting() override {}
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 205};
|
||||
enum {Type = UserType::QGIMatting};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPainter;
|
||||
class QStyleOptionGraphicsItem;
|
||||
@@ -45,7 +47,7 @@ public:
|
||||
explicit QGIPrimPath();
|
||||
~QGIPrimPath() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 170};
|
||||
enum {Type = UserType::QGIPrimPath};
|
||||
|
||||
int type() const override { return Type;}
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "QGIViewCollection.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -49,7 +50,7 @@ public:
|
||||
// TODO: if the QGIVO is deleted, should we clean up any remaining QGIVParts??
|
||||
~QGIProjGroup() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 113};
|
||||
enum {Type = UserType::QGIProjGroup};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void alignTo(QGIProjGroup *, const QString &alignment);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
#include "QGIView.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
namespace TechDraw {
|
||||
@@ -55,7 +56,7 @@ class TechDrawGuiExport QGIRichAnno : public QGIView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum {Type = QGraphicsItem::UserType + 233};
|
||||
enum {Type = UserType::QGIRichAnno};
|
||||
|
||||
explicit QGIRichAnno();
|
||||
~QGIRichAnno() override = default;
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <Mod/TechDraw/App/XMLQuery.h>
|
||||
|
||||
#include "QGISVGTemplate.h"
|
||||
#include "QGIUserTypes.h"
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGSPage.h"
|
||||
#include "Rez.h"
|
||||
@@ -206,13 +207,12 @@ void QGISVGTemplate::updateView(bool update)
|
||||
|
||||
std::vector<TemplateTextField*> QGISVGTemplate::getTextFields()
|
||||
{
|
||||
constexpr int TemplateTextFieldType {QGraphicsItem::UserType + 160};
|
||||
std::vector<TemplateTextField*> result;
|
||||
result.reserve(childItems().size());
|
||||
|
||||
QList<QGraphicsItem*> templateChildren = childItems();
|
||||
for (auto& child : templateChildren) {
|
||||
if (child->type() == TemplateTextFieldType) {
|
||||
if (child->type() == UserType::TemplateTextField) {
|
||||
result.push_back(static_cast<TemplateTextField*>(child));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class QFile;
|
||||
class QString;
|
||||
|
||||
#include "QGITemplate.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
@@ -50,10 +51,7 @@ public:
|
||||
explicit QGISVGTemplate(QGSPage* scene);
|
||||
~QGISVGTemplate() override;
|
||||
|
||||
enum
|
||||
{
|
||||
Type = QGraphicsItem::UserType + 153
|
||||
};
|
||||
enum {Type = UserType::QGISVGTemplate};
|
||||
int type() const override { return Type; }
|
||||
|
||||
void draw() override;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "QGCustomText.h"
|
||||
#include "QGIDecoration.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
namespace TechDrawGui
|
||||
@@ -49,7 +50,7 @@ public:
|
||||
explicit QGISectionLine();
|
||||
~QGISectionLine() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 172};
|
||||
enum {Type = UserType::QGISectionLine};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <QGraphicsItemGroup>
|
||||
#include <QObject>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QGraphicsScene;
|
||||
QT_END_NAMESPACE
|
||||
@@ -49,7 +51,7 @@ public:
|
||||
QGITemplate(QGSPage *);
|
||||
~QGITemplate() override;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 150};
|
||||
enum {Type = UserType::QGITemplate};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void clearContents();
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <QPointF>
|
||||
|
||||
#include "QGIDecoration.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDraw {
|
||||
class DrawTile;
|
||||
@@ -49,7 +50,7 @@ public:
|
||||
explicit QGITile(TechDraw::DrawTileWeld*);
|
||||
~QGITile() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 325};
|
||||
enum {Type = UserType::QGITile};
|
||||
int type() const override { return Type;}
|
||||
|
||||
QRectF boundingRect() const override;
|
||||
|
||||
@@ -1,60 +1,94 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2025 WandererFan <wandererfan@gmail.com> *
|
||||
* Copyright (c) 2025 Benjamin Bræstrup Sayoc <benj5378@outlook.com> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software, you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation, either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY, without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library, see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef TECHDRAWGUI_USERTYPES_H
|
||||
#define TECHDRAWGUI_USERTYPES_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
|
||||
/*
|
||||
Derived QGI Classes type() Values
|
||||
|
||||
Qt First UserType>> QGraphicsItem::UserType = 65536
|
||||
|
||||
QGIView : 101
|
||||
QGIViewPart : 102
|
||||
QGIEdge: 103
|
||||
QGIFace: 104
|
||||
QGIVertex: 105
|
||||
QGIViewDimension : 106
|
||||
QGIViewBalloon : 140
|
||||
QGIBalloonLabel : 141
|
||||
QGIDatumLabel : 107
|
||||
QGIViewSection : 108
|
||||
QGIArrow: 109
|
||||
QGIViewCollection : 110
|
||||
QGIProjGroup : 113
|
||||
QGIViewAnnotation : 120
|
||||
QGIViewSymbol : 121
|
||||
QGIHatch : 122 //obsolete
|
||||
QGIClip : 123
|
||||
QGISpreadsheet : 124
|
||||
QGCustomText: 130
|
||||
QGCustomSvg: 131
|
||||
QGCustomClip: 132
|
||||
QGCustomRect: 133
|
||||
QGCustomLabel:135
|
||||
QGCustomBorder: 136
|
||||
QGDisplayArea: 137
|
||||
QGITemplate: 150
|
||||
QGIDrawingTemplate: 151
|
||||
QGISVGTemplate: 153
|
||||
TemplateTextField: 160
|
||||
QGIPrimPath: 170
|
||||
QGICMark: 171
|
||||
QGISectionLine: 172
|
||||
QGIDecoration: 173
|
||||
QGICenterLine: 174
|
||||
QGIDimLines: 175
|
||||
QGIHighlight: 176
|
||||
QGIGhostHighlight: 177
|
||||
QGICaption: 180
|
||||
QGIViewImage: 200
|
||||
QGCustomImage: 201
|
||||
QGIMatting: 205
|
||||
QGTracker: 210
|
||||
QGILeaderLine: 232
|
||||
QGIRichAnno: 233
|
||||
QGIBreakLine: 250
|
||||
QGMText: 300
|
||||
QGEPath: 301
|
||||
QGMarker: 302
|
||||
QGITile: 325
|
||||
QGIWeldSymbol: 340
|
||||
*/
|
||||
|
||||
namespace TechDrawGui {
|
||||
struct UserType {
|
||||
enum : int {
|
||||
QGCustomBorder = QGraphicsItem::UserType,
|
||||
QGCustomClip,
|
||||
QGCustomImage,
|
||||
QGCustomLabel,
|
||||
QGCustomRect,
|
||||
QGCustomSvg,
|
||||
QGCustomText,
|
||||
QGDisplayArea,
|
||||
QGEPath,
|
||||
QGIArrow,
|
||||
QGIBalloonLabel,
|
||||
QGIBreakLine,
|
||||
QGICaption,
|
||||
QGICenterLine,
|
||||
QGICMark,
|
||||
QGIDatumLabel,
|
||||
QGIDecoration,
|
||||
QGIDimLines,
|
||||
QGIDrawingTemplate,
|
||||
QGIEdge,
|
||||
QGIFace,
|
||||
QGIGhostHighlight,
|
||||
//QGIHatch, //obsolete
|
||||
QGIHighlight,
|
||||
QGILeaderLine,
|
||||
QGIMatting,
|
||||
QGIPrimPath,
|
||||
QGIProjGroup,
|
||||
QGIRichAnno,
|
||||
QGISectionLine,
|
||||
QGISpreadsheet,
|
||||
QGISVGTemplate,
|
||||
QGITemplate,
|
||||
QGITile,
|
||||
QGIVertex,
|
||||
QGIView,
|
||||
QGIViewAnnotation,
|
||||
QGIViewBalloon,
|
||||
QGIViewClip,
|
||||
QGIViewCollection,
|
||||
QGIViewDimension,
|
||||
QGIViewImage,
|
||||
QGIViewPart,
|
||||
QGIViewSection,
|
||||
QGIViewSymbol,
|
||||
QGIWeldSymbol,
|
||||
QGMarker,
|
||||
QGMText,
|
||||
QGTracker,
|
||||
TemplateTextField
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
Standard Types
|
||||
path 2
|
||||
@@ -67,3 +101,5 @@ text 8
|
||||
simpletext 9
|
||||
group 10
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
# include "QGIPrimPath.h"
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace Base {
|
||||
class Vector2d;
|
||||
@@ -40,7 +41,7 @@ public:
|
||||
explicit QGIVertex(int index);
|
||||
~QGIVertex() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 105};
|
||||
enum {Type = UserType::QGIVertex};
|
||||
int type() const override { return Type;}
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include "QGIEdge.h"
|
||||
#include "QGIVertex.h"
|
||||
#include "QGIViewClip.h"
|
||||
#include "QGIUserTypes.h"
|
||||
#include "QGSPage.h"
|
||||
#include "QGVPage.h"
|
||||
#include "Rez.h"
|
||||
@@ -720,31 +721,21 @@ QRectF QGIView::customChildrenBoundingRect() const
|
||||
{
|
||||
QList<QGraphicsItem*> children = childItems();
|
||||
// exceptions not to be included in determining the frame rectangle
|
||||
int dimItemType = QGraphicsItem::UserType + 106; // TODO: Get magic number from include by name
|
||||
int borderItemType = QGraphicsItem::UserType + 136; // TODO: Magic number warning
|
||||
int labelItemType = QGraphicsItem::UserType + 135; // TODO: Magic number warning
|
||||
int captionItemType = QGraphicsItem::UserType + 180; // TODO: Magic number warning
|
||||
int leaderItemType = QGraphicsItem::UserType + 232; // TODO: Magic number warning
|
||||
int textLeaderItemType = QGraphicsItem::UserType + 233; // TODO: Magic number warning
|
||||
int editablePathItemType = QGraphicsItem::UserType + 301; // TODO: Magic number warning
|
||||
int movableTextItemType = QGraphicsItem::UserType + 300;
|
||||
int weldingSymbolItemType = QGraphicsItem::UserType + 340;
|
||||
int centerMarkItemType = QGraphicsItem::UserType + 171;
|
||||
QRectF result;
|
||||
for (auto& child : children) {
|
||||
if (!child->isVisible()) {
|
||||
continue;
|
||||
}
|
||||
if ( (child->type() != dimItemType) &&
|
||||
(child->type() != leaderItemType) &&
|
||||
(child->type() != textLeaderItemType) &&
|
||||
(child->type() != editablePathItemType) &&
|
||||
(child->type() != movableTextItemType) &&
|
||||
(child->type() != borderItemType) &&
|
||||
(child->type() != labelItemType) &&
|
||||
(child->type() != weldingSymbolItemType) &&
|
||||
(child->type() != captionItemType) &&
|
||||
(child->type() != centerMarkItemType)) {
|
||||
if (child->type() != UserType::QGIViewDimension &&
|
||||
child->type() != UserType::QGILeaderLine &&
|
||||
child->type() != UserType::QGIRichAnno &&
|
||||
child->type() != UserType::QGEPath &&
|
||||
child->type() != UserType::QGMText &&
|
||||
child->type() != UserType::QGCustomBorder &&
|
||||
child->type() != UserType::QGCustomLabel &&
|
||||
child->type() != UserType::QGIWeldSymbol &&
|
||||
child->type() != UserType::QGICaption &&
|
||||
child->type() != UserType::QGICMark) {
|
||||
QRectF childRect = mapFromItem(child, child->boundingRect()).boundingRect();
|
||||
result = result.united(childRect);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QGraphicsScene;
|
||||
class QGraphicsSceneMouseEvent;
|
||||
@@ -74,13 +76,13 @@ class QGCustomImage;
|
||||
class QGTracker;
|
||||
class QGIVertex;
|
||||
|
||||
class TechDrawGuiExport QGIView : public QObject, public QGraphicsItemGroup
|
||||
class TechDrawGuiExport QGIView : public QObject, public QGraphicsItemGroup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QGIView();
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 101};
|
||||
enum {Type = UserType::QGIView};
|
||||
int type() const override { return Type;}
|
||||
QRectF boundingRect() const override;
|
||||
void paint( QPainter *painter,
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "QGIView.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDraw {
|
||||
class DrawViewAnnotation;
|
||||
@@ -45,7 +46,7 @@ public:
|
||||
/// m_textItem belongs to this group and will be deleted by Qt
|
||||
~QGIViewAnnotation() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 120};
|
||||
enum {Type = UserType::QGIViewAnnotation};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void updateView(bool update = false) override;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "QGCustomText.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
namespace TechDraw
|
||||
@@ -65,10 +66,7 @@ public:
|
||||
QGIBalloonLabel();
|
||||
~QGIBalloonLabel() override = default;
|
||||
|
||||
enum
|
||||
{
|
||||
Type = QGraphicsItem::UserType + 141
|
||||
};
|
||||
enum {Type = UserType::QGIBalloonLabel};
|
||||
int type() const override
|
||||
{
|
||||
return Type;
|
||||
@@ -170,10 +168,7 @@ class TechDrawGuiExport QGIViewBalloon: public QGIView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
Type = QGraphicsItem::UserType + 140
|
||||
};
|
||||
enum {Type = UserType::QGIViewBalloon};
|
||||
|
||||
explicit QGIViewBalloon();
|
||||
~QGIViewBalloon() override = default;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "QGIView.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
@@ -39,7 +40,7 @@ public:
|
||||
QGIViewClip();
|
||||
~QGIViewClip() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 123};
|
||||
enum {Type = UserType::QGIViewClip};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void updateView(bool update = false) override;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "QGIView.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QGraphicsScene;
|
||||
@@ -41,7 +42,7 @@ public:
|
||||
QGIViewCollection();
|
||||
~QGIViewCollection() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 110};
|
||||
enum {Type = UserType::QGIViewCollection};
|
||||
int type() const override { return Type;}
|
||||
};
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "QGCustomText.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGIUserTypes.h"
|
||||
#include "Rez.h"
|
||||
|
||||
|
||||
@@ -65,7 +66,7 @@ class TechDrawGuiExport QGIViewDimension : public QGIView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum {Type = QGraphicsItem::UserType + 106};
|
||||
enum {Type = UserType::QGIViewDimension};
|
||||
|
||||
QGIViewDimension();
|
||||
~QGIViewDimension() override = default;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "QGIView.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDraw {
|
||||
class DrawViewImage;
|
||||
@@ -42,7 +43,7 @@ public:
|
||||
QGIViewImage();
|
||||
~QGIViewImage() override;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 200};
|
||||
enum {Type = UserType::QGIViewImage};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void updateView(bool update = false) override;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
#include "QGIView.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
class QColor;
|
||||
|
||||
@@ -63,7 +64,7 @@ public:
|
||||
explicit QGIViewPart();
|
||||
~QGIViewPart() override;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 102};
|
||||
enum {Type = UserType::QGIViewPart};
|
||||
int type() const override { return Type;}
|
||||
void paint( QPainter * painter,
|
||||
const QStyleOptionGraphicsItem * option,
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "QGIViewPart.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
@@ -39,7 +40,7 @@ public:
|
||||
|
||||
void draw() override;
|
||||
void updateView(bool update = false) override;
|
||||
enum { Type = QGraphicsItem::UserType + 108 };
|
||||
enum {Type = UserType::QGIViewSection};
|
||||
int type() const override { return Type; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "QGIViewSymbol.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDraw {
|
||||
class DrawViewSpreadsheet;
|
||||
@@ -40,7 +41,7 @@ public:
|
||||
QGIViewSpreadsheet();
|
||||
~QGIViewSpreadsheet() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 124};
|
||||
enum {Type = UserType::QGISpreadsheet};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void setViewFeature(TechDraw::DrawViewSpreadsheet *obj);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QByteArray>
|
||||
|
||||
#include "QGIView.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
namespace TechDraw {
|
||||
@@ -46,7 +47,7 @@ public:
|
||||
QGIViewSymbol();
|
||||
~QGIViewSymbol() override;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 121};
|
||||
enum {Type = UserType::QGIViewSymbol};
|
||||
int type() const override { return Type;}
|
||||
|
||||
void updateView(bool update = false) override;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <QPointF>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
#include "QGIView.h"
|
||||
|
||||
|
||||
@@ -61,7 +62,7 @@ class TechDrawGuiExport QGIWeldSymbol : public QGIView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum {Type = QGraphicsItem::UserType + 340};
|
||||
enum {Type = UserType::QGIWeldSymbol};
|
||||
|
||||
explicit QGIWeldSymbol();
|
||||
~QGIWeldSymbol() override = default;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include "QGCustomText.h"
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -48,7 +49,7 @@ public:
|
||||
explicit QGMText(void);
|
||||
~QGMText() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 300};
|
||||
enum {Type = UserType::QGMText};
|
||||
int type() const override { return Type;}
|
||||
void paint( QPainter * painter,
|
||||
const QStyleOptionGraphicsItem * option,
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
#include "QGIRichAnno.h"
|
||||
#include "QGISVGTemplate.h"
|
||||
#include "QGITemplate.h"
|
||||
#include "QGIUserTypes.h"
|
||||
#include "QGIViewAnnotation.h"
|
||||
#include "QGIViewBalloon.h"
|
||||
#include "QGIViewClip.h"
|
||||
@@ -136,10 +137,12 @@ bool QGSPage::itemClearsSelection(int itemTypeIn)
|
||||
// type 13 is the itemUnderMouse on a page outside of any views. It is not
|
||||
// the template or background or foreground. QGraphicsItem type = 13 is not
|
||||
// documented and not found in QGraphicsItem.h.
|
||||
const std::vector<int> ClearingTypes { 13, // MysteryType
|
||||
QGraphicsItem::UserType + 150, // QGITemplateType
|
||||
QGraphicsItem::UserType + 151, // QGIDrawingTemplateType
|
||||
QGraphicsItem::UserType + 153 }; // QGISVGTemplateType
|
||||
const std::vector<int> ClearingTypes {
|
||||
13, // MysteryType
|
||||
UserType::QGITemplate,
|
||||
UserType::QGIDrawingTemplate,
|
||||
UserType::QGISVGTemplate
|
||||
};
|
||||
|
||||
for (auto& type : ClearingTypes) {
|
||||
if (itemTypeIn == type) {
|
||||
@@ -353,8 +356,7 @@ int QGSPage::removeQViewByName(const char* name)
|
||||
}
|
||||
|
||||
if (found) {
|
||||
int balloonItemType = QGraphicsItem::UserType + 140;
|
||||
if (ourItem->type() == balloonItemType) {
|
||||
if (ourItem->type() == UserType::QGIViewBalloon) {
|
||||
QGIViewBalloon* balloon = dynamic_cast<QGIViewBalloon*>(ourItem);
|
||||
balloon->disconnect();
|
||||
}
|
||||
@@ -462,20 +464,16 @@ void QGSPage::addItemToParent(QGIView* item, QGIView* parent)
|
||||
// defined relative to the Page should not use the dimension/balloon mapping.
|
||||
assert(item);
|
||||
assert(parent);
|
||||
// TODO: make custom user types retrievable by name (see QGIUserTypes.h)
|
||||
constexpr int QGIVDimensionType {QGraphicsItem::UserType + 106};
|
||||
constexpr int QGIVBalloonType {QGraphicsItem::UserType + 140};
|
||||
constexpr int QGIWeldSymbolType {QGraphicsItem::UserType + 340};
|
||||
// constexpr int QGIViewAnnotationType {QGraphicsItem::UserType + 120};
|
||||
|
||||
if (item->type() == QGIWeldSymbolType) {
|
||||
if (item->type() == UserType::QGIWeldSymbol) {
|
||||
// don't touch these
|
||||
return;
|
||||
}
|
||||
|
||||
// original parenting logic here
|
||||
QPointF posRef(0., 0.);
|
||||
if (item->type() == QGIVDimensionType || item->type() == QGIVBalloonType) {
|
||||
if (item->type() == UserType::QGIViewDimension ||
|
||||
item->type() == UserType::QGIViewBalloon) {
|
||||
QPointF mapPos = item->mapToItem(parent, posRef);
|
||||
item->moveBy(-mapPos.x(), -mapPos.y());
|
||||
parent->addToGroup(item);
|
||||
|
||||
@@ -36,6 +36,7 @@ QT_END_NAMESPACE
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
#include "QGIPrimPath.h"
|
||||
|
||||
namespace TechDrawGui
|
||||
@@ -70,7 +71,7 @@ public:
|
||||
~QGTracker() override;
|
||||
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 210};
|
||||
enum {Type = UserType::QGTracker};
|
||||
|
||||
int type() const override { return Type;}
|
||||
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QGraphicsPathItem>
|
||||
|
||||
#include "QGIUserTypes.h"
|
||||
|
||||
namespace TechDraw {
|
||||
class DrawTemplate;
|
||||
}
|
||||
@@ -49,7 +51,7 @@ class TechDrawGuiExport TemplateTextField : public QGraphicsItemGroup
|
||||
|
||||
~TemplateTextField() override = default;
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 160};
|
||||
enum {Type = UserType::TemplateTextField};
|
||||
int type() const override { return Type;}
|
||||
|
||||
/// Returns the field name that this TemplateTextField represents
|
||||
|
||||
Reference in New Issue
Block a user