31 QSet<QgsComposerItem*>::iterator itemIt =
mItems.begin();
32 for ( ; itemIt !=
mItems.end(); ++itemIt )
37 ( *itemIt )->setFlag( QGraphicsItem::ItemIsSelectable,
true );
49 if (
mItems.contains( item ) )
55 item->setFlag( QGraphicsItem::ItemIsSelectable,
false );
58 double minXItem = item->transform().dx();
59 double minYItem = item->transform().dy();
60 double maxXItem = minXItem + item->rect().width();
61 double maxYItem = minYItem + item->rect().height();
97 QSet<QgsComposerItem*>::iterator item_it =
mItems.begin();
98 for ( ; item_it !=
mItems.end(); ++item_it )
100 ( *item_it )->setFlag( QGraphicsItem::ItemIsSelectable,
true );
101 ( *item_it )->setSelected(
true );
119 double xLeftCurrent = transform().dx();
120 double xRightCurrent = xLeftCurrent + rect().width();
121 double yTopCurrent = transform().dy();
122 double yBottomCurrent = yTopCurrent + rect().height();
124 double xItemLeft, xItemRight, yItemTop, yItemBottom;
125 double xItemLeftNew, xItemRightNew, yItemTopNew, yItemBottomNew;
126 double xParamLeft, xParamRight, yParamTop, yParamBottom;
129 QSet<QgsComposerItem*>::iterator item_it =
mItems.begin();
130 for ( ; item_it !=
mItems.end(); ++item_it )
132 xItemLeft = ( *item_it )->transform().dx();
133 xItemRight = xItemLeft + ( *item_it )->rect().width();
134 yItemTop = ( *item_it )->transform().dy();
135 yItemBottom = yItemTop + ( *item_it )->rect().height();
137 xParamLeft = ( xItemLeft - xLeftCurrent ) / ( xRightCurrent - xLeftCurrent );
138 xParamRight = ( xItemRight - xLeftCurrent ) / ( xRightCurrent - xLeftCurrent );
139 yParamTop = ( yItemTop - yTopCurrent ) / ( yBottomCurrent - yTopCurrent );
140 yParamBottom = ( yItemBottom - yTopCurrent ) / ( yBottomCurrent - yTopCurrent );
142 xItemLeftNew = xParamLeft * rectangle.right() + ( 1 - xParamLeft ) * rectangle.left();
143 xItemRightNew = xParamRight * rectangle.right() + ( 1 - xParamRight ) * rectangle.left();
144 yItemTopNew = yParamTop * rectangle.bottom() + ( 1 - yParamTop ) * rectangle.top();
145 yItemBottomNew = yParamBottom * rectangle.bottom() + ( 1 - yParamBottom ) * rectangle.top();
147 ( *item_it )->setSceneRect( QRectF( xItemLeftNew, yItemTopNew, xItemRightNew - xItemLeftNew, yItemBottomNew - yItemTopNew ) );
161 QPen newPen( pen() );
162 newPen.setStyle( Qt::DashLine );
163 newPen.setColor( QColor( 128, 128, 128, 128 ) );
165 p->setRenderHint( QPainter::Antialiasing,
true );
166 p->drawRect( QRectF( 0, 0, rect().width(), rect().height() ) );