[SOLVED]QGraphicsScenes move



  • Hi,
    I have two QGraphicsViews with two QGraphicsScenes up down,and they zoom in same size with the same attributes.
    [Turn on QGraphicsView::ScrollHandDrag ,disables scrolls with Qt::ScrollBarAlwaysOff,Qt::ScrollBarAlwaysOff]

    The question is how can I drag to move one scene and the other moveing toghter.

    Thanks



  • You can use signals and slots to talk between the two views. The scroll bars still trigger their valueChanged signal even if they are not visible.

    I would also take a look at the chip demo.

    @
    connect(graphicsView1->horizontalScrollBar(),SIGNAL(valueChanged(int)),graphicsView2,SLOT(sliderValueChanged(int)));

    connect(graphicsView2->horizontalScrollBar(),SIGNAL(valueChanged(int)),graphicsView1,SLOT(sliderValueChanged(int)));

    @



  • Thanks,solved!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.