diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index a0ee81f..d712528 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -482,12 +482,7 @@ QSizeF PageDesignIntf::placeSizeOnGrid(QSizeF size){ BaseDesignIntf *PageDesignIntf::addReportItem(const QString &itemType, QPointF pos, QSizeF size) { - BandDesignIntf *band=0; - foreach(QGraphicsItem * item, items(pos)) { - band = dynamic_cast(item); - if (band) break; - } - + BandDesignIntf *band = bandAt(pos); if (band) { BaseDesignIntf *reportItem = addReportItem(itemType, band, band); // QPointF insertPos = band->mapFromScene(pos); @@ -1733,6 +1728,16 @@ QList PageDesignIntf::reportItemsByName(const QString &name){ return result; } +BandDesignIntf *PageDesignIntf::bandAt(QPointF pos) +{ + BandDesignIntf *band=0; + foreach(QGraphicsItem * item, items(pos)) { + band = dynamic_cast(item); + if (band) break; + } + return band; +} + void CommandIf::addCommand(Ptr command, bool execute) { Q_UNUSED(command) diff --git a/limereport/lrpagedesignintf.h b/limereport/lrpagedesignintf.h index 37eb7b1..962b066 100644 --- a/limereport/lrpagedesignintf.h +++ b/limereport/lrpagedesignintf.h @@ -140,6 +140,7 @@ namespace LimeReport { BaseDesignIntf::ItemMode itemMode(){return m_itemMode;} BaseDesignIntf* reportItemByName(const QString& name); QList reportItemsByName(const QString &name); + BandDesignIntf* bandAt(QPointF pos); BaseDesignIntf* addReportItem(const QString& itemType, QPointF pos, QSizeF size); BaseDesignIntf* addReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0); BaseDesignIntf* createReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0);