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. Spinbox increment event?
Qt 6.11 is out! See what's new in the release blog

Spinbox increment event?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 1.0k 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.
  • B Offline
    B Offline
    Bert59
    wrote on last edited by
    #1

    Hello,

    I have the following layout:
    6dd1c041-67a3-4c64-8189-77207f194d98-image.png

    This is the code for handling the events from the spinbox Max:
    void Widget::on_dsbMax_valueChanged(double arg1)
    {
    m_xAxis->setMax(arg1);
    }

    void Widget::on_dsbMax_editingFinished()
    {
    m_xAxis->setMax(ui->dsbMax->value());
    }

    The issue I have is because of the valueChanged slot, the axis of the graph changes during typing a value on the keyboard. But I only want to update the axis when editing is finished.
    I cannot remove the valueChanged slot because the axis must also be updated with a click on the up and down arrows in the spinbox.

    I could check if the value has changed about the increment step to secregate the 2 behaviours. But there is maybe a more elegant way to do it.

    So if someone has a better idea it would be appreciated.

    JonBJ 1 Reply Last reply
    0
    • B Bert59

      Hello,

      I have the following layout:
      6dd1c041-67a3-4c64-8189-77207f194d98-image.png

      This is the code for handling the events from the spinbox Max:
      void Widget::on_dsbMax_valueChanged(double arg1)
      {
      m_xAxis->setMax(arg1);
      }

      void Widget::on_dsbMax_editingFinished()
      {
      m_xAxis->setMax(ui->dsbMax->value());
      }

      The issue I have is because of the valueChanged slot, the axis of the graph changes during typing a value on the keyboard. But I only want to update the axis when editing is finished.
      I cannot remove the valueChanged slot because the axis must also be updated with a click on the up and down arrows in the spinbox.

      I could check if the value has changed about the increment step to secregate the 2 behaviours. But there is maybe a more elegant way to do it.

      So if someone has a better idea it would be appreciated.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #3

      @Bert59
      As @Christian-Ehrlicher has said. But, if you have not read it already, you also ought be aware of the behaviour in https://doc.qt.io/qt-5/qabstractspinbox.html#keyboardTracking-prop .

      B 1 Reply Last reply
      1
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        See QAbstractSpinBox::editingFinished()

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        4
        • B Bert59

          Hello,

          I have the following layout:
          6dd1c041-67a3-4c64-8189-77207f194d98-image.png

          This is the code for handling the events from the spinbox Max:
          void Widget::on_dsbMax_valueChanged(double arg1)
          {
          m_xAxis->setMax(arg1);
          }

          void Widget::on_dsbMax_editingFinished()
          {
          m_xAxis->setMax(ui->dsbMax->value());
          }

          The issue I have is because of the valueChanged slot, the axis of the graph changes during typing a value on the keyboard. But I only want to update the axis when editing is finished.
          I cannot remove the valueChanged slot because the axis must also be updated with a click on the up and down arrows in the spinbox.

          I could check if the value has changed about the increment step to secregate the 2 behaviours. But there is maybe a more elegant way to do it.

          So if someone has a better idea it would be appreciated.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #3

          @Bert59
          As @Christian-Ehrlicher has said. But, if you have not read it already, you also ought be aware of the behaviour in https://doc.qt.io/qt-5/qabstractspinbox.html#keyboardTracking-prop .

          B 1 Reply Last reply
          1
          • B Offline
            B Offline
            Bert59
            wrote on last edited by
            #4

            Thank you.

            setKeyboardTracking makes the job

            1 Reply Last reply
            1
            • JonBJ JonB

              @Bert59
              As @Christian-Ehrlicher has said. But, if you have not read it already, you also ought be aware of the behaviour in https://doc.qt.io/qt-5/qabstractspinbox.html#keyboardTracking-prop .

              B Offline
              B Offline
              billw22
              wrote on last edited by billw22
              #5

              @JonB said in Spinbox increment event?:

              @Bert59
              As @Christian-Ehrlicher has said. But, if you have not read it already, you also ought be aware of the behaviour in https://doc.qt.io/qt-5/qabstractspinbox.html#keyboardTracking-prop . and from https://homework-writer.com/ site

              Thanks bert
              was just lookign for that

              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