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. QInputDialog get double with unlimited number of decimal
Forum Updated to NodeBB v4.3 + New Features

QInputDialog get double with unlimited number of decimal

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 627 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.
  • Please_Help_me_DP Offline
    Please_Help_me_DP Offline
    Please_Help_me_D
    wrote on last edited by
    #1

    Hi,

    I need to let the user input double number without restriction on number of decimals.
    If I use QInputDialog::getDouble() with 100 decimals then the dialog becomes unconvenient when I display started value (it shows me my value and 100 of zeros even if this is a rounded value).

    The other way is to control every character of QInputDialog text. But I can't see there a signal or a virtual function that I could use to control user typing.

    What would you recommend me?

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

      https://doc.qt.io/qt-5/qinputdialog.html#doubleDecimals-prop

      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
      1
      • Kent-DorfmanK Offline
        Kent-DorfmanK Offline
        Kent-Dorfman
        wrote on last edited by Kent-Dorfman
        #2

        If you really think 100 decimal places is important (I have my doubts) then you need to define your own custom fixed precision type. double isn't going to represent the value to the precision that you want, as it only stores 15-17 significant digits, plus the exponent.

        Please_Help_me_DP 1 Reply Last reply
        6
        • Kent-DorfmanK Kent-Dorfman

          If you really think 100 decimal places is important (I have my doubts) then you need to define your own custom fixed precision type. double isn't going to represent the value to the precision that you want, as it only stores 15-17 significant digits, plus the exponent.

          Please_Help_me_DP Offline
          Please_Help_me_DP Offline
          Please_Help_me_D
          wrote on last edited by
          #3

          @Kent-Dorfman thank you for reply.
          Double it is ok I just wrote 100 values for example.
          The problem that QInputDialog is going to be used to define value-range of points and this value range maybe very different: from -10000 to 10000, or from -0.0000001 to 0.000002. I'm trying to say that is hard to detefine the order of value range.
          So it would be nice to have unlimited (or 15-17) number of decimals that are hidden and not displayed as 123,0000000000000

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

            https://doc.qt.io/qt-5/qinputdialog.html#doubleDecimals-prop

            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
            1

            • Login

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