33 QSet<QgsComposerItem*>::iterator itemIt =
mItems.begin();
34 for ( ; itemIt !=
mItems.end(); ++itemIt )
39 ( *itemIt )->setFlag( QGraphicsItem::ItemIsSelectable,
true );
51 if (
mItems.contains( item ) )
56 connect( item, SIGNAL( destroyed() ),
this, SLOT(
itemDestroyed() ) );
60 item->setFlag( QGraphicsItem::ItemIsSelectable,
false );
63 double minXItem = item->transform().dx();
64 double minYItem = item->transform().dy();
65 double maxXItem = minXItem + item->rect().width();
66 double maxYItem = minYItem + item->rect().height();
100 QSet<QgsComposerItem*>::iterator item_it =
mItems.begin();
101 for ( ; item_it !=
mItems.end(); ++item_it )
103 ( *item_it )->setFlag( QGraphicsItem::ItemIsSelectable,
true );
104 ( *item_it )->setSelected(
true );
111 mItems.remove( static_cast<QgsComposerItem*>( sender() ) );
129 double xLeftCurrent = transform().dx();
130 double xRightCurrent = xLeftCurrent + rect().width();
131 double yTopCurrent = transform().dy();
132 double yBottomCurrent = yTopCurrent + rect().height();
134 double xItemLeft, xItemRight, yItemTop, yItemBottom;
135 double xItemLeftNew, xItemRightNew, yItemTopNew, yItemBottomNew;
136 double xParamLeft, xParamRight, yParamTop, yParamBottom;
139 QSet<QgsComposerItem*>::iterator item_it =
mItems.begin();
140 for ( ; item_it !=
mItems.end(); ++item_it )
142 xItemLeft = ( *item_it )->transform().dx();
143 xItemRight = xItemLeft + ( *item_it )->rect().width();
144 yItemTop = ( *item_it )->transform().dy();
145 yItemBottom = yItemTop + ( *item_it )->rect().height();
147 xParamLeft = ( xItemLeft - xLeftCurrent ) / ( xRightCurrent - xLeftCurrent );
148 xParamRight = ( xItemRight - xLeftCurrent ) / ( xRightCurrent - xLeftCurrent );
149 yParamTop = ( yItemTop - yTopCurrent ) / ( yBottomCurrent - yTopCurrent );
150 yParamBottom = ( yItemBottom - yTopCurrent ) / ( yBottomCurrent - yTopCurrent );
152 xItemLeftNew = xParamLeft * rectangle.right() + ( 1 - xParamLeft ) * rectangle.left();
153 xItemRightNew = xParamRight * rectangle.right() + ( 1 - xParamRight ) * rectangle.left();
154 yItemTopNew = yParamTop * rectangle.bottom() + ( 1 - yParamTop ) * rectangle.top();
155 yItemBottomNew = yParamBottom * rectangle.bottom() + ( 1 - yParamBottom ) * rectangle.top();
157 ( *item_it )->setSceneRect( QRectF( xItemLeftNew, yItemTopNew, xItemRightNew - xItemLeftNew, yItemBottomNew - yItemTopNew ) );
171 QPen newPen( pen() );
172 newPen.setStyle( Qt::DashLine );
173 newPen.setColor( QColor( 128, 128, 128, 128 ) );
175 p->setRenderHint( QPainter::Antialiasing,
true );
176 p->drawRect( QRectF( 0, 0, rect().width(), rect().height() ) );
182 QDomElement group = doc.createElement(
"ComposerItemGroup" );
184 QSet<QgsComposerItem*>::const_iterator itemIt =
mItems.begin();
185 for ( ; itemIt !=
mItems.end(); ++itemIt )
187 QDomElement item = doc.createElement(
"ComposerItemGroupElement" );
188 item.setAttribute(
"uuid", ( *itemIt )->uuid() );
189 group.appendChild( item );
192 elem.appendChild( group );
200 QDomNodeList composerItemList = itemElem.elementsByTagName(
"ComposerItem" );
201 if ( composerItemList.size() > 0 )
203 QDomElement composerItemElem = composerItemList.at( 0 ).toElement();
209 QDomNodeList elementNodes = itemElem.elementsByTagName(
"ComposerItemGroupElement" );
210 for (
int i = 0; i < elementNodes.count(); ++i )
212 QDomNode elementNode = elementNodes.at( i );
213 if ( !elementNode.isElement() )
216 QString
uuid = elementNode.toElement().attribute(
"uuid" );
218 for ( QList<QGraphicsItem *>::iterator it = items.begin(); it != items.end(); ++it )