@ -111,9 +111,15 @@ void UBSelectionFrame::setEnclosedItems(const QList<QGraphicsItem*> pGraphicsIte
QRegion resultRegion ;
QRegion resultRegion ;
UBGraphicsFlags resultFlags ;
UBGraphicsFlags resultFlags ;
mEnclosedtems . clear ( ) ;
mEnclosedtems . clear ( ) ;
// If at least one of the enclosed items is locked, the entire selection is
// considered to be locked.
mIsLocked = false ;
foreach ( QGraphicsItem * nextItem , pGraphicsItems ) {
foreach ( QGraphicsItem * nextItem , pGraphicsItems ) {
UBGraphicsItemDelegate * nextDelegate = UBGraphicsItem : : Delegate ( nextItem ) ;
UBGraphicsItemDelegate * nextDelegate = UBGraphicsItem : : Delegate ( nextItem ) ;
if ( nextDelegate ) {
if ( nextDelegate ) {
mIsLocked = ( mIsLocked | | nextDelegate - > isLocked ( ) ) ;
mEnclosedtems . append ( nextDelegate ) ;
mEnclosedtems . append ( nextDelegate ) ;
resultRegion | = nextItem - > boundingRegion ( nextItem - > sceneTransform ( ) ) ;
resultRegion | = nextItem - > boundingRegion ( nextItem - > sceneTransform ( ) ) ;
resultFlags | = nextDelegate - > ubflags ( ) ;
resultFlags | = nextDelegate - > ubflags ( ) ;
@ -129,6 +135,14 @@ void UBSelectionFrame::setEnclosedItems(const QList<QGraphicsItem*> pGraphicsIte
if ( resultRect . isEmpty ( ) ) {
if ( resultRect . isEmpty ( ) ) {
hide ( ) ;
hide ( ) ;
}
}
if ( mIsLocked ) {
QColor baseColor = UBSettings : : paletteColor ;
baseColor . setAlphaF ( baseColor . alphaF ( ) / 3 ) ;
setLocalBrush ( QBrush ( baseColor ) ) ;
}
else
setLocalBrush ( QBrush ( UBSettings : : paletteColor ) ) ;
}
}
void UBSelectionFrame : : updateRect ( )
void UBSelectionFrame : : updateRect ( )
@ -168,6 +182,9 @@ void UBSelectionFrame::mousePressEvent(QGraphicsSceneMouseEvent *event)
void UBSelectionFrame : : mouseMoveEvent ( QGraphicsSceneMouseEvent * event )
void UBSelectionFrame : : mouseMoveEvent ( QGraphicsSceneMouseEvent * event )
{
{
if ( mIsLocked )
return ;
QPointF dp = event - > pos ( ) - mPressedPos ;
QPointF dp = event - > pos ( ) - mPressedPos ;
QPointF rotCenter = mapToScene ( rect ( ) . center ( ) ) ;
QPointF rotCenter = mapToScene ( rect ( ) . center ( ) ) ;