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. I want to discount the value of a spinBox in the other spinBox

I want to discount the value of a spinBox in the other spinBox

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 212 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.
  • milhaoM Offline
    milhaoM Offline
    milhao
    wrote on last edited by
    #1

    hi, I would like to know how a value is deducted from a spinBox and I add it to the other simultaneously, so I want the user X number to use in the intellect spinBox so it will deduct from the total spinBox and add it to the intellect spinBox, as I do this action.

    jsulmJ 1 Reply Last reply
    0
    • milhaoM milhao

      hi, I would like to know how a value is deducted from a spinBox and I add it to the other simultaneously, so I want the user X number to use in the intellect spinBox so it will deduct from the total spinBox and add it to the intellect spinBox, as I do this action.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @milhao I'm not sure what you really mean, please rephrase.
      In general you're going to use signals/slots: connect a slot to https://doc.qt.io/qt-6/qspinbox.html#valueChanged and then set the value in the other spin box using https://doc.qt.io/qt-6/qspinbox.html#value-prop. If you want to add the value from the first spin box to the value of the second one then do it in the same way except you call:

      // value is the value from the first spin box coming via the valueChanged signal
      ui->secondSpinBox->setValue(ui->secondSpinBox->value() + value);
      

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

      1 Reply Last reply
      2

      • Login

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