[TD]fix multiple dimension drag
This commit is contained in:
committed by
WandererFan
parent
730b14353c
commit
cb96332a64
@@ -95,7 +95,14 @@ enum SnapMode{
|
||||
HorizontalSnap
|
||||
};
|
||||
|
||||
QGIDatumLabel::QGIDatumLabel()
|
||||
enum DragState {
|
||||
NoDrag,
|
||||
DragStarted,
|
||||
Dragging };
|
||||
|
||||
|
||||
QGIDatumLabel::QGIDatumLabel() :
|
||||
m_dragState(NoDrag)
|
||||
{
|
||||
verticalSep = false;
|
||||
posX = 0;
|
||||
@@ -136,10 +143,16 @@ QVariant QGIDatumLabel::itemChange(GraphicsItemChange change, const QVariant &va
|
||||
setPrettySel();
|
||||
} else {
|
||||
setPrettyNormal();
|
||||
if (m_dragState == Dragging) {
|
||||
//stop the drag if we are no longer selected.
|
||||
m_dragState = NoDrag;
|
||||
Q_EMIT dragFinished();
|
||||
}
|
||||
}
|
||||
update();
|
||||
|
||||
} else if(change == ItemPositionHasChanged && scene()) {
|
||||
setLabelCenter();
|
||||
m_dragState = Dragging;
|
||||
Q_EMIT dragging(m_ctrl);
|
||||
}
|
||||
|
||||
@@ -164,11 +177,9 @@ void QGIDatumLabel::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
|
||||
{
|
||||
// Base::Console().Message("QGIDL::mouseReleaseEvent()\n");
|
||||
m_ctrl = false;
|
||||
if (QLineF(event->screenPos(), event->buttonDownScreenPos(Qt::LeftButton))
|
||||
.length() > 0) {
|
||||
if (scene() && this == scene()->mouseGrabberItem()) {
|
||||
Q_EMIT dragFinished();
|
||||
}
|
||||
if (m_dragState == Dragging) {
|
||||
m_dragState = NoDrag;
|
||||
Q_EMIT dragFinished();
|
||||
}
|
||||
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
|
||||
@@ -136,6 +136,8 @@ protected:
|
||||
|
||||
bool m_isFramed;
|
||||
double m_lineWidth;
|
||||
|
||||
int m_dragState;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user