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. Is it possible to limit the inputs of a QDoubleSpinBox to defined increments?
Forum Updated to NodeBB v4.3 + New Features

Is it possible to limit the inputs of a QDoubleSpinBox to defined increments?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 216 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.
  • Dummie1138D Offline
    Dummie1138D Offline
    Dummie1138
    wrote on last edited by
    #1

    Hi. I have a QDoubleSpinBox, whose contents I want to be able to change in increments of 0.03.

    So, something like this:
    5efa5e5d-af69-426c-8a21-0ef9392f3579-image.png
    48750aa3-c09f-42bd-ab8b-8c5a215762ea-image.png

    I have set the singleStep button increments to 0.03, but it is still possible to edit the value directly. I was wondering whether a function for making the QDoubleSpinBox only accept values of a certain increment exists as I was unable to find it in the QAbstractSpinBox or QDoubleSpinBox documentation.

    JonBJ 1 Reply Last reply
    0
    • Dummie1138D Dummie1138

      Hi. I have a QDoubleSpinBox, whose contents I want to be able to change in increments of 0.03.

      So, something like this:
      5efa5e5d-af69-426c-8a21-0ef9392f3579-image.png
      48750aa3-c09f-42bd-ab8b-8c5a215762ea-image.png

      I have set the singleStep button increments to 0.03, but it is still possible to edit the value directly. I was wondering whether a function for making the QDoubleSpinBox only accept values of a certain increment exists as I was unable to find it in the QAbstractSpinBox or QDoubleSpinBox documentation.

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

      @Dummie1138
      No, you can only affect the step increments. You could add some kind of validator to do whatever with a number entered by the user, but it won't stop him typing something.

      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