mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-24 04:33:03 +03:00
Added timeout before changing geometry
This commit is contained in:
parent
3c2388dce5
commit
698f7a0171
@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
|
|||||||
|
|
||||||
LIMEREPORT_VERSION_MAJOR = 1
|
LIMEREPORT_VERSION_MAJOR = 1
|
||||||
LIMEREPORT_VERSION_MINOR = 5
|
LIMEREPORT_VERSION_MINOR = 5
|
||||||
LIMEREPORT_VERSION_RELEASE = 73
|
LIMEREPORT_VERSION_RELEASE = 76
|
||||||
|
|
||||||
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
|
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
|
||||||
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
|
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
|
||||||
|
@ -85,7 +85,9 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
|||||||
m_fillTransparentInDesignMode(true),
|
m_fillTransparentInDesignMode(true),
|
||||||
m_unitType(Millimeters),
|
m_unitType(Millimeters),
|
||||||
m_itemGeometryLocked(false),
|
m_itemGeometryLocked(false),
|
||||||
m_isChangingPos(false)
|
m_isChangingPos(false),
|
||||||
|
m_isMoveable(false)
|
||||||
|
|
||||||
{
|
{
|
||||||
setGeometry(QRectF(0, 0, m_width, m_height));
|
setGeometry(QRectF(0, 0, m_width, m_height));
|
||||||
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
||||||
@ -387,6 +389,10 @@ void BaseDesignIntf::setFixedPos(bool fixedPos)
|
|||||||
m_fixedPos = fixedPos;
|
m_fixedPos = fixedPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseDesignIntf::onChangeGeometryTimeOut(){
|
||||||
|
m_isMoveable = true;
|
||||||
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
void BaseDesignIntf::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
@ -396,6 +402,8 @@ void BaseDesignIntf::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
m_oldGeometry = geometry();
|
m_oldGeometry = geometry();
|
||||||
QGraphicsItem::mousePressEvent(event);
|
QGraphicsItem::mousePressEvent(event);
|
||||||
emit(itemSelected(this));
|
emit(itemSelected(this));
|
||||||
|
m_isMoveable = false;
|
||||||
|
m_timer.singleShot(200, this, SLOT(onChangeGeometryTimeOut()));
|
||||||
}
|
}
|
||||||
else QGraphicsItem::mousePressEvent(event);
|
else QGraphicsItem::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
@ -524,6 +532,7 @@ void BaseDesignIntf::hoverEnterEvent(QGraphicsSceneHoverEvent /**event*/)
|
|||||||
|
|
||||||
void BaseDesignIntf::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
void BaseDesignIntf::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
|
if (!m_isMoveable) return;
|
||||||
if (!isSelected()){
|
if (!isSelected()){
|
||||||
QGraphicsItem::mouseMoveEvent(event);
|
QGraphicsItem::mouseMoveEvent(event);
|
||||||
return;
|
return;
|
||||||
|
@ -403,6 +403,9 @@ private:
|
|||||||
Qt::CursorShape getPossibleCursor(int cursorFlags);
|
Qt::CursorShape getPossibleCursor(int cursorFlags);
|
||||||
void updatePossibleDirectionFlags();
|
void updatePossibleDirectionFlags();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onChangeGeometryTimeOut();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointF m_startPos;
|
QPointF m_startPos;
|
||||||
int m_resizeHandleSize;
|
int m_resizeHandleSize;
|
||||||
@ -463,6 +466,9 @@ private:
|
|||||||
UnitType m_unitType;
|
UnitType m_unitType;
|
||||||
bool m_itemGeometryLocked;
|
bool m_itemGeometryLocked;
|
||||||
bool m_isChangingPos;
|
bool m_isChangingPos;
|
||||||
|
bool m_isMoveable;
|
||||||
|
QTimer m_timer;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
||||||
void posChanging(QObject* object, QPointF newPos, QPointF oldPos);
|
void posChanging(QObject* object, QPointF newPos, QPointF oldPos);
|
||||||
|
Loading…
Reference in New Issue
Block a user