Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved what is way to create signal and slot on setVerticalScrollBar ?

    Mobile and Embedded
    3
    5
    248
    Loading More Posts
    • 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.
    • Q
      Qt embedded developer last edited by Qt embedded developer

      i want to implement on signal and slot such as set vertical scroll bar value get change then call custom created slot function. but how to use it i don't know if any body know about it give me example for below case
      ui->scrollArea->setVerticalScrollBar(new QScrollBar(ui->scrollArea));

      jsulm S 2 Replies Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @Qt embedded developer last edited by

        @Qt-embedded-developer Why do you need a signal for that? Its you sets the scroll bar, right? So, you know when it is set.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        Q 1 Reply Last reply Reply Quote 0
        • Q
          Qt embedded developer @jsulm last edited by

          @jsulm because on scrolling inside scroll area i need to catch the value as we scroll and on that i want to add more widget inside it like image icons

          jsulm 1 Reply Last reply Reply Quote 0
          • jsulm
            jsulm Lifetime Qt Champion @Qt embedded developer last edited by

            @Qt-embedded-developer For scrolling signal there is https://doc.qt.io/qt-5/qabstractslider.html#valueChanged and https://doc.qt.io/qt-5/qabstractslider.html#sliderMoved

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 2
            • S
              SimonSchroeder @Qt embedded developer last edited by

              @Qt-embedded-developer said in what is way to create signal and slot on setVerticalScrollBar ?:

              ui->scrollArea->setVerticalScrollBar(new QScrollBar(ui->scrollArea));

              There is no reason to install your own scroll bar object. Based on the settings of the scroll area it will create/show one when needed. You can get a handle to it with ui->scrollArea->verticalScrollBar(). Then use the signals of the scollbar to get informed about changes.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post