[TD]fix Dimension/Balloon movement
This commit is contained in:
committed by
WandererFan
parent
f966861a80
commit
a799a5db66
@@ -343,6 +343,8 @@ void QGIView::updateView(bool update)
|
||||
{
|
||||
// Base::Console().Message("QGIV::updateView() - %s\n",getViewObject()->getNameInDocument());
|
||||
(void) update;
|
||||
|
||||
//allow/prevent dragging
|
||||
if (getViewObject()->isLocked()) {
|
||||
setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
} else {
|
||||
|
||||
@@ -79,7 +79,6 @@ public:
|
||||
enum {Type = QGraphicsItem::UserType + 101};
|
||||
int type() const override { return Type;}
|
||||
virtual QRectF boundingRect() const override;
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
virtual void paint( QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget = nullptr ) override;
|
||||
@@ -146,6 +145,9 @@ public:
|
||||
|
||||
// Mouse handling
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
|
||||
boost::signals2::signal<void (QGIView*, QPointF)> signalSelectPoint;
|
||||
|
||||
public Q_SLOTS:
|
||||
@@ -155,8 +157,6 @@ protected:
|
||||
QGIView* getQGIVByName(std::string name);
|
||||
|
||||
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
||||
// Mouse handling
|
||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
// Preselection events:
|
||||
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
|
||||
@@ -348,6 +348,25 @@ QVariant QGIViewBalloon::itemChange(GraphicsItemChange change, const QVariant &v
|
||||
return QGIView::itemChange(change, value);
|
||||
}
|
||||
|
||||
//QGIViewBalloon does not behave the same as other QGIView derived classes
|
||||
//and so mouse events need to be ignored. Only the QGIBalloonLabel mouse events are relevant.
|
||||
void QGIViewBalloon::mousePressEvent(QGraphicsSceneMouseEvent * event)
|
||||
{
|
||||
// Base::Console().Message("QGIVB::mousePressEvent() - %s\n",getViewName());
|
||||
QGraphicsItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void QGIViewBalloon::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
|
||||
{
|
||||
QGraphicsItem::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void QGIViewBalloon::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
|
||||
{
|
||||
// Base::Console().Message("QGIVB::mouseReleaseEvent() - %s\n",getViewName());
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
//Set selection state for this and it's children
|
||||
void QGIViewBalloon::setGroupSelection(bool b)
|
||||
{
|
||||
@@ -402,7 +421,6 @@ void QGIViewBalloon::setViewPartFeature(TechDraw::DrawViewBalloon *balloon)
|
||||
draw();
|
||||
}
|
||||
|
||||
//from ViewProviderDrawingView::updateData (X or Y)
|
||||
void QGIViewBalloon::updateView(bool update)
|
||||
{
|
||||
// Base::Console().Message("QGIVB::updateView()\n");
|
||||
|
||||
@@ -163,6 +163,10 @@ public Q_SLOTS:
|
||||
void updateBalloon(bool obtuse = false);
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event) override;
|
||||
virtual void mouseMoveEvent( QGraphicsSceneMouseEvent * event) override;
|
||||
virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent * event) override;
|
||||
|
||||
void draw() override;
|
||||
void drawBalloon(bool dragged = false);
|
||||
virtual QVariant itemChange( GraphicsItemChange change,
|
||||
|
||||
@@ -595,6 +595,19 @@ void QGIViewDimension::setNormalColorAll()
|
||||
aHead2->setFillColor(qc);
|
||||
}
|
||||
|
||||
//QGIViewDimension does not behave the same as other QGIView derived classes
|
||||
//and so mouse events need to be ignored. Only the QGIDatumLabel mouse events are relevant.
|
||||
void QGIViewDimension::mousePressEvent(QGraphicsSceneMouseEvent * event)
|
||||
{
|
||||
// Base::Console().Message("QGIVD::mousePressEvent() - %s\n",getViewName());
|
||||
QGraphicsItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void QGIViewDimension::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
|
||||
{
|
||||
QGraphicsItem::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void QGIViewDimension::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
|
||||
{
|
||||
// Base::Console().Message("QGIVDim::mouseReleaseEvent() - %s\n",getViewName());
|
||||
|
||||
@@ -180,6 +180,10 @@ public Q_SLOTS:
|
||||
|
||||
protected:
|
||||
|
||||
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event) override;
|
||||
virtual void mouseMoveEvent( QGraphicsSceneMouseEvent * event) override;
|
||||
virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent * event) override;
|
||||
|
||||
static double getAnglePlacementFactor(double testAngle, double endAngle, double startRotation);
|
||||
static int compareAngleStraightness(double straightAngle, double leftAngle, double rightAngle,
|
||||
double leftStrikeFactor, double rightStrikeFactor);
|
||||
@@ -258,8 +262,6 @@ protected:
|
||||
Base::Vector3d findIsoExt(Base::Vector3d isoDir) const;
|
||||
QString getPrecision(void);
|
||||
|
||||
virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent * event) override;
|
||||
|
||||
bool hasHover;
|
||||
QGIDatumLabel* datumLabel; //dimension text
|
||||
QGIDimLines* dimLines; //dimension lines + extension lines
|
||||
|
||||
@@ -139,7 +139,18 @@ void ViewProviderBalloon::unsetEdit(int ModNum)
|
||||
|
||||
void ViewProviderBalloon::updateData(const App::Property* p)
|
||||
{
|
||||
ViewProviderDrawingView::updateData(p);
|
||||
//Balloon handles X,Y updates differently that other QGIView
|
||||
//call QGIViewBalloon::updateView
|
||||
if (p == &(getViewObject()->X) ||
|
||||
p == &(getViewObject()->Y) ){
|
||||
QGIView* qgiv = getQView();
|
||||
if (qgiv) {
|
||||
qgiv->updateView(true);
|
||||
}
|
||||
}
|
||||
|
||||
//Skip QGIView X,Y processing - do not call ViewProviderDrawingView
|
||||
Gui::ViewProviderDocumentObject::updateData(p);
|
||||
}
|
||||
|
||||
void ViewProviderBalloon::onChanged(const App::Property* p)
|
||||
|
||||
@@ -174,7 +174,19 @@ void ViewProviderDimension::updateData(const App::Property* p)
|
||||
sPixmap = "TechDraw_3PtAngleDimension";
|
||||
}
|
||||
}
|
||||
ViewProviderDrawingView::updateData(p);
|
||||
|
||||
//Dimension handles X,Y updates differently that other QGIView
|
||||
//call QGIViewDimension::updateView
|
||||
if (p == &(getViewObject()->X) ||
|
||||
p == &(getViewObject()->Y) ){
|
||||
QGIView* qgiv = getQView();
|
||||
if (qgiv) {
|
||||
qgiv->updateView(true);
|
||||
}
|
||||
}
|
||||
|
||||
//Skip QGIView X,Y processing - do not call ViewProviderDrawingView
|
||||
Gui::ViewProviderDocumentObject::updateData(p);
|
||||
}
|
||||
|
||||
void ViewProviderDimension::onChanged(const App::Property* p)
|
||||
|
||||
Reference in New Issue
Block a user