DisplayGroupGraphicsView::DisplayGroupGraphicsView()
{
    // create and set scene for the view
    setScene(new DisplayGroupGraphicsScene());

    // force scene to be anchored at top left
    setAlignment(Qt::AlignLeft | Qt::AlignTop);

    // set attributes of the view
    setInteractive(true);
    setDragMode(QGraphicsView::RubberBandDrag);
    setAcceptDrops(true);

    grabGestures();
}
void DisplayGroupGraphicsView::setModel( DisplayGroupPtr displayGroup )
{
    if( displayGroup_ )
    {
        displayGroup_->disconnect( this );
        scene()->clear();
        static_cast< DisplayGroupGraphicsScene* >( scene( ))->refreshTileRects();
        grabGestures();
    }

    displayGroup_ = displayGroup;
    if( !displayGroup_ )
        return;

    connect( displayGroup_.get(), SIGNAL( contentWindowAdded( ContentWindowPtr )),
             this, SLOT( addContentWindow( ContentWindowPtr )));
    connect( displayGroup_.get(), SIGNAL( contentWindowRemoved( ContentWindowPtr )),
            this, SLOT(removeContentWindow(ContentWindowPtr)));
    connect( displayGroup_.get(), SIGNAL( contentWindowMovedToFront( ContentWindowPtr )),
             this, SLOT( moveContentWindowToFront( ContentWindowPtr )));
}