mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 08:34:38 +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_MAJOR = 1
|
||||||
LIMEREPORT_VERSION_MINOR = 5
|
LIMEREPORT_VERSION_MINOR = 5
|
||||||
LIMEREPORT_VERSION_RELEASE = 49
|
LIMEREPORT_VERSION_RELEASE = 50
|
||||||
|
|
||||||
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}\\\"
|
||||||
|
@ -84,7 +84,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
|||||||
m_selectionMarker(0),
|
m_selectionMarker(0),
|
||||||
m_fillTransparentInDesignMode(true),
|
m_fillTransparentInDesignMode(true),
|
||||||
m_unitType(Millimeters),
|
m_unitType(Millimeters),
|
||||||
m_itemGeometryLocked(false)
|
m_itemGeometryLocked(false),
|
||||||
|
m_isChangingPos(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)) {
|
||||||
@ -389,6 +390,7 @@ void BaseDesignIntf::setFixedPos(bool fixedPos)
|
|||||||
void BaseDesignIntf::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
void BaseDesignIntf::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
|
m_isChangingPos = true;
|
||||||
m_resizeDirectionFlags = resizeDirectionFlags(event->pos());
|
m_resizeDirectionFlags = resizeDirectionFlags(event->pos());
|
||||||
m_startPos = pos();
|
m_startPos = pos();
|
||||||
m_oldGeometry = geometry();
|
m_oldGeometry = geometry();
|
||||||
@ -398,6 +400,17 @@ void BaseDesignIntf::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
else QGraphicsItem::mousePressEvent(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)
|
void BaseDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
Q_UNUSED(option);
|
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
|
bool BaseDesignIntf::isGeometryLocked() const
|
||||||
{
|
{
|
||||||
return m_itemGeometryLocked;
|
return m_itemGeometryLocked;
|
||||||
@ -1257,15 +1280,6 @@ void BaseDesignIntf::setItemPos(const QPointF &newPos)
|
|||||||
emit posChanging(this, finalPos, oldPos);
|
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){
|
QWidget* findRootWidget(QWidget* widget){
|
||||||
while (widget->parentWidget()) {
|
while (widget->parentWidget()) {
|
||||||
|
@ -331,6 +331,9 @@ public:
|
|||||||
bool isGeometryLocked() const;
|
bool isGeometryLocked() const;
|
||||||
void setGeometryLocked(bool itemLocked);
|
void setGeometryLocked(bool itemLocked);
|
||||||
|
|
||||||
|
bool isChangingPos() const;
|
||||||
|
void setIsChangingPos(bool isChangingPos);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//ICollectionContainer
|
//ICollectionContainer
|
||||||
@ -460,6 +463,7 @@ private:
|
|||||||
QRect m_itemGeometry;
|
QRect m_itemGeometry;
|
||||||
UnitType m_unitType;
|
UnitType m_unitType;
|
||||||
bool m_itemGeometryLocked;
|
bool m_itemGeometryLocked;
|
||||||
|
bool m_isChangingPos;
|
||||||
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);
|
||||||
|
@ -876,8 +876,8 @@ void PageItemDesignIntf::moveBandFromTo(int from, int to)
|
|||||||
|
|
||||||
void PageItemDesignIntf::bandPositionChanged(QObject* object, QPointF newPos, QPointF oldPos)
|
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();
|
int curIndex = band->bandIndex();
|
||||||
BandDesignIntf* bandToSwap = 0;
|
BandDesignIntf* bandToSwap = 0;
|
||||||
foreach(BandDesignIntf* curBand, bands()){
|
foreach(BandDesignIntf* curBand, bands()){
|
||||||
@ -906,6 +906,7 @@ void PageItemDesignIntf::bandPositionChanged(QObject* object, QPointF newPos, QP
|
|||||||
page()->saveCommand(BandMoveFromToCommand::create(page(), band->bandIndex(), bandToSwap->bandIndex()), true);
|
page()->saveCommand(BandMoveFromToCommand::create(page(), band->bandIndex(), bandToSwap->bandIndex()), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (band && !band->isChangingPos())
|
||||||
relocateBands();
|
relocateBands();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ void QObjectPropertyModel::translatePropertyName()
|
|||||||
tr("geometryLocked");
|
tr("geometryLocked");
|
||||||
tr("printBehavior");
|
tr("printBehavior");
|
||||||
tr("shiftItems");
|
tr("shiftItems");
|
||||||
|
tr("showLegend");
|
||||||
tr("removeGap");
|
tr("removeGap");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2030,6 +2030,10 @@ p, li { white-space: pre-wrap; }
|
|||||||
<source>removeGap</source>
|
<source>removeGap</source>
|
||||||
<translation>Удалять разрыв</translation>
|
<translation>Удалять разрыв</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>showLegend</source>
|
||||||
|
<translation>Показывать легенду</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>LimeReport::RectPropItem</name>
|
<name>LimeReport::RectPropItem</name>
|
||||||
|
Loading…
Reference in New Issue
Block a user