From 76ae6dfb2409810e6dfd705d2b994c77e8a73e78 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 21 Jan 2019 14:17:34 +0300 Subject: [PATCH] Layout has been fixed --- common.pri | 2 +- limereport/lrbasedesignintf.cpp | 7 ++++--- limereport/lrbasedesignintf.h | 2 +- limereport/lrpageitemdesignintf.cpp | 10 +++++----- limereport/lrpageitemdesignintf.h | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/common.pri b/common.pri index 337b2c1..9534741 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 119 +LIMEREPORT_VERSION_RELEASE = 120 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 610bd5f..898c9a7 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -1026,6 +1026,7 @@ QVariant BaseDesignIntf::itemChange(QGraphicsItem::GraphicsItemChange change, co if (change == QGraphicsItem::ItemPositionHasChanged) { updateSelectionMarker(); } + if (change == QGraphicsItem::ItemSelectedChange) { turnOnSelectionMarker(value.toBool()); emit itemSelectedHasBeenChanged(this, value.toBool()); @@ -1120,18 +1121,18 @@ void BaseDesignIntf::setItemPos(const QPointF &newPos) QPointF oldPos = pos(); QPointF finalPos = modifyPosForAlignedItem(newPos); QGraphicsItem::setPos(finalPos); - emit posChanged(this, finalPos, oldPos); + emit posChanging(this, finalPos, oldPos); } void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - QGraphicsItem::mouseReleaseEvent(event); QRectF newGeometry = geometry(); if (newGeometry != m_oldGeometry) { geometryChangedEvent(newGeometry, m_oldGeometry); updateSelectionMarker(); - emit(geometryChanged(this, newGeometry, m_oldGeometry)); + emit(posChanged(this, newGeometry.topLeft(), m_oldGeometry.topLeft())); } + QGraphicsItem::mouseReleaseEvent(event); } void BaseDesignIntf::showEditorDialog(){ diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 904b64e..313c0f4 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -401,6 +401,7 @@ private: bool m_watermark; signals: void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); + void posChanging(QObject* object, QPointF newPos, QPointF oldPos); void posChanged(QObject* object, QPointF newPos, QPointF oldPos); void itemSelected(LimeReport::BaseDesignIntf *item); void itemSelectedHasBeenChanged(BaseDesignIntf *item, bool value); @@ -412,7 +413,6 @@ signals: void propertyesChanged(QVector propertyNames); void itemAlignChanged(BaseDesignIntf* item, const ItemAlign& oldValue, const ItemAlign& newValue); void itemVisibleHasChanged(BaseDesignIntf* item); - void beforeRender(); void afterData(); void afterRender(); diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index c3a20e7..b4ba954 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -303,7 +303,7 @@ void PageItemDesignIntf::registerBand(BandDesignIntf *band) band->setParentItem(this); band->setWidth(pageRect().width()/band->columnsCount()); connect(band, SIGNAL(destroyed(QObject*)),this,SLOT(bandDeleted(QObject*))); - connect(band, SIGNAL(geometryChanged(QObject*,QRectF,QRectF)),this,SLOT(bandGeometryChanged(QObject*,QRectF,QRectF))); + connect(band, SIGNAL(posChanged(QObject*,QPointF,QPointF)),this,SLOT(bandPositionChanged(QObject*,QPointF,QPointF))); } } @@ -664,17 +664,17 @@ void PageItemDesignIntf::moveBandFromTo(int from, int to) } -void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry) +void PageItemDesignIntf::bandPositionChanged(QObject* object, QPointF newPos, QPointF oldPos) { if (itemMode() == DesignMode){ BandDesignIntf* band = dynamic_cast(object); int curIndex = band->bandIndex(); BandDesignIntf* bandToSwap = 0; foreach(BandDesignIntf* curBand, bands()){ - if (newGeometry.y() > oldGeometry.y()) { + if (newPos.y() > oldPos.y()) { if (curBand->bandType() == band->bandType() && curIndex < curBand->bandIndex() - && (curBand->pos().y() + (curBand->height()/2)) < newGeometry.y() + && (curBand->pos().y() + (curBand->height()/2)) < newPos.y() && curBand->parentBand() == band->parentBand()) { curIndex = curBand->bandIndex(); @@ -683,7 +683,7 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry } else { if (curBand->bandType() == band->bandType() && curIndex>curBand->bandIndex() - && (curBand->pos().y() + (curBand->height()/2)) > newGeometry.y() + && (curBand->pos().y() + (curBand->height()/2)) > newPos.y() && curBand->parentBand() == band->parentBand()) { curIndex = curBand->bandIndex(); diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index 2287cf8..315ce08 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -122,7 +122,7 @@ public: protected slots: void bandDeleted(QObject* band); - void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); + void bandPositionChanged(QObject* object, QPointF newPos, QPointF oldPos); protected: void collectionLoadFinished(const QString& collectionName); QRectF& pageRect(){return m_pageRect;}