Qt Forum

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

    Solved Vertical slider increment

    General and Desktop
    2
    7
    815
    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.
    • P
      Payx last edited by

      Hello guys,

      i want to use a vertical slider to increase a variable

      void MainWindow::on_verticalSlider_sliderMoved(int position)
      {
          ui->verticalSlider->setRange(1,50);
      }
      

      i have already got this, but i don't know how to increment a variable when the slider moove

      thanks

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Do you mean connect a slot to the sliderMoved signal of your verticalSlider object and call something like ++myVariable; in it ?

        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 Reply Quote 0
        • P
          Payx last edited by

          Yes that is right

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Since it's the same slider then you can add the logic to your on_verticalSlider_sliderMoved slot.

            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 Reply Quote 0
            • P
              Payx last edited by

              so just that :

              void MainWindow::on_verticalSlider_sliderMoved(int position)
              {
                  ui->verticalSlider->setRange(1,50);
              z++; 
              }
              

              ?

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                From what you described, yes.

                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 Reply Quote 0
                • P
                  Payx last edited by

                  Okay it works :-)

                  Thank you !

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