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. How do I make a scrollbar move along with the hosting widget?
Forum Updated to NodeBB v4.3 + New Features

How do I make a scrollbar move along with the hosting widget?

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 3 Posters 1.6k Views 2 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.
  • T Offline
    T Offline
    tamirmichael
    wrote on last edited by tamirmichael
    #4

    Hi,
    Thanks for the suggestion. Sounds good !
    @mrjj I fiddled with some options there with no satisfying result (then I went to bed).
    I will mark this solved if a QScrollArea satisfies my needs.
    Thanks for both.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tamirmichael
      wrote on last edited by tamirmichael
      #5

      Folks,
      Even QScollArea behaves the exact same way - the scroll bars do not follow the temporal window's dimensions. Any idea? Alternatives?
      I have noticed that the QCustomPlot widget itself does not change in size (I gave up QScrollArea) - it must be the same issue? Is it layout related?

      mrjjM 1 Reply Last reply
      0
      • T tamirmichael

        Folks,
        Even QScollArea behaves the exact same way - the scroll bars do not follow the temporal window's dimensions. Any idea? Alternatives?
        I have noticed that the QCustomPlot widget itself does not change in size (I gave up QScrollArea) - it must be the same issue? Is it layout related?

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #6

        @tamirmichael
        Well it normally does.
        Did you apply a layout to the viewport of the scoll area ?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #7

          Can you show maybe some picture/sketch of what you are trying to achieved ?

          Did you make QScrollArea the hosting widget ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • T Offline
            T Offline
            tamirmichael
            wrote on last edited by
            #8

            0_1555705622031_efd93217-50b1-478f-8328-28faa593d154-image.png

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #9

              How are you setting that up ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tamirmichael
                wrote on last edited by tamirmichael
                #10

                Does it matter which layout type?
                I will try to mess with QScollArea somewhat more...how do I set it to "host" ? Tried to drop the scroll bar onto it etc. without result...

                @SGaist So far I only added the scroll area, and tried to place the scrollbars where I want them, on or off it - with negative results.
                I see that dragging the QScrollArea does indeed change the location of my scroll bar too - does that mean that its "hosting"? I see no change in behavior though...
                Can you tell me in a few short sentences what I need to do? It's silly I have a working example but I cannot seem to find anything at all about it that makes it work! :-(

                mrjjM 1 Reply Last reply
                0
                • T tamirmichael

                  Does it matter which layout type?
                  I will try to mess with QScollArea somewhat more...how do I set it to "host" ? Tried to drop the scroll bar onto it etc. without result...

                  @SGaist So far I only added the scroll area, and tried to place the scrollbars where I want them, on or off it - with negative results.
                  I see that dragging the QScrollArea does indeed change the location of my scroll bar too - does that mean that its "hosting"? I see no change in behavior though...
                  Can you tell me in a few short sentences what I need to do? It's silly I have a working example but I cannot seem to find anything at all about it that makes it work! :-(

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #11

                  @tamirmichael
                  Hi
                  I checked the sample and its now clear what you mean.
                  You want to scroll the axes of the customplot with the scrollbars.
                  adn not scroll the actual widget around.
                  You need all the code from the example to do so. (except setupPlot())
                  private slots:
                  void horzScrollBarChanged(int value);
                  void vertScrollBarChanged(int value);
                  void xAxisChanged(QCPRange range);
                  void yAxisChanged(QCPRange range);
                  and their code.
                  and the connect statements and othe code from constructor.

                  the example uses a QGridLayout to keep scrollbars following the customplot.
                  You can still use a ScrollArea if you want instead of the free scrollbars.

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    tamirmichael
                    wrote on last edited by
                    #12

                    0_1555707301212_9253f1c3-5abe-48a7-b42e-9d4d9085fbc3-image.png

                    Hopeless UI design ! Hopeless !

                    mrjjM 1 Reply Last reply
                    0
                    • T tamirmichael

                      0_1555707301212_9253f1c3-5abe-48a7-b42e-9d4d9085fbc3-image.png

                      Hopeless UI design ! Hopeless !

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #13

                      @tamirmichael
                      why is it hopeless ?
                      Its fully documented and works pretty nice.
                      https://doc.qt.io/qt-5/layout.html

                      1 Reply Last reply
                      2
                      • T Offline
                        T Offline
                        tamirmichael
                        wrote on last edited by
                        #14

                        I think it is tremendously un-intuitive. There other ways to suggest that behavior like this is to be induced, and the link above does indeed demonstrates that I am not the only one who just did not get it. Either way thanks.

                        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