0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00

Added timeout before changing geometry

This commit is contained in:
Arin Alexander 2020-12-29 23:56:54 +03:00
parent 3c2388dce5
commit 698f7a0171
3 changed files with 17 additions and 2 deletions

View File

@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 5
LIMEREPORT_VERSION_RELEASE = 73
LIMEREPORT_VERSION_RELEASE = 76
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -85,7 +85,9 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
m_fillTransparentInDesignMode(true),
m_unitType(Millimeters),
m_itemGeometryLocked(false),
m_isChangingPos(false)
m_isChangingPos(false),
m_isMoveable(false)
{
setGeometry(QRectF(0, 0, m_width, m_height));
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
@ -387,6 +389,10 @@ void BaseDesignIntf::setFixedPos(bool fixedPos)
m_fixedPos = fixedPos;
}
void BaseDesignIntf::onChangeGeometryTimeOut(){
m_isMoveable = true;
}
void BaseDesignIntf::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
@ -396,6 +402,8 @@ void BaseDesignIntf::mousePressEvent(QGraphicsSceneMouseEvent *event)
m_oldGeometry = geometry();
QGraphicsItem::mousePressEvent(event);
emit(itemSelected(this));
m_isMoveable = false;
m_timer.singleShot(200, this, SLOT(onChangeGeometryTimeOut()));
}
else QGraphicsItem::mousePressEvent(event);
}
@ -524,6 +532,7 @@ void BaseDesignIntf::hoverEnterEvent(QGraphicsSceneHoverEvent /**event*/)
void BaseDesignIntf::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if (!m_isMoveable) return;
if (!isSelected()){
QGraphicsItem::mouseMoveEvent(event);
return;

View File

@ -403,6 +403,9 @@ private:
Qt::CursorShape getPossibleCursor(int cursorFlags);
void updatePossibleDirectionFlags();
private slots:
void onChangeGeometryTimeOut();
private:
QPointF m_startPos;
int m_resizeHandleSize;
@ -463,6 +466,9 @@ private:
UnitType m_unitType;
bool m_itemGeometryLocked;
bool m_isChangingPos;
bool m_isMoveable;
QTimer m_timer;
signals:
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
void posChanging(QObject* object, QPointF newPos, QPointF oldPos);