0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00

Layout has been fixed

This commit is contained in:
Arin Alexander 2019-01-21 14:17:34 +03:00
parent 651367e6a3
commit 76ae6dfb24
5 changed files with 12 additions and 11 deletions

View File

@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 4 LIMEREPORT_VERSION_MINOR = 4
LIMEREPORT_VERSION_RELEASE = 119 LIMEREPORT_VERSION_RELEASE = 120
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}\"

View File

@ -1026,6 +1026,7 @@ QVariant BaseDesignIntf::itemChange(QGraphicsItem::GraphicsItemChange change, co
if (change == QGraphicsItem::ItemPositionHasChanged) { if (change == QGraphicsItem::ItemPositionHasChanged) {
updateSelectionMarker(); updateSelectionMarker();
} }
if (change == QGraphicsItem::ItemSelectedChange) { if (change == QGraphicsItem::ItemSelectedChange) {
turnOnSelectionMarker(value.toBool()); turnOnSelectionMarker(value.toBool());
emit itemSelectedHasBeenChanged(this, value.toBool()); emit itemSelectedHasBeenChanged(this, value.toBool());
@ -1120,18 +1121,18 @@ void BaseDesignIntf::setItemPos(const QPointF &newPos)
QPointF oldPos = pos(); QPointF oldPos = pos();
QPointF finalPos = modifyPosForAlignedItem(newPos); QPointF finalPos = modifyPosForAlignedItem(newPos);
QGraphicsItem::setPos(finalPos); QGraphicsItem::setPos(finalPos);
emit posChanged(this, finalPos, oldPos); emit posChanging(this, finalPos, oldPos);
} }
void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
QGraphicsItem::mouseReleaseEvent(event);
QRectF newGeometry = geometry(); QRectF newGeometry = geometry();
if (newGeometry != m_oldGeometry) { if (newGeometry != m_oldGeometry) {
geometryChangedEvent(newGeometry, m_oldGeometry); geometryChangedEvent(newGeometry, m_oldGeometry);
updateSelectionMarker(); updateSelectionMarker();
emit(geometryChanged(this, newGeometry, m_oldGeometry)); emit(posChanged(this, newGeometry.topLeft(), m_oldGeometry.topLeft()));
} }
QGraphicsItem::mouseReleaseEvent(event);
} }
void BaseDesignIntf::showEditorDialog(){ void BaseDesignIntf::showEditorDialog(){

View File

@ -401,6 +401,7 @@ private:
bool m_watermark; bool m_watermark;
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 posChanged(QObject* object, QPointF newPos, QPointF oldPos); void posChanged(QObject* object, QPointF newPos, QPointF oldPos);
void itemSelected(LimeReport::BaseDesignIntf *item); void itemSelected(LimeReport::BaseDesignIntf *item);
void itemSelectedHasBeenChanged(BaseDesignIntf *item, bool value); void itemSelectedHasBeenChanged(BaseDesignIntf *item, bool value);
@ -412,7 +413,6 @@ signals:
void propertyesChanged(QVector<QString> propertyNames); void propertyesChanged(QVector<QString> propertyNames);
void itemAlignChanged(BaseDesignIntf* item, const ItemAlign& oldValue, const ItemAlign& newValue); void itemAlignChanged(BaseDesignIntf* item, const ItemAlign& oldValue, const ItemAlign& newValue);
void itemVisibleHasChanged(BaseDesignIntf* item); void itemVisibleHasChanged(BaseDesignIntf* item);
void beforeRender(); void beforeRender();
void afterData(); void afterData();
void afterRender(); void afterRender();

View File

@ -303,7 +303,7 @@ void PageItemDesignIntf::registerBand(BandDesignIntf *band)
band->setParentItem(this); band->setParentItem(this);
band->setWidth(pageRect().width()/band->columnsCount()); band->setWidth(pageRect().width()/band->columnsCount());
connect(band, SIGNAL(destroyed(QObject*)),this,SLOT(bandDeleted(QObject*))); 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){ if (itemMode() == DesignMode){
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(object); BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(object);
int curIndex = band->bandIndex(); int curIndex = band->bandIndex();
BandDesignIntf* bandToSwap = 0; BandDesignIntf* bandToSwap = 0;
foreach(BandDesignIntf* curBand, bands()){ foreach(BandDesignIntf* curBand, bands()){
if (newGeometry.y() > oldGeometry.y()) { if (newPos.y() > oldPos.y()) {
if (curBand->bandType() == band->bandType() if (curBand->bandType() == band->bandType()
&& curIndex < curBand->bandIndex() && curIndex < curBand->bandIndex()
&& (curBand->pos().y() + (curBand->height()/2)) < newGeometry.y() && (curBand->pos().y() + (curBand->height()/2)) < newPos.y()
&& curBand->parentBand() == band->parentBand()) && curBand->parentBand() == band->parentBand())
{ {
curIndex = curBand->bandIndex(); curIndex = curBand->bandIndex();
@ -683,7 +683,7 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry
} else { } else {
if (curBand->bandType() == band->bandType() if (curBand->bandType() == band->bandType()
&& curIndex>curBand->bandIndex() && curIndex>curBand->bandIndex()
&& (curBand->pos().y() + (curBand->height()/2)) > newGeometry.y() && (curBand->pos().y() + (curBand->height()/2)) > newPos.y()
&& curBand->parentBand() == band->parentBand()) && curBand->parentBand() == band->parentBand())
{ {
curIndex = curBand->bandIndex(); curIndex = curBand->bandIndex();

View File

@ -122,7 +122,7 @@ public:
protected slots: protected slots:
void bandDeleted(QObject* band); void bandDeleted(QObject* band);
void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); void bandPositionChanged(QObject* object, QPointF newPos, QPointF oldPos);
protected: protected:
void collectionLoadFinished(const QString& collectionName); void collectionLoadFinished(const QString& collectionName);
QRectF& pageRect(){return m_pageRect;} QRectF& pageRect(){return m_pageRect;}