mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-01-11 12:28:09 +03:00
Fix: geometry changing for locked items is prevented
This commit is contained in:
parent
9bf0ba0ded
commit
11cb534608
@ -730,12 +730,12 @@ void BaseDesignIntf::updatePossibleDirectionFlags(){
|
||||
}
|
||||
}
|
||||
|
||||
bool BaseDesignIntf::isItemGeometryLocked() const
|
||||
bool BaseDesignIntf::isGeometryLocked() const
|
||||
{
|
||||
return m_itemGeometryLocked;
|
||||
}
|
||||
|
||||
void BaseDesignIntf::setItemGeometryLocked(bool itemLocked)
|
||||
void BaseDesignIntf::setGeometryLocked(bool itemLocked)
|
||||
{
|
||||
if (m_itemGeometryLocked != itemLocked){
|
||||
m_itemGeometryLocked = itemLocked;
|
||||
@ -1313,7 +1313,7 @@ void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
QAction* lockGeometryAction = menu.addAction(tr("Lock item geometry"));
|
||||
lockGeometryAction->setCheckable(true);
|
||||
lockGeometryAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
|
||||
lockGeometryAction->setChecked(isItemGeometryLocked());
|
||||
lockGeometryAction->setChecked(isGeometryLocked());
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* copyAction = menu.addAction(QIcon(":/report/images/copy"), tr("Copy"));
|
||||
@ -1700,7 +1700,7 @@ SelectionMarker::SelectionMarker(QGraphicsItem* parent, BaseDesignIntf* owner)
|
||||
|
||||
QColor SelectionMarker::color() const
|
||||
{
|
||||
return owner()->isItemGeometryLocked() ? Qt::darkGray : Marker::color();
|
||||
return owner()->isGeometryLocked() ? Qt::darkGray : Marker::color();
|
||||
}
|
||||
|
||||
void SelectionMarker::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
|
@ -98,7 +98,7 @@ class BaseDesignIntf :
|
||||
Q_PROPERTY(int borderLineSize READ borderLineSize WRITE setBorderLineSize)
|
||||
Q_PROPERTY(bool isVisible READ isVisible WRITE setItemVisible DESIGNABLE false)
|
||||
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
|
||||
Q_PROPERTY(bool geometryLocked READ isItemGeometryLocked WRITE setItemGeometryLocked)
|
||||
Q_PROPERTY(bool geometryLocked READ isGeometryLocked WRITE setGeometryLocked)
|
||||
|
||||
friend class ReportRender;
|
||||
public:
|
||||
@ -305,8 +305,8 @@ public:
|
||||
void setFillTransparentInDesignMode(bool fillTransparentInDesignMode);
|
||||
void emitPosChanged(QPointF oldPos, QPointF newPos);
|
||||
|
||||
bool isItemGeometryLocked() const;
|
||||
void setItemGeometryLocked(bool itemLocked);
|
||||
bool isGeometryLocked() const;
|
||||
void setGeometryLocked(bool itemLocked);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -1464,7 +1464,7 @@ void PageDesignIntf::alignToLeft()
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem) {
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint(m_firstSelectedItem->pos().x(), item->pos().y()));
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
@ -1481,7 +1481,7 @@ void PageDesignIntf::alignToRigth()
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem) {
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint(m_firstSelectedItem->geometry().right() - bdItem->width(), bdItem->pos().y()));
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
@ -1498,7 +1498,7 @@ void PageDesignIntf::alignToVCenter()
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem) {
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint((m_firstSelectedItem->geometry().right() - m_firstSelectedItem->width() / 2) - bdItem->width() / 2, bdItem->pos().y()));
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
@ -1515,7 +1515,7 @@ void PageDesignIntf::alignToTop()
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem) {
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint(bdItem->pos().x(), m_firstSelectedItem->pos().y()));
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
@ -1532,7 +1532,7 @@ void PageDesignIntf::alignToBottom()
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem) {
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint(bdItem->pos().x(), m_firstSelectedItem->geometry().bottom() - bdItem->height()));
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
@ -1549,7 +1549,7 @@ void PageDesignIntf::alignToHCenter()
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem) {
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint(bdItem->pos().x(), (m_firstSelectedItem->geometry().bottom() - m_firstSelectedItem->height() / 2) - bdItem->height() / 2));
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
@ -1566,7 +1566,7 @@ void PageDesignIntf::sameWidth()
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem) {
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setWidth(m_firstSelectedItem->width());
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
@ -1583,7 +1583,7 @@ void PageDesignIntf::sameHeight()
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem) {
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setHeight(m_firstSelectedItem->height());
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
|
Loading…
Reference in New Issue
Block a user