mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54:39 +03:00
Merge branch 'develop' into feature/TOC-Refactoring
# Conflicts: # limereport/lrpagedesignintf.h
This commit is contained in:
commit
f8fea667bd
@ -120,7 +120,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
|
|||||||
|
|
||||||
LIMEREPORT_VERSION_MAJOR = 1
|
LIMEREPORT_VERSION_MAJOR = 1
|
||||||
LIMEREPORT_VERSION_MINOR = 4
|
LIMEREPORT_VERSION_MINOR = 4
|
||||||
LIMEREPORT_VERSION_RELEASE = 113
|
LIMEREPORT_VERSION_RELEASE = 121
|
||||||
|
|
||||||
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}\\\"
|
||||||
|
@ -38,9 +38,9 @@ contains(CONFIG,zint){
|
|||||||
INCLUDEPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt
|
INCLUDEPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt
|
||||||
DEPENDPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt
|
DEPENDPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt
|
||||||
LIBS += -L$${DEST_LIBS}
|
LIBS += -L$${DEST_LIBS}
|
||||||
contains(CONFIG,release) {
|
CONFIG(debug, debug|release){
|
||||||
LIBS += -lQtZint
|
|
||||||
} else {
|
|
||||||
LIBS += -lQtZintd
|
LIBS += -lQtZintd
|
||||||
|
} else {
|
||||||
|
LIBS += -lQtZint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,22 +116,32 @@ bool AbstractLayout::isEmpty() const
|
|||||||
return (isEmpty && allItemsIsText);
|
return (isEmpty && allItemsIsText);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractLayout::paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
void AbstractLayout::paintChild(BaseDesignIntf *child, QPointF parentPos, QPainter *painter)
|
||||||
{
|
{
|
||||||
if (isSelected()){
|
if (!child->childBaseItems().isEmpty()){
|
||||||
foreach( BaseDesignIntf* item, m_children){
|
foreach (BaseDesignIntf* item, child->childBaseItems()) {
|
||||||
ppainter->save();
|
paintChild(item, child->pos(),painter);
|
||||||
ppainter->setPen(Qt::red);
|
}
|
||||||
ppainter->drawRect(
|
}
|
||||||
QRectF(item->pos().x(),item->pos().y(),
|
painter->drawRect(
|
||||||
item->rect().bottomRight().rx(),
|
QRectF(parentPos.x()+child->pos().x(), parentPos.y()+child->pos().y(),
|
||||||
item->rect().bottomRight().ry()
|
child->rect().bottomRight().rx(),
|
||||||
|
child->rect().bottomRight().ry()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ppainter->restore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractLayout::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
||||||
|
{
|
||||||
|
if (isSelected()){
|
||||||
|
painter->save();
|
||||||
|
painter->setPen(Qt::red);
|
||||||
|
foreach( BaseDesignIntf* item, m_children){
|
||||||
|
paintChild(item, QPointF(0,0), painter);
|
||||||
}
|
}
|
||||||
LayoutDesignIntf::paint(ppainter, option, widget);
|
painter->restore();
|
||||||
|
}
|
||||||
|
LayoutDesignIntf::paint(painter, option, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AbstractLayout::childrenCount()
|
int AbstractLayout::childrenCount()
|
||||||
|
@ -24,7 +24,8 @@ public:
|
|||||||
void addChild(BaseDesignIntf *item,bool updateSize=true);
|
void addChild(BaseDesignIntf *item,bool updateSize=true);
|
||||||
void restoreChild(BaseDesignIntf *item);
|
void restoreChild(BaseDesignIntf *item);
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
void paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
void paintChild(BaseDesignIntf* child, QPointF parentPos, QPainter* painter);
|
||||||
|
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
||||||
|
|
||||||
bool hideEmptyItems() const;
|
bool hideEmptyItems() const;
|
||||||
void setHideEmptyItems(bool hideEmptyItems);
|
void setHideEmptyItems(bool hideEmptyItems);
|
||||||
|
@ -127,6 +127,7 @@ void TextItem::processPopUpAction(QAction *action)
|
|||||||
if (action->text().compare(tr("Edit")) == 0){
|
if (action->text().compare(tr("Edit")) == 0){
|
||||||
this->showEditorDialog();
|
this->showEditorDialog();
|
||||||
}
|
}
|
||||||
|
if (page()){
|
||||||
if (action->text().compare(tr("Auto height")) == 0){
|
if (action->text().compare(tr("Auto height")) == 0){
|
||||||
page()->setPropertyToSelectedItems("autoHeight",action->isChecked());
|
page()->setPropertyToSelectedItems("autoHeight",action->isChecked());
|
||||||
}
|
}
|
||||||
@ -139,6 +140,7 @@ void TextItem::processPopUpAction(QAction *action)
|
|||||||
if (action->text().compare(tr("Stretch to max height")) == 0){
|
if (action->text().compare(tr("Stretch to max height")) == 0){
|
||||||
page()->setPropertyToSelectedItems("stretchToMaxHeight",action->isChecked());
|
page()->setPropertyToSelectedItems("stretchToMaxHeight",action->isChecked());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (action->text().compare(tr("Transparent")) == 0){
|
if (action->text().compare(tr("Transparent")) == 0){
|
||||||
if (action->isChecked()){
|
if (action->isChecked()){
|
||||||
setProperty("backgroundMode",TransparentMode);
|
setProperty("backgroundMode",TransparentMode);
|
||||||
|
@ -556,12 +556,14 @@ void BaseDesignIntf::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
|
|
||||||
setItemPos(QPointF(div(m_startPos.x(), hStep).quot * hStep, div(m_startPos.y(), vStep).quot * vStep) - delta);
|
setItemPos(QPointF(div(m_startPos.x(), hStep).quot * hStep, div(m_startPos.y(), vStep).quot * vStep) - delta);
|
||||||
|
|
||||||
if (!isBand() && scene()->selectedItems().count()>1)
|
if (page()){
|
||||||
|
if (!isBand() && page()->selectedItems().count()>1)
|
||||||
moveSelectedItems(tmpPos - pos());
|
moveSelectedItems(tmpPos - pos());
|
||||||
if (scene()->selectedItems().count()==1 && (page()->magneticMovement()))
|
if (page()->selectedItems().count()==1 && (page()->magneticMovement()))
|
||||||
page()->itemMoved(this);
|
page()->itemMoved(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int BaseDesignIntf::possibleResizeDirectionFlags() const
|
int BaseDesignIntf::possibleResizeDirectionFlags() const
|
||||||
{
|
{
|
||||||
@ -843,29 +845,29 @@ void BaseDesignIntf::setBorderLineSize(int value)
|
|||||||
|
|
||||||
void BaseDesignIntf::moveRight()
|
void BaseDesignIntf::moveRight()
|
||||||
{
|
{
|
||||||
if (!m_fixedPos) setItemPos(pos().x() + page()->horizontalGridStep(), pos().y());
|
if (!m_fixedPos && page()) setItemPos(pos().x() + page()->horizontalGridStep(), pos().y());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::moveLeft()
|
void BaseDesignIntf::moveLeft()
|
||||||
{
|
{
|
||||||
if (!m_fixedPos) setItemPos(pos().x() - page()->horizontalGridStep(), pos().y());
|
if (!m_fixedPos && page()) setItemPos(pos().x() - page()->horizontalGridStep(), pos().y());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::moveDown()
|
void BaseDesignIntf::moveDown()
|
||||||
{
|
{
|
||||||
if (!m_fixedPos) setItemPos(pos().x(), pos().y() + page()->verticalGridStep());
|
if (!m_fixedPos && page()) setItemPos(pos().x(), pos().y() + page()->verticalGridStep());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::moveUp()
|
void BaseDesignIntf::moveUp()
|
||||||
{
|
{
|
||||||
if (!m_fixedPos) setItemPos(pos().x(), pos().y() - page()->verticalGridStep());
|
if (!m_fixedPos && page()) setItemPos(pos().x(), pos().y() - page()->verticalGridStep());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::sizeRight()
|
void BaseDesignIntf::sizeRight()
|
||||||
{
|
{
|
||||||
if ((m_possibleResizeDirectionFlags & ResizeLeft) ||
|
if ((m_possibleResizeDirectionFlags & ResizeLeft) ||
|
||||||
(m_possibleResizeDirectionFlags & ResizeRight)) {
|
(m_possibleResizeDirectionFlags & ResizeRight)) {
|
||||||
setWidth(width() + page()->horizontalGridStep());
|
if (page()) setWidth(width() + page()->horizontalGridStep());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -873,7 +875,7 @@ void BaseDesignIntf::sizeLeft()
|
|||||||
{
|
{
|
||||||
if ((m_possibleResizeDirectionFlags & ResizeLeft) ||
|
if ((m_possibleResizeDirectionFlags & ResizeLeft) ||
|
||||||
(m_possibleResizeDirectionFlags & ResizeRight)) {
|
(m_possibleResizeDirectionFlags & ResizeRight)) {
|
||||||
setWidth(width() - page()->horizontalGridStep());
|
if(page()) setWidth(width() - page()->horizontalGridStep());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -881,7 +883,7 @@ void BaseDesignIntf::sizeUp()
|
|||||||
{
|
{
|
||||||
if ((m_possibleResizeDirectionFlags & ResizeTop) ||
|
if ((m_possibleResizeDirectionFlags & ResizeTop) ||
|
||||||
(m_possibleResizeDirectionFlags & ResizeBottom)) {
|
(m_possibleResizeDirectionFlags & ResizeBottom)) {
|
||||||
setHeight(height() - page()->verticalGridStep());
|
if (page()) setHeight(height() - page()->verticalGridStep());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -889,7 +891,7 @@ void BaseDesignIntf::sizeDown()
|
|||||||
{
|
{
|
||||||
if ((m_possibleResizeDirectionFlags & ResizeTop) ||
|
if ((m_possibleResizeDirectionFlags & ResizeTop) ||
|
||||||
(m_possibleResizeDirectionFlags & ResizeBottom)) {
|
(m_possibleResizeDirectionFlags & ResizeBottom)) {
|
||||||
setHeight(height() + page()->verticalGridStep());
|
if (page()) setHeight(height() + page()->verticalGridStep());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1061,6 +1063,7 @@ QVariant BaseDesignIntf::itemChange(QGraphicsItem::GraphicsItemChange change, co
|
|||||||
if (change == QGraphicsItem::ItemPositionHasChanged) {
|
if (change == QGraphicsItem::ItemPositionHasChanged) {
|
||||||
updateSelectionMarker();
|
updateSelectionMarker();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (change == QGraphicsItem::ItemSelectedChange) {
|
if (change == QGraphicsItem::ItemSelectedChange) {
|
||||||
turnOnSelectionMarker(value.toBool());
|
turnOnSelectionMarker(value.toBool());
|
||||||
emit itemSelectedHasBeenChanged(this, value.toBool());
|
emit itemSelectedHasBeenChanged(this, value.toBool());
|
||||||
@ -1155,18 +1158,18 @@ void BaseDesignIntf::setItemPos(const QPointF &newPos)
|
|||||||
QPointF oldPos = pos();
|
QPointF oldPos = pos();
|
||||||
QPointF finalPos = modifyPosForAlignedItem(newPos);
|
QPointF finalPos = modifyPosForAlignedItem(newPos);
|
||||||
QGraphicsItem::setPos(finalPos);
|
QGraphicsItem::setPos(finalPos);
|
||||||
emit posChanged(this, finalPos, oldPos);
|
emit posChanging(this, finalPos, oldPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
|
||||||
QRectF newGeometry = geometry();
|
QRectF newGeometry = geometry();
|
||||||
if (newGeometry != m_oldGeometry) {
|
if (newGeometry != m_oldGeometry) {
|
||||||
geometryChangedEvent(newGeometry, m_oldGeometry);
|
geometryChangedEvent(newGeometry, m_oldGeometry);
|
||||||
updateSelectionMarker();
|
updateSelectionMarker();
|
||||||
emit(geometryChanged(this, newGeometry, m_oldGeometry));
|
emit(posChanged(this, newGeometry.topLeft(), m_oldGeometry.topLeft()));
|
||||||
}
|
}
|
||||||
|
QGraphicsItem::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* findRootWidget(QWidget* widget){
|
QWidget* findRootWidget(QWidget* widget){
|
||||||
@ -1390,7 +1393,7 @@ void BaseDesignIntf::collectionLoadFinished(const QString &collectionName)
|
|||||||
foreach(QObject * obj, QObject::children()) {
|
foreach(QObject * obj, QObject::children()) {
|
||||||
#endif
|
#endif
|
||||||
BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(obj);
|
BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(obj);
|
||||||
if (item) {
|
if (item && page()) {
|
||||||
page()->registerItem(item);
|
page()->registerItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,6 +417,7 @@ private:
|
|||||||
|
|
||||||
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 posChanged(QObject* object, QPointF newPos, QPointF oldPos);
|
void posChanged(QObject* object, QPointF newPos, QPointF oldPos);
|
||||||
void itemSelected(LimeReport::BaseDesignIntf *item);
|
void itemSelected(LimeReport::BaseDesignIntf *item);
|
||||||
void itemSelectedHasBeenChanged(BaseDesignIntf *item, bool value);
|
void itemSelectedHasBeenChanged(BaseDesignIntf *item, bool value);
|
||||||
@ -428,7 +429,6 @@ signals:
|
|||||||
void propertyesChanged(QVector<QString> propertyNames);
|
void propertyesChanged(QVector<QString> propertyNames);
|
||||||
void itemAlignChanged(BaseDesignIntf* item, const ItemAlign& oldValue, const ItemAlign& newValue);
|
void itemAlignChanged(BaseDesignIntf* item, const ItemAlign& oldValue, const ItemAlign& newValue);
|
||||||
void itemVisibleHasChanged(BaseDesignIntf* item);
|
void itemVisibleHasChanged(BaseDesignIntf* item);
|
||||||
|
|
||||||
void beforeRender();
|
void beforeRender();
|
||||||
void afterData();
|
void afterData();
|
||||||
void afterRender();
|
void afterRender();
|
||||||
|
@ -68,8 +68,6 @@ bool bandSortBandLessThen(const BandDesignIntf *c1, const BandDesignIntf *c2)
|
|||||||
|
|
||||||
PageDesignIntf::PageDesignIntf(QObject *parent):
|
PageDesignIntf::PageDesignIntf(QObject *parent):
|
||||||
QGraphicsScene(parent),
|
QGraphicsScene(parent),
|
||||||
m_pageSize(A4),
|
|
||||||
m_orientation(Portrait),
|
|
||||||
m_pageItem(0),
|
m_pageItem(0),
|
||||||
m_insertMode(false),
|
m_insertMode(false),
|
||||||
m_itemInsertRect(0),
|
m_itemInsertRect(0),
|
||||||
@ -85,8 +83,6 @@ PageDesignIntf::PageDesignIntf(QObject *parent):
|
|||||||
m_executingGroupCommand(false),
|
m_executingGroupCommand(false),
|
||||||
m_settings(0),
|
m_settings(0),
|
||||||
m_selectionRect(0),
|
m_selectionRect(0),
|
||||||
//m_verticalGridStep(1*Const::mmFACTOR),
|
|
||||||
//m_horizontalGridStep(1*Const::mmFACTOR)
|
|
||||||
m_verticalGridStep(2),
|
m_verticalGridStep(2),
|
||||||
m_horizontalGridStep(2),
|
m_horizontalGridStep(2),
|
||||||
m_updating(false),
|
m_updating(false),
|
||||||
@ -135,22 +131,22 @@ void PageDesignIntf::updatePageRect()
|
|||||||
emit sceneRectChanged(sceneRect());
|
emit sceneRectChanged(sceneRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
PageDesignIntf::Orientation PageDesignIntf::getOrientation()
|
//PageDesignIntf::Orientation PageDesignIntf::getOrientation()
|
||||||
{
|
//{
|
||||||
return m_orientation;
|
// return m_orientation;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void PageDesignIntf::setPageSize(PageDesignIntf::PageSize sizeType, QSizeF sizeValue)
|
//void PageDesignIntf::setPageSize(PageDesignIntf::PageSize sizeType, QSizeF sizeValue)
|
||||||
{
|
//{
|
||||||
m_pageSize = sizeType;
|
// m_pageSize = sizeType;
|
||||||
m_pageSizeValue = sizeValue;
|
// m_pageSizeValue = sizeValue;
|
||||||
updatePageRect();
|
// updatePageRect();
|
||||||
}
|
//}
|
||||||
|
|
||||||
PageDesignIntf::PageSize PageDesignIntf::pageSize() const
|
//PageDesignIntf::PageSize PageDesignIntf::pageSize() const
|
||||||
{
|
//{
|
||||||
return m_pageSize;
|
// return m_pageSize;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void PageDesignIntf::keyPressEvent(QKeyEvent *event)
|
void PageDesignIntf::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
@ -668,22 +664,22 @@ bool PageDesignIntf::isExistsObjectName(const QString &objectName, QList<QGraphi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF PageDesignIntf::getRectByPageSize(PageDesignIntf::PageSize pageSize)
|
//QRectF PageDesignIntf::getRectByPageSize(PageDesignIntf::PageSize pageSize)
|
||||||
{
|
//{
|
||||||
if (m_pageSize != Custom) {
|
// if (m_pageSize != PageSize::Custom) {
|
||||||
QPrinter printer;
|
// QPrinter printer;
|
||||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
// printer.setOutputFormat(QPrinter::PdfFormat);
|
||||||
printer.setOrientation((QPrinter::Orientation)getOrientation());
|
// printer.setOrientation((QPrinter::Orientation)getOrientation());
|
||||||
printer.setPageSize((QPrinter::PageSize)pageSize);
|
// printer.setPageSize((QPrinter::PageSize)pageSize);
|
||||||
return QRectF(0, 0, printer.paperRect(QPrinter::Millimeter).width() * 10,
|
// return QRectF(0, 0, printer.paperRect(QPrinter::Millimeter).width() * 10,
|
||||||
printer.paperSize(QPrinter::Millimeter).height() * 10);
|
// printer.paperSize(QPrinter::Millimeter).height() * 10);
|
||||||
}
|
// }
|
||||||
|
|
||||||
else {
|
// else {
|
||||||
return QRectF(0, 0, m_pageSizeValue.width() * 10,
|
// return QRectF(0, 0, m_pageSizeValue.width() * 10,
|
||||||
m_pageSizeValue.height() * 10);
|
// m_pageSizeValue.height() * 10);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
bool PageDesignIntf::isLoading()
|
bool PageDesignIntf::isLoading()
|
||||||
{
|
{
|
||||||
@ -2200,6 +2196,7 @@ void InsertHLayoutCommand::undoIt()
|
|||||||
bi->setPos(m_elements.value(bi->objectName()));
|
bi->setPos(m_elements.value(bi->objectName()));
|
||||||
bi->setFixedPos(false);
|
bi->setFixedPos(false);
|
||||||
bi->setPossibleResizeDirectionFlags(BaseDesignIntf::AllDirections);
|
bi->setPossibleResizeDirectionFlags(BaseDesignIntf::AllDirections);
|
||||||
|
bi->setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
page()->removeReportItem(layout,false);
|
page()->removeReportItem(layout,false);
|
||||||
@ -2384,6 +2381,7 @@ void InsertVLayoutCommand::undoIt()
|
|||||||
bi->setPos(m_elements.value(bi->objectName()));
|
bi->setPos(m_elements.value(bi->objectName()));
|
||||||
bi->setFixedPos(false);
|
bi->setFixedPos(false);
|
||||||
bi->setPossibleResizeDirectionFlags(BaseDesignIntf::AllDirections);
|
bi->setPossibleResizeDirectionFlags(BaseDesignIntf::AllDirections);
|
||||||
|
bi->setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
page()->removeReportItem(layout,false);
|
page()->removeReportItem(layout,false);
|
||||||
|
@ -104,21 +104,9 @@ namespace LimeReport {
|
|||||||
friend class PropertyChangedCommand;
|
friend class PropertyChangedCommand;
|
||||||
friend class InsertHLayoutCommand;
|
friend class InsertHLayoutCommand;
|
||||||
friend class InsertVLayoutCommand;
|
friend class InsertVLayoutCommand;
|
||||||
enum Orientation {Portrait, Landscape};
|
|
||||||
enum PageSize {A4, B5, Letter, Legal, Executive,
|
|
||||||
A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1,
|
|
||||||
B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E,
|
|
||||||
DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit PageDesignIntf(QObject* parent = 0);
|
explicit PageDesignIntf(QObject* parent = 0);
|
||||||
~PageDesignIntf();
|
~PageDesignIntf();
|
||||||
void updatePageRect();
|
void updatePageRect();
|
||||||
Orientation getOrientation();
|
|
||||||
|
|
||||||
void setPageSize(PageSize sizeType, QSizeF sizeValue=QSizeF());
|
|
||||||
PageSize pageSize() const;
|
|
||||||
|
|
||||||
void startInsertMode(const QString& ItemType);
|
void startInsertMode(const QString& ItemType);
|
||||||
void startEditMode();
|
void startEditMode();
|
||||||
|
|
||||||
@ -204,7 +192,6 @@ namespace LimeReport {
|
|||||||
BaseDesignIntf *findDestObject(BaseDesignIntf *item);
|
BaseDesignIntf *findDestObject(BaseDesignIntf *item);
|
||||||
|
|
||||||
bool isExistsObjectName (const QString& objectName, QList<QGraphicsItem *> &itemsList) const;
|
bool isExistsObjectName (const QString& objectName, QList<QGraphicsItem *> &itemsList) const;
|
||||||
QRectF getRectByPageSize(PageSize pageSize);
|
|
||||||
|
|
||||||
bool isLoading();
|
bool isLoading();
|
||||||
void objectLoadStarted();
|
void objectLoadStarted();
|
||||||
@ -263,7 +250,9 @@ namespace LimeReport {
|
|||||||
void setBorders(const BaseDesignIntf::BorderLines& border);
|
void setBorders(const BaseDesignIntf::BorderLines& border);
|
||||||
private slots:
|
private slots:
|
||||||
void slotPageGeometryChanged(QObject*, QRectF, QRectF );
|
void slotPageGeometryChanged(QObject*, QRectF, QRectF );
|
||||||
void slotItemPropertyChanged(QString propertyName, const QVariant &oldValue, const QVariant &newValue);
|
void slotItemPropertyChanged(QString propertyName,
|
||||||
|
const QVariant &oldValue,
|
||||||
|
const QVariant &newValue);
|
||||||
void slotItemPropertyObjectNameChanged(const QString& oldName, const QString& newName);
|
void slotItemPropertyObjectNameChanged(const QString& oldName, const QString& newName);
|
||||||
void bandDeleted(QObject* band);
|
void bandDeleted(QObject* band);
|
||||||
void slotPageItemLoaded(QObject *);
|
void slotPageItemLoaded(QObject *);
|
||||||
@ -278,17 +267,14 @@ namespace LimeReport {
|
|||||||
void checkSizeOrPosChanges();
|
void checkSizeOrPosChanges();
|
||||||
CommandIf::Ptr createChangePosCommand();
|
CommandIf::Ptr createChangePosCommand();
|
||||||
CommandIf::Ptr createChangeSizeCommand();
|
CommandIf::Ptr createChangeSizeCommand();
|
||||||
void saveChangeProppertyCommand(const QString& objectName, const QString& propertyName,
|
void saveChangeProppertyCommand(const QString& objectName,
|
||||||
|
const QString& propertyName,
|
||||||
const QVariant& oldPropertyValue,
|
const QVariant& oldPropertyValue,
|
||||||
const QVariant& newPropertyValue);
|
const QVariant& newPropertyValue);
|
||||||
void changeSelectedGroupProperty(const QString& name,const QVariant& value);
|
void changeSelectedGroupProperty(const QString& name,const QVariant& value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum JoinType{Width, Height};
|
enum JoinType{Width, Height};
|
||||||
PageSize m_pageSize;
|
|
||||||
QSizeF m_pageSizeValue;
|
|
||||||
Orientation m_orientation;
|
|
||||||
QRectF m_geometry;
|
|
||||||
LimeReport::PageItemDesignIntf::Ptr m_pageItem;
|
LimeReport::PageItemDesignIntf::Ptr m_pageItem;
|
||||||
QList<PageItemDesignIntf::Ptr> m_reportPages;
|
QList<PageItemDesignIntf::Ptr> m_reportPages;
|
||||||
ReportEnginePrivate* m_reportEditor;
|
ReportEnginePrivate* m_reportEditor;
|
||||||
|
@ -327,7 +327,7 @@ void PageItemDesignIntf::registerBand(BandDesignIntf *band)
|
|||||||
band->setParentItem(this);
|
band->setParentItem(this);
|
||||||
band->setWidth(pageRect().width()/band->columnsCount());
|
band->setWidth(pageRect().width()/band->columnsCount());
|
||||||
connect(band, SIGNAL(destroyed(QObject*)),this,SLOT(bandDeleted(QObject*)));
|
connect(band, SIGNAL(destroyed(QObject*)),this,SLOT(bandDeleted(QObject*)));
|
||||||
connect(band, SIGNAL(geometryChanged(QObject*,QRectF,QRectF)),this,SLOT(bandGeometryChanged(QObject*,QRectF,QRectF)));
|
connect(band, SIGNAL(posChanged(QObject*,QPointF,QPointF)),this,SLOT(bandPositionChanged(QObject*,QPointF,QPointF)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,16 +798,17 @@ void PageItemDesignIntf::moveBandFromTo(int from, int to)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry)
|
void PageItemDesignIntf::bandPositionChanged(QObject* object, QPointF newPos, QPointF oldPos)
|
||||||
{
|
{
|
||||||
|
if (itemMode() == DesignMode){
|
||||||
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(object);
|
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(object);
|
||||||
int curIndex = band->bandIndex();
|
int curIndex = band->bandIndex();
|
||||||
BandDesignIntf* bandToSwap = 0;
|
BandDesignIntf* bandToSwap = 0;
|
||||||
foreach(BandDesignIntf* curBand, bands()){
|
foreach(BandDesignIntf* curBand, bands()){
|
||||||
if (newGeometry.y() > oldGeometry.y()) {
|
if (newPos.y() > oldPos.y()) {
|
||||||
if (curBand->bandType() == band->bandType()
|
if (curBand->bandType() == band->bandType()
|
||||||
&& curIndex < curBand->bandIndex()
|
&& curIndex < curBand->bandIndex()
|
||||||
&& (curBand->pos().y() + (curBand->height()/2)) < newGeometry.y()
|
&& (curBand->pos().y() + (curBand->height()/2)) < newPos.y()
|
||||||
&& curBand->parentBand() == band->parentBand())
|
&& curBand->parentBand() == band->parentBand())
|
||||||
{
|
{
|
||||||
curIndex = curBand->bandIndex();
|
curIndex = curBand->bandIndex();
|
||||||
@ -816,7 +817,7 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry
|
|||||||
} else {
|
} else {
|
||||||
if (curBand->bandType() == band->bandType()
|
if (curBand->bandType() == band->bandType()
|
||||||
&& curIndex>curBand->bandIndex()
|
&& curIndex>curBand->bandIndex()
|
||||||
&& (curBand->pos().y() + (curBand->height()/2)) > newGeometry.y()
|
&& (curBand->pos().y() + (curBand->height()/2)) > newPos.y()
|
||||||
&& curBand->parentBand() == band->parentBand())
|
&& curBand->parentBand() == band->parentBand())
|
||||||
{
|
{
|
||||||
curIndex = curBand->bandIndex();
|
curIndex = curBand->bandIndex();
|
||||||
@ -824,11 +825,11 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (curIndex != band->bandIndex()){
|
if (curIndex != band->bandIndex() && itemMode() == DesignMode){
|
||||||
//swapBands(band, bandToSwap);
|
if (page())
|
||||||
//page()->saveCommand(BandSwapCommand::create(page(), band->objectName(), bandToSwap->objectName()), true);
|
|
||||||
page()->saveCommand(BandMoveFromToCommand::create(page(), band->bandIndex(), bandToSwap->bandIndex()), true);
|
page()->saveCommand(BandMoveFromToCommand::create(page(), band->bandIndex(), bandToSwap->bandIndex()), true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
relocateBands();
|
relocateBands();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "lritemscontainerdesignitf.h"
|
#include "lritemscontainerdesignitf.h"
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QPrinter>
|
||||||
|
|
||||||
namespace LimeReport{
|
namespace LimeReport{
|
||||||
|
|
||||||
@ -61,11 +62,18 @@ class PageItemDesignIntf : public LimeReport::ItemsContainerDesignInft
|
|||||||
Q_PROPERTY(bool printable READ isPrintable WRITE setPrintable)
|
Q_PROPERTY(bool printable READ isPrintable WRITE setPrintable)
|
||||||
friend class ReportRender;
|
friend class ReportRender;
|
||||||
public:
|
public:
|
||||||
enum Orientation { Portrait, Landscape };
|
enum Orientation { Portrait = QPrinter::Portrait, Landscape = QPrinter::Landscape };
|
||||||
enum PageSize {A4, B5, Letter, Legal, Executive,
|
enum PageSize {
|
||||||
A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1,
|
A4 = QPrinter::A4, B5 = QPrinter::B5, Letter = QPrinter::Letter,
|
||||||
B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E,
|
Legal = QPrinter::Legal, Executive = QPrinter::Executive,
|
||||||
DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom
|
A0 = QPrinter::A0, A1 = QPrinter::A1, A2 = QPrinter::A2, A3 = QPrinter::A3,
|
||||||
|
A5 = QPrinter::A5, A6 = QPrinter::A6, A7 = QPrinter::A7, A8 = QPrinter::A8,
|
||||||
|
A9 = QPrinter::A9, B0 = QPrinter::B0, B1 = QPrinter::B1, B10 = QPrinter::B10,
|
||||||
|
B2 = QPrinter::B2, B3 = QPrinter::B3, B4 = QPrinter::B4, B6 = QPrinter::B6,
|
||||||
|
B7 = QPrinter::B7, B8 = QPrinter::B8, B9 = QPrinter::B9, C5E = QPrinter::C5E,
|
||||||
|
Comm10E = QPrinter::Comm10E, DLE = QPrinter::DLE, Folio = QPrinter::Folio,
|
||||||
|
Ledger = QPrinter::Ledger, Tabloid = QPrinter::Tabloid, Custom = QPrinter::Custom,
|
||||||
|
NPageSize = Custom
|
||||||
};
|
};
|
||||||
typedef QList<BandDesignIntf*> BandsList;
|
typedef QList<BandDesignIntf*> BandsList;
|
||||||
typedef QList<BandDesignIntf*>::const_iterator BandsIterator;
|
typedef QList<BandDesignIntf*>::const_iterator BandsIterator;
|
||||||
@ -148,7 +156,7 @@ signals:
|
|||||||
void afterLastPageRendered();
|
void afterLastPageRendered();
|
||||||
protected slots:
|
protected slots:
|
||||||
void bandDeleted(QObject* band);
|
void bandDeleted(QObject* band);
|
||||||
void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
void bandPositionChanged(QObject* object, QPointF newPos, QPointF oldPos);
|
||||||
protected:
|
protected:
|
||||||
void collectionLoadFinished(const QString& collectionName);
|
void collectionLoadFinished(const QString& collectionName);
|
||||||
QRectF& pageRect(){return m_pageRect;}
|
QRectF& pageRect(){return m_pageRect;}
|
||||||
|
@ -30,6 +30,7 @@ void ContentEditor::editButtonClicked()
|
|||||||
dialog->setWindowTitle(propertyName());
|
dialog->setWindowTitle(propertyName());
|
||||||
QWidget* editor = dynamic_cast<BaseDesignIntf*>(m_object)->defaultEditor();
|
QWidget* editor = dynamic_cast<BaseDesignIntf*>(m_object)->defaultEditor();
|
||||||
dialog->layout()->addWidget(editor);
|
dialog->layout()->addWidget(editor);
|
||||||
|
dialog->resize(editor->size());
|
||||||
connect(editor,SIGNAL(destroyed()),dialog,SLOT(close()));
|
connect(editor,SIGNAL(destroyed()),dialog,SLOT(close()));
|
||||||
connect(editor,SIGNAL(destroyed()),this,SIGNAL(editingFinished()));
|
connect(editor,SIGNAL(destroyed()),this,SIGNAL(editingFinished()));
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
|
Loading…
Reference in New Issue
Block a user