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. QDoubleSpinBox: valueChanged only by the user

QDoubleSpinBox: valueChanged only by the user

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.6k 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.
  • M Offline
    M Offline
    myoan
    wrote on last edited by
    #1

    Hi all,

    I have a QDoubleSpinBox that can be modified both by the user and programmatically and a slot associated to the signal valueChanged. But I would like this slot to be called ONLY if the change has been made by the user.

    I would like to avoid an ugly attribute like @bool MainWindow::value_changed_programmatically;@

    Is there any Qt-only way to do this?

    Example:

    @ void MainWindow::refreshView() {
    _ui.doublebox->setValue(someValue); // this should not call the slot
    }

    void MainWindow::on_doublebox_valueChanged(double d) {
        // take the new value into account ONLY if the user did the change
    }@
    

    Thanks

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

      Hi,

      IIRC editingFinished might be what you need.

      Hope it helps

      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
      • M Offline
        M Offline
        myoan
        wrote on last edited by
        #3

        Yes thanks! Sorry for the late reply :)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          myoan
          wrote on last edited by
          #4

          Yes thanks! Sorry for the late reply :)

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

            You're welcome ! No problem, it happens to all of us ;)

            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
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You're welcome ! No problem, it happens to all of us ;)

              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

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved