Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added limereport/images/toBottomOf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added limereport/images/toLeftOf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added limereport/images/toRightOf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added limereport/images/toTopOf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions limereport/items/editors/lritemsaligneditorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,38 @@ void ItemsAlignmentEditorWidget::slotAlignToHCenter()
m_page->alignToHCenter();
}

void ItemsAlignmentEditorWidget::slotAlignToTopOf()
{
if (m_reportEditor)
m_reportEditor->alignToTopOf();
if (m_page)
m_page->alignToTopOf();
}

void ItemsAlignmentEditorWidget::slotAlignToBottomOf()
{
if (m_reportEditor)
m_reportEditor->alignToBottomOf();
if (m_page)
m_page->alignToBottomOf();
}

void ItemsAlignmentEditorWidget::slotAlignToLeftOf()
{
if (m_reportEditor)
m_reportEditor->alignToLeftOf();
if (m_page)
m_page->alignToLeftOf();
}

void ItemsAlignmentEditorWidget::slotAlignToRightOf()
{
if (m_reportEditor)
m_reportEditor->alignToRightOf();
if (m_page)
m_page->alignToRigthOf();
}

void ItemsAlignmentEditorWidget::slotSameHeight()
{
if (m_reportEditor)
Expand Down Expand Up @@ -188,6 +220,26 @@ void ItemsAlignmentEditorWidget::initEditor()
connect(m_alignToHCenter, SIGNAL(triggered()), this, SLOT(slotAlignToHCenter()));
addAction(m_alignToHCenter);

m_alignToLeftOf = new QAction(tr("Align to left of"), this);
m_alignToLeftOf->setIcon(QIcon(":/report/images/alignToLeftOf"));
connect(m_alignToLeftOf, SIGNAL(triggered()), this, SLOT(slotAlignToLeftOf()));
addAction(m_alignToLeftOf);

m_alignToRightOf = new QAction(tr("Align to right of"), this);
m_alignToRightOf->setIcon(QIcon(":/report/images/alignToRightOf"));
connect(m_alignToRightOf, SIGNAL(triggered()), this, SLOT(slotAlignToRightOf()));
addAction(m_alignToRightOf);

m_alignToTopOf = new QAction(tr("Align to top of"), this);
m_alignToTopOf->setIcon(QIcon(":/report/images/alignToTopOf"));
connect(m_alignToTopOf, SIGNAL(triggered()), this, SLOT(slotAlignToTopOf()));
addAction(m_alignToTopOf);

m_alignToBottomOf = new QAction(tr("Align to bottom of"), this);
m_alignToBottomOf->setIcon(QIcon(":/report/images/alignToBottomOf"));
connect(m_alignToBottomOf, SIGNAL(triggered()), this, SLOT(slotAlignToBottomOf()));
addAction(m_alignToBottomOf);

m_sameHeight = new QAction(tr("Set same height"), this);
m_sameHeight->setIcon(QIcon(":/report/images/sameHeight"));
connect(m_sameHeight, SIGNAL(triggered()), this, SLOT(slotSameHeight()));
Expand All @@ -197,6 +249,8 @@ void ItemsAlignmentEditorWidget::initEditor()
m_sameWidth->setIcon(QIcon(":/report/images/sameWidth"));
connect(m_sameWidth, SIGNAL(triggered()), this, SLOT(slotSameWidth()));
addAction(m_sameWidth);


}

} // namespace LimeReport
9 changes: 9 additions & 0 deletions limereport/items/editors/lritemsaligneditorwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ private slots:
void slotAlignToTop();
void slotAlignToBottom();
void slotAlignToHCenter();
void slotAlignToTopOf();
void slotAlignToBottomOf();
void slotAlignToLeftOf();
void slotAlignToRightOf();
void slotSameHeight();
void slotSameWidth();

Expand All @@ -71,8 +75,13 @@ private slots:
QAction* m_alignToTop;
QAction* m_alignToBottom;
QAction* m_alignToHCenter;
QAction* m_alignToTopOf;
QAction* m_alignToBottomOf;
QAction* m_alignToRightOf;
QAction* m_alignToLeftOf;
QAction* m_sameHeight;
QAction* m_sameWidth;

};

} // namespace LimeReport
Expand Down
93 changes: 93 additions & 0 deletions limereport/lrpagedesignintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,99 @@ void PageDesignIntf::alignToHCenter()
saveCommand(cm, false);
}
}
void PageDesignIntf::alignToLeftOf()
{
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
CommandGroup::Ptr cm = CommandGroup::create();
QPointF previousItemLeftEdge;
foreach (QGraphicsItem* item, selectedItems()) {
BaseDesignIntf* bdItem = dynamic_cast<BaseDesignIntf*>(item);
if (bdItem && !bdItem->isGeometryLocked()) {
QRectF oldGeometry = bdItem->geometry();
if (previousItemLeftEdge.isNull()) {
bdItem->setPos(m_firstSelectedItem->pos().x() - bdItem->width(), bdItem->pos().y());
} else {
bdItem->setPos(previousItemLeftEdge.x() - bdItem->width(), bdItem->pos().y());
}
previousItemLeftEdge = bdItem->pos();
CommandIf::Ptr command = PropertyChangedCommand::create(
this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
cm->addCommand(command, false);
}
}
saveCommand(cm, false);
}
}

void PageDesignIntf::alignToRigthOf()
{
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
CommandGroup::Ptr cm = CommandGroup::create();
QPointF previousItemRightEdge;
foreach (QGraphicsItem* item, selectedItems()) {
BaseDesignIntf* bdItem = dynamic_cast<BaseDesignIntf*>(item);
if (bdItem && !bdItem->isGeometryLocked()) {
QRectF oldGeometry = bdItem->geometry();
if (previousItemRightEdge.isNull()) {
bdItem->setPos(m_firstSelectedItem->pos().x() + bdItem->width(), bdItem->pos().y());
} else {
bdItem->setPos(previousItemRightEdge.x() + bdItem->width(), bdItem->pos().y());
}
previousItemRightEdge = bdItem->pos();
CommandIf::Ptr command = PropertyChangedCommand::create(
this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
cm->addCommand(command, false);
}
}
saveCommand(cm, false);
}
}
void PageDesignIntf::alignToTopOf()
{
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
CommandGroup::Ptr cm = CommandGroup::create();
QPointF previousItemTopEdge;
foreach (QGraphicsItem* item, selectedItems()) {
BaseDesignIntf* bdItem = dynamic_cast<BaseDesignIntf*>(item);
if (bdItem && !bdItem->isGeometryLocked()) {
QRectF oldGeometry = bdItem->geometry();
if (previousItemTopEdge.isNull()) {
bdItem->setPos(bdItem->pos().x(), m_firstSelectedItem->pos().y() + bdItem->height());
} else {
bdItem->setPos(bdItem->pos().x(), previousItemTopEdge.y() + bdItem->height());
}
previousItemTopEdge = bdItem->pos();
CommandIf::Ptr command = PropertyChangedCommand::create(
this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
cm->addCommand(command, false);
}
}
saveCommand(cm, false);
}
}
void PageDesignIntf::alignToBottomOf()
{
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
CommandGroup::Ptr cm = CommandGroup::create();
QPointF previousItemBottomEdge;
foreach (QGraphicsItem* item, selectedItems()) {
BaseDesignIntf* bdItem = dynamic_cast<BaseDesignIntf*>(item);
if (bdItem && !bdItem->isGeometryLocked()) {
QRectF oldGeometry = bdItem->geometry();
if (previousItemBottomEdge.isNull()) {
bdItem->setPos(bdItem->pos().x(), m_firstSelectedItem->pos().y() - bdItem->height());
} else {
bdItem->setPos(bdItem->pos().x(), previousItemBottomEdge.y() - bdItem->height());
}
previousItemBottomEdge = bdItem->pos();
CommandIf::Ptr command = PropertyChangedCommand::create(
this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
cm->addCommand(command, false);
}
}
saveCommand(cm, false);
}
}

void PageDesignIntf::sameWidth()
{
Expand Down
4 changes: 4 additions & 0 deletions limereport/lrpagedesignintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ public slots:
void alignToTop();
void alignToBottom();
void alignToHCenter();
void alignToLeftOf();
void alignToRigthOf();
void alignToTopOf();
void alignToBottomOf();
void sameWidth();
void sameHeight();
void addHLayout();
Expand Down
24 changes: 24 additions & 0 deletions limereport/lrreportdesignwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,30 @@ void ReportDesignWidget::alignToHCenter()
activePage()->alignToHCenter();
}

void ReportDesignWidget::alignToLeftOf()
{
if (activePage())
activePage()->alignToLeftOf();
}

void ReportDesignWidget::alignToRightOf()
{
if (activePage())
activePage()->alignToRigthOf();
}

void ReportDesignWidget::alignToTopOf()
{
if (activePage())
activePage()->alignToTopOf();
}

void ReportDesignWidget::alignToBottomOf()
{
if (activePage())
activePage()->alignToBottomOf();
}

void ReportDesignWidget::sameHeight()
{
if (activePage())
Expand Down
4 changes: 4 additions & 0 deletions limereport/lrreportdesignwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ public slots:
void alignToTop();
void alignToBottom();
void alignToHCenter();
void alignToLeftOf();
void alignToRightOf();
void alignToTopOf();
void alignToBottomOf();
void sameHeight();
void sameWidth();
void editLayoutMode(bool value);
Expand Down
4 changes: 4 additions & 0 deletions limereport/report.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@
<file alias="/images/alignToVCenter">images/toCenter.png</file>
<file alias="/images/alignToLeft">images/toLeft1.png</file>
<file alias="/images/alignToRight">images/toRight.png</file>
<file alias="/images/alignToLeftOf">images/toLeftOf.png</file>
<file alias="/images/alignToRightOf">images/toRightOf.png</file>
<file alias="/images/alignToTopOf">images/toTopOf.png</file>
<file alias="/images/alignToBottomOf">images/toBottomOf.png</file>
<file alias="/images/sameHeight">images/toSameHeight.png</file>
<file alias="/images/sameWidth">images/toSameWidth.png</file>
<file alias="/images/alignToTop">images/toTop.png</file>
Expand Down
Loading