Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] widget displaying content in relation with QGraphicView
Forum Updated to NodeBB v4.3 + New Features

[solved] widget displaying content in relation with QGraphicView

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    ote13
    wrote on last edited by
    #1

    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 :

    !http://imageshack.us/f/841/resultatvoulu.png/!
    "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.

    1 Reply Last reply
    0
    • idlefrogI Offline
      idlefrogI Offline
      idlefrog
      wrote on last edited by
      #2

      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:
      i.e.

      @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?

      1 Reply Last reply
      0
      • O Offline
        O Offline
        ote13
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • idlefrogI Offline
          idlefrogI Offline
          idlefrog
          wrote on last edited by
          #4

          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 :)

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved