Finish 1.5.12

This commit is contained in:
Arin Alexander 2019-09-10 22:50:13 +03:00
commit 8b08fca19c
3 changed files with 55 additions and 12 deletions

View File

@ -127,7 +127,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 5
LIMEREPORT_VERSION_RELEASE = 11
LIMEREPORT_VERSION_RELEASE = 12
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -1459,15 +1459,24 @@ void PageDesignIntf::sendToBack()
}
}
bool PageDesignIntf::selectionContainsBand(){
foreach(QGraphicsItem * item,selectedItems()){
BandDesignIntf *band = dynamic_cast<BandDesignIntf *>(item);
if (band) return true;
}
return false;
}
void PageDesignIntf::alignToLeft()
{
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
CommandGroup::Ptr cm = CommandGroup::create();
bool moveInBand = selectionContainsBand();
foreach(QGraphicsItem * item, selectedItems()) {
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
if (bdItem && !bdItem->isGeometryLocked()) {
QRectF oldGeometry = bdItem->geometry();
bdItem->setPos(QPoint(m_firstSelectedItem->pos().x(), item->pos().y()));
bdItem->setPos(QPointF(moveInBand ? 0 : m_firstSelectedItem->pos().x(), item->pos().y()));
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
cm->addCommand(command, false);
}
@ -1480,11 +1489,19 @@ void PageDesignIntf::alignToRigth()
{
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
CommandGroup::Ptr cm = CommandGroup::create();
bool moveInBand = selectionContainsBand();
foreach(QGraphicsItem * item, selectedItems()) {
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
if (bdItem && !bdItem->isGeometryLocked()) {
if (bdItem && !bdItem->isGeometryLocked() && !bdItem->isBand()) {
QRectF oldGeometry = bdItem->geometry();
bdItem->setPos(QPoint(m_firstSelectedItem->geometry().right() - bdItem->width(), bdItem->pos().y()));
if (moveInBand && dynamic_cast<BandDesignIntf*>(bdItem->parent()))
{
bdItem->setPos(QPointF(dynamic_cast<BandDesignIntf*>(bdItem->parent())->geometry().width() - bdItem->width(),
bdItem->pos().y()));
} else {
qreal x = m_firstSelectedItem->geometry().right() - bdItem->width();
bdItem->setPos(QPointF(x+1, bdItem->pos().y()));
}
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
cm->addCommand(command, false);
}
@ -1497,11 +1514,18 @@ void PageDesignIntf::alignToVCenter()
{
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
CommandGroup::Ptr cm = CommandGroup::create();
bool moveInBand = selectionContainsBand();
foreach(QGraphicsItem * item, selectedItems()) {
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
if (bdItem && !bdItem->isGeometryLocked()) {
if (bdItem && !bdItem->isGeometryLocked() && !bdItem->isBand()) {
QRectF oldGeometry = bdItem->geometry();
bdItem->setPos(QPoint((m_firstSelectedItem->geometry().right() - m_firstSelectedItem->width() / 2) - bdItem->width() / 2, bdItem->pos().y()));
if (moveInBand && dynamic_cast<BandDesignIntf*>(bdItem->parent())){
bdItem->setPos(QPointF((dynamic_cast<BandDesignIntf*>(bdItem->parent())->geometry().width() / 2) - bdItem->width() / 2,
bdItem->pos().y()));
} else {
qreal x = (m_firstSelectedItem->geometry().right() - m_firstSelectedItem->width() / 2) - bdItem->width() / 2;
bdItem->setPos(QPointF(x+1, bdItem->pos().y()));
}
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
cm->addCommand(command, false);
}
@ -1514,11 +1538,16 @@ void PageDesignIntf::alignToTop()
{
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
CommandGroup::Ptr cm = CommandGroup::create();
bool moveInBand = selectionContainsBand();
foreach(QGraphicsItem * item, selectedItems()) {
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
if (bdItem && !bdItem->isGeometryLocked()) {
if (bdItem && !bdItem->isGeometryLocked() && !bdItem->isBand()) {
QRectF oldGeometry = bdItem->geometry();
bdItem->setPos(QPoint(bdItem->pos().x(), m_firstSelectedItem->pos().y()));
if (moveInBand){
bdItem->setPos(QPointF(0, m_firstSelectedItem->pos().y()));
} else {
bdItem->setPos(QPointF(bdItem->pos().x(), m_firstSelectedItem->pos().y()));
}
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
cm->addCommand(command, false);
}
@ -1531,11 +1560,17 @@ void PageDesignIntf::alignToBottom()
{
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
CommandGroup::Ptr cm = CommandGroup::create();
bool moveInBand = selectionContainsBand();
foreach(QGraphicsItem * item, selectedItems()) {
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
if (bdItem && !bdItem->isGeometryLocked()) {
if (bdItem && !bdItem->isGeometryLocked() && !bdItem->isBand()) {
QRectF oldGeometry = bdItem->geometry();
bdItem->setPos(QPoint(bdItem->pos().x(), m_firstSelectedItem->geometry().bottom() - bdItem->height()));
if (moveInBand && dynamic_cast<BandDesignIntf*>(bdItem->parent())){
bdItem->setPos(QPointF(bdItem->pos().x(), dynamic_cast<BandDesignIntf*>(bdItem->parent())->height() - bdItem->height()));
} else {
qreal y = m_firstSelectedItem->geometry().bottom() - bdItem->height();
bdItem->setPos(QPointF(bdItem->pos().x(), y+1));
}
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
cm->addCommand(command, false);
}
@ -1548,11 +1583,17 @@ void PageDesignIntf::alignToHCenter()
{
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
CommandGroup::Ptr cm = CommandGroup::create();
bool moveInBand = selectionContainsBand();
foreach(QGraphicsItem * item, selectedItems()) {
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
if (bdItem && !bdItem->isGeometryLocked()) {
if (bdItem && !bdItem->isGeometryLocked() && !bdItem->isBand()) {
QRectF oldGeometry = bdItem->geometry();
bdItem->setPos(QPoint(bdItem->pos().x(), (m_firstSelectedItem->geometry().bottom() - m_firstSelectedItem->height() / 2) - bdItem->height() / 2));
if (moveInBand && dynamic_cast<BandDesignIntf*>(bdItem->parent())){
bdItem->setPos(QPointF(bdItem->pos().x(), (dynamic_cast<BandDesignIntf*>(bdItem->parent())->height() / 2) - bdItem->height() / 2));
} else {
qreal y = (m_firstSelectedItem->geometry().bottom() - m_firstSelectedItem->height() / 2) - bdItem->height() / 2;
bdItem->setPos(QPointF(bdItem->pos().x(), y+1));
}
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
cm->addCommand(command, false);
}

View File

@ -282,6 +282,7 @@ namespace LimeReport {
void changeSelectedGroupProperty(const QString& name,const QVariant& value);
void activateItemToJoin(QRectF itemRect, QList<ItemProjections>& items);
void selectAllChildren(BaseDesignIntf* item);
bool selectionContainsBand();
private:
enum JoinType{Width, Height};
LimeReport::PageItemDesignIntf::Ptr m_pageItem;
@ -322,6 +323,7 @@ namespace LimeReport {
bool m_magneticMovement;
ReportSettings* m_reportSettings;
PageItemDesignIntf* m_currentPage;
};
class AbstractPageCommand : public CommandIf{