[solved] widget displaying content in relation with QGraphicView

  • Hello,

    I'm trying to build a window which contain different parts and I'm almost done but there's a last step that I'm having difficulties with.

    A image will be faster to describe what I want :

    "Ling to the image ":http://img841.imageshack.us/img841/2433/resultatvoulu.png

    The white area is handled via QGraphicsScene/QGraphicsView to display a big diagram. Only part of it is displayed and user navigate with scroll bars. The red part (QSlider) has a fixed width. All of this works as describe using Qt example code "border layout":http://qt-project.org/doc/qt-4.8/layouts-borderlayout.html

    My problem : the red area contains a long list of text, the same height as the diagram shown in white area and only part of it is displayed. I've succeed to send wheel events from white area to the red one and inversely, but I can't make the content displayed in red area to be changed. I would like to display parts that are hidden when user scroll and no matter which function (setValue(), setSliderPosition(), scroll()...) I use, nothing changes. The only result that I get is when using move(). Then the red area start recovering the green one and that's obviously not what I want.

    If anyone know how to fix this, I would really appreciate.

    Please note, that despite the image was made with designer, all of the window is constructed with code, so please don't help me inviting me to use it.

    Thaks for reading.

  • Just to clarify (rather than solve the problem):

    The 'red' area is a QSlider. Although you say 'the red area contains a ... list of text'
    Although, QSliders don't hold text.

    What are the 'hidden parts'? I assume these are items in the QGraphicsView?

    Then lets say there is an item that is not currently in view.

    Pragmatically, you want to bring hidden items back into view by scrolling the view:

    @QScrollBar *bar_horiz = view.horizontalScrollBar() ;
    bar_horiz.setSliderPosition(pos) ;

    BUT the problem you have is that when the scroll bar position changes, the view is static?

    Perhaps you could post some code here?

  • Thanks idlefrog for your reply.

    In fact as you pointed, the red area has nothing to do with a QSlider. I have no idea why I use that and worse, how I did not see that this was the problem. I manage to achieve what I want with a QScrollArea.

    The view reacted well to user interaction, my problem was that I need to have some area always displayed on screen. It was previously in the view but as the diagram shown inside it became very large and can now be scrolled horizontally, I had to create another area for that content which scroll only vertically in conjunction with the view.

  • Glad you got it sorted :) - Sometimes a 'question' rather than an 'answer' is more useful :)
    I guess you might as well mark it as solved :)

Log in to reply

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