mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Band moving in design mode has been fixed
This commit is contained in:
parent
985c849f41
commit
ca6241f61e
@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
|
||||
|
||||
LIMEREPORT_VERSION_MAJOR = 1
|
||||
LIMEREPORT_VERSION_MINOR = 5
|
||||
LIMEREPORT_VERSION_RELEASE = 49
|
||||
LIMEREPORT_VERSION_RELEASE = 50
|
||||
|
||||
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
|
||||
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
|
||||
|
@ -84,7 +84,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
||||
m_selectionMarker(0),
|
||||
m_fillTransparentInDesignMode(true),
|
||||
m_unitType(Millimeters),
|
||||
m_itemGeometryLocked(false)
|
||||
m_itemGeometryLocked(false),
|
||||
m_isChangingPos(false)
|
||||
{
|
||||
setGeometry(QRectF(0, 0, m_width, m_height));
|
||||
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
||||
@ -389,6 +390,7 @@ void BaseDesignIntf::setFixedPos(bool fixedPos)
|
||||
void BaseDesignIntf::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
m_isChangingPos = true;
|
||||
m_resizeDirectionFlags = resizeDirectionFlags(event->pos());
|
||||
m_startPos = pos();
|
||||
m_oldGeometry = geometry();
|
||||
@ -398,6 +400,17 @@ void BaseDesignIntf::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
else QGraphicsItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
QRectF newGeometry = geometry();
|
||||
m_isChangingPos = false;
|
||||
if (newGeometry != m_oldGeometry) {
|
||||
geometryChangedEvent(newGeometry, m_oldGeometry);
|
||||
emit posChanged(this, newGeometry.topLeft(), m_oldGeometry.topLeft());
|
||||
}
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void BaseDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
@ -732,6 +745,16 @@ void BaseDesignIntf::updatePossibleDirectionFlags(){
|
||||
}
|
||||
}
|
||||
|
||||
bool BaseDesignIntf::isChangingPos() const
|
||||
{
|
||||
return m_isChangingPos;
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setIsChangingPos(bool isChangingPos)
|
||||
{
|
||||
m_isChangingPos = isChangingPos;
|
||||
}
|
||||
|
||||
bool BaseDesignIntf::isGeometryLocked() const
|
||||
{
|
||||
return m_itemGeometryLocked;
|
||||
@ -1257,15 +1280,6 @@ void BaseDesignIntf::setItemPos(const QPointF &newPos)
|
||||
emit posChanging(this, finalPos, oldPos);
|
||||
}
|
||||
|
||||
void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
QRectF newGeometry = geometry();
|
||||
if (newGeometry != m_oldGeometry) {
|
||||
geometryChangedEvent(newGeometry, m_oldGeometry);
|
||||
emit posChanged(this, newGeometry.topLeft(), m_oldGeometry.topLeft());
|
||||
}
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
QWidget* findRootWidget(QWidget* widget){
|
||||
while (widget->parentWidget()) {
|
||||
|
@ -331,6 +331,9 @@ public:
|
||||
bool isGeometryLocked() const;
|
||||
void setGeometryLocked(bool itemLocked);
|
||||
|
||||
bool isChangingPos() const;
|
||||
void setIsChangingPos(bool isChangingPos);
|
||||
|
||||
protected:
|
||||
|
||||
//ICollectionContainer
|
||||
@ -460,6 +463,7 @@ private:
|
||||
QRect m_itemGeometry;
|
||||
UnitType m_unitType;
|
||||
bool m_itemGeometryLocked;
|
||||
bool m_isChangingPos;
|
||||
signals:
|
||||
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
||||
void posChanging(QObject* object, QPointF newPos, QPointF oldPos);
|
||||
|
@ -876,8 +876,8 @@ void PageItemDesignIntf::moveBandFromTo(int from, int to)
|
||||
|
||||
void PageItemDesignIntf::bandPositionChanged(QObject* object, QPointF newPos, QPointF oldPos)
|
||||
{
|
||||
if (itemMode() == DesignMode){
|
||||
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(object);
|
||||
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(object);
|
||||
if (band && !band->isChangingPos() && (itemMode() == DesignMode)){
|
||||
int curIndex = band->bandIndex();
|
||||
BandDesignIntf* bandToSwap = 0;
|
||||
foreach(BandDesignIntf* curBand, bands()){
|
||||
@ -906,7 +906,8 @@ void PageItemDesignIntf::bandPositionChanged(QObject* object, QPointF newPos, QP
|
||||
page()->saveCommand(BandMoveFromToCommand::create(page(), band->bandIndex(), bandToSwap->bandIndex()), true);
|
||||
}
|
||||
}
|
||||
relocateBands();
|
||||
if (band && !band->isChangingPos())
|
||||
relocateBands();
|
||||
}
|
||||
|
||||
void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry)
|
||||
|
@ -164,6 +164,7 @@ void QObjectPropertyModel::translatePropertyName()
|
||||
tr("geometryLocked");
|
||||
tr("printBehavior");
|
||||
tr("shiftItems");
|
||||
tr("showLegend");
|
||||
tr("removeGap");
|
||||
}
|
||||
|
||||
|
@ -2030,6 +2030,10 @@ p, li { white-space: pre-wrap; }
|
||||
<source>removeGap</source>
|
||||
<translation>Удалять разрыв</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>showLegend</source>
|
||||
<translation>Показывать легенду</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::RectPropItem</name>
|
||||
|
Loading…
Reference in New Issue
Block a user