Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to scroll two text areas, individually?
Forum Updated to NodeBB v4.3 + New Features

How to scroll two text areas, individually?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 3 Posters 505 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.
  • S Offline
    S Offline
    Shankar B
    wrote on last edited by
    #1

    How to scroll two text areas, with one scroll bar in qml? Also, the text area should scroll only if the displayed text exceeds available area. The scroll action should be individual to each text area but controlled by one scroll bar.

    1 Reply Last reply
    0
    • mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #2

      Given that QML ScrollBars are attached to one instance of a Flickable, I'm not sure this is possible. There's also the matter of determining which text area you wish to scroll.

      As far as when the ScrollBar is displayed, that's controlled by the policy property (another reason why this might be difficult).

      May I ask why you want such functionality? If possible, a sketch of what you're trying to do might be useful.

      S 1 Reply Last reply
      0
      • mzimmersM mzimmers

        Given that QML ScrollBars are attached to one instance of a Flickable, I'm not sure this is possible. There's also the matter of determining which text area you wish to scroll.

        As far as when the ScrollBar is displayed, that's controlled by the policy property (another reason why this might be difficult).

        May I ask why you want such functionality? If possible, a sketch of what you're trying to do might be useful.

        S Offline
        S Offline
        Shankar B
        wrote on last edited by
        #3

        @mzimmers
        I wanted to display a screen which shows cause and remedy like below
        Ex: Cause Remedy
        1.xyz 1. RRRR
        2.xxxxx
        3.jjjjjjjjjjjj
        4.llllllllllllllll
        5.uuuuuuu

        So, remedy has more points compared to cause. If I scroll vertical scroll bar only remedy should scroll not cause.
        Vice versa if cause is having more points(Exceeding height) cause should scroll not remedy.
        I have created separate text area for cause and remedy, So need solution to scroll action should be individual to each text area but controlled by one scroll bar.

        GrecKoG 1 Reply Last reply
        0
        • S Shankar B

          @mzimmers
          I wanted to display a screen which shows cause and remedy like below
          Ex: Cause Remedy
          1.xyz 1. RRRR
          2.xxxxx
          3.jjjjjjjjjjjj
          4.llllllllllllllll
          5.uuuuuuu

          So, remedy has more points compared to cause. If I scroll vertical scroll bar only remedy should scroll not cause.
          Vice versa if cause is having more points(Exceeding height) cause should scroll not remedy.
          I have created separate text area for cause and remedy, So need solution to scroll action should be individual to each text area but controlled by one scroll bar.

          GrecKoG Offline
          GrecKoG Offline
          GrecKo
          Qt Champions 2018
          wrote on last edited by
          #4

          @Shankar-B The documentation gives example on how to use a standalone https://doc.qt.io/qt-6/qml-qtquick-controls2-scrollbar.html#non-attached-scroll-bars

          you could adapt it to work with 2 flickable

          S 1 Reply Last reply
          0
          • GrecKoG GrecKo

            @Shankar-B The documentation gives example on how to use a standalone https://doc.qt.io/qt-6/qml-qtquick-controls2-scrollbar.html#non-attached-scroll-bars

            you could adapt it to work with 2 flickable

            S Offline
            S Offline
            Shankar B
            wrote on last edited by
            #5

            @GrecKo
            I have tried adding two scrollview's inside flickable, am getting individual scrollbar, if height exceeds. I don't need individual scrollbar. I need only one scroll which handle text area when height exceeds with vice versa.

            mzimmersM 1 Reply Last reply
            0
            • S Shankar B

              @GrecKo
              I have tried adding two scrollview's inside flickable, am getting individual scrollbar, if height exceeds. I don't need individual scrollbar. I need only one scroll which handle text area when height exceeds with vice versa.

              mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #6

              @Shankar-B can you post some code? I don't see how you'd be getting individual scrollbars. If you're explicitly declaring them, the policy property should cause them not to appear (though it's kind of a weird way of achieving that).

              As @GrecKo pointed out, you can declare independent scroll bars. Just follow the directions in the link he posted.

              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