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. qlistwidget vertical scrollbar

qlistwidget vertical scrollbar

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 2 Posters 2.8k Views
  • 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.
  • I IknowQT

    Hi, friends. I have a question about qlistwidget.
    I have this property set to Always off. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
    I'd like to connect the scrollbar directly to the qlistwidget instead of the scrollbar that you provide, is there any way?

    eyllanescE Offline
    eyllanescE Offline
    eyllanesc
    wrote on last edited by
    #2

    @IknowQT What does: I'd like to connect the scrollbar directly to the qlistwidget ? Could you explain better, what new behavior do you expect? Your question is unclear.

    I 1 Reply Last reply
    0
    • I Offline
      I Offline
      IknowQT
      wrote on last edited by
      #3

      Additional questions!
      Is there a way to put the image in the stylesheet of the scrollbar?

      eyllanescE 1 Reply Last reply
      0
      • I IknowQT

        Additional questions!
        Is there a way to put the image in the stylesheet of the scrollbar?

        eyllanescE Offline
        eyllanescE Offline
        eyllanesc
        wrote on last edited by
        #4

        @IknowQT Looks like you have an XY problem, could you please provide a picture of what you want to get? In which part of the scrollbar do you want the image?

        I 1 Reply Last reply
        0
        • eyllanescE eyllanesc

          @IknowQT What does: I'd like to connect the scrollbar directly to the qlistwidget ? Could you explain better, what new behavior do you expect? Your question is unclear.

          I Offline
          I Offline
          IknowQT
          wrote on last edited by
          #5

          @eyllanesc

          f6836c6a-49cb-41b8-9297-5c390461c55c-image.png

          I just want to make it work by adding scroll widget, not scrolls in the listwidget.

          eyllanescE 1 Reply Last reply
          0
          • eyllanescE eyllanesc

            @IknowQT Looks like you have an XY problem, could you please provide a picture of what you want to get? In which part of the scrollbar do you want the image?

            I Offline
            I Offline
            IknowQT
            wrote on last edited by
            #6

            @eyllanesc

            fbafebe8-074a-4624-8285-d71114482c9a-image.png

            I have a jpg image and I want to make customized scrolls using the image.

            eyllanescE 1 Reply Last reply
            0
            • I IknowQT

              @eyllanesc

              f6836c6a-49cb-41b8-9297-5c390461c55c-image.png

              I just want to make it work by adding scroll widget, not scrolls in the listwidget.

              eyllanescE Offline
              eyllanescE Offline
              eyllanesc
              wrote on last edited by
              #7

              @IknowQT The big question is why don't you want the QScrollbar that comes with the QListWidget? Why do you need to replace it? What advantage or novelty do you plan to obtain with this new QScrollBar?

              I 1 Reply Last reply
              0
              • I IknowQT

                @eyllanesc

                fbafebe8-074a-4624-8285-d71114482c9a-image.png

                I have a jpg image and I want to make customized scrolls using the image.

                eyllanescE Offline
                eyllanescE Offline
                eyllanesc
                wrote on last edited by
                #8

                @IknowQT If you want to customize a QScrollBar then follow the official manual: https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qscrollbar, for this it is not necessary to create a new QScrollBar.

                1 Reply Last reply
                0
                • eyllanescE eyllanesc

                  @IknowQT The big question is why don't you want the QScrollbar that comes with the QListWidget? Why do you need to replace it? What advantage or novelty do you plan to obtain with this new QScrollBar?

                  I Offline
                  I Offline
                  IknowQT
                  wrote on last edited by
                  #9

                  @eyllanesc

                  eb10d73a-7c8a-4bc9-813d-155d20709059-image.png

                  The final UI composition I want to do is this screen.
                  If I click A UI and scroll, it will scroll through the contents of A UI, right?
                  If you click on B UI and scroll, I want the contents of B UI to scroll.

                  I want to control the A, B UI with one scroll.

                  eyllanescE 2 Replies Last reply
                  0
                  • I IknowQT

                    @eyllanesc

                    eb10d73a-7c8a-4bc9-813d-155d20709059-image.png

                    The final UI composition I want to do is this screen.
                    If I click A UI and scroll, it will scroll through the contents of A UI, right?
                    If you click on B UI and scroll, I want the contents of B UI to scroll.

                    I want to control the A, B UI with one scroll.

                    eyllanescE Offline
                    eyllanescE Offline
                    eyllanesc
                    wrote on last edited by
                    #10
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • I IknowQT

                      @eyllanesc

                      eb10d73a-7c8a-4bc9-813d-155d20709059-image.png

                      The final UI composition I want to do is this screen.
                      If I click A UI and scroll, it will scroll through the contents of A UI, right?
                      If you click on B UI and scroll, I want the contents of B UI to scroll.

                      I want to control the A, B UI with one scroll.

                      eyllanescE Offline
                      eyllanescE Offline
                      eyllanesc
                      wrote on last edited by
                      #11

                      @IknowQT From what I understand (since you are not explicit in your explanation) is that you have 2 QListWidget (A and B) and you want the same QScrollBar to serve both at different times, am I correct?

                      I 1 Reply Last reply
                      0
                      • eyllanescE eyllanesc

                        @IknowQT From what I understand (since you are not explicit in your explanation) is that you have 2 QListWidget (A and B) and you want the same QScrollBar to serve both at different times, am I correct?

                        I Offline
                        I Offline
                        IknowQT
                        wrote on last edited by
                        #12

                        @eyllanesc

                        yes
                        We need to control two widgets with one scroll.

                        eyllanescE 1 Reply Last reply
                        0
                        • I IknowQT

                          @eyllanesc

                          yes
                          We need to control two widgets with one scroll.

                          eyllanescE Offline
                          eyllanescE Offline
                          eyllanesc
                          wrote on last edited by
                          #13

                          @IknowQT I see problems in what you indicate, to be didactic I will use the terminology that Qt provides in the docs:

                          Screenshot_20210804_212613.png

                          Suppose that what you want has already been implemented, suppose also that each QListWidget has 1000 items, and is in the initial state where the "slider" is at the top touching the top "scroll arrow", and now it is in the mode of the that QScrollBar drives "A" and you slide the QScrollBar towards its lowest position so the "slider" will be touching the "scroll arrow" below so now you select "B", what should happen to the slider? What is because if you indicate that the "slider" should be kept down, then the elements of "B" will no longer be visible.

                          I 1 Reply Last reply
                          0
                          • eyllanescE eyllanesc

                            @IknowQT I see problems in what you indicate, to be didactic I will use the terminology that Qt provides in the docs:

                            Screenshot_20210804_212613.png

                            Suppose that what you want has already been implemented, suppose also that each QListWidget has 1000 items, and is in the initial state where the "slider" is at the top touching the top "scroll arrow", and now it is in the mode of the that QScrollBar drives "A" and you slide the QScrollBar towards its lowest position so the "slider" will be touching the "scroll arrow" below so now you select "B", what should happen to the slider? What is because if you indicate that the "slider" should be kept down, then the elements of "B" will no longer be visible.

                            I Offline
                            I Offline
                            IknowQT
                            wrote on last edited by
                            #14

                            @eyllanesc

                            When you click B, you can update the scroll according to the current location of B's selected item.

                            1 Reply Last reply
                            0
                            • I Offline
                              I Offline
                              IknowQT
                              wrote on last edited by
                              #15

                              Self-advice

                              m_pScroller = new QCustomScrollBar(QCustomScrollBar::ScrollType::MAIN, Qt::Orientation::Vertical, this);
                              this->ui.listWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
                              this->ui.listWidget->setVerticalScrollBar(m_pScroller);
                              

                              You can create a class that inherits scrollbar and put the class that you created into a vertical scrollbar.

                              A and B listWidget are both set vertical scrollbar, so both widgets will be available.

                              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