Results 1 to 2 of 2

Thread: QDoubleSpinbox decimal issues.

  1. #1
    Join Date
    Sep 2019
    Qt products

    Default QDoubleSpinbox decimal issues.

    Hey people.
    I'm trying to put decimals in a QDoubleSpinbox in run-time and it won't work. Should i maybe use an other widget?
    What would be nice was if you could write the decimal point manually, but i don't know if there's any functionality for that.
    Anybody have any answers?
    the code i have at the moment in QDoubleSpinboxes (they're all in a vector to quickly set their values)
    Qt Code:
    1. for(auto object : transformSpinBoxes)
    2. {
    3. object->setMaximumWidth(spinBoxWidthMax);
    4. object->setMinimumWidth(spinBoxWidthMin);
    5. object->setMaximum(10000);
    6. object->setMinimum(-10000);
    7. object->setButtonSymbols(QAbstractSpinBox::NoButtons);
    8. object->setSingleStep(0);
    9. object->setDecimals(3);
    10. // object->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    11. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 804 Times in 793 Posts
    Qt products
    Windows Android

    Default Re: QDoubleSpinbox decimal issues.

    So according to your code, you are configuring your spin boxes so they can't actually be used as spin boxes. You set the single step to 0 (which effectively disables the up / down arrow keys) and you disable the buttons. Why? The only thing the user can do with these is to type a value into them. If you don't want them to function as spin boxes, then use a QLineEdit with a QDoubleValidator.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 0
    Last Post: 17th September 2015, 09:16
  2. decimal display in QDoubleSpinBox
    By henryjoye in forum Qt Programming
    Replies: 0
    Last Post: 20th December 2011, 23:37
  3. QDoubleSpinBox
    By prashant in forum Qt Programming
    Replies: 0
    Last Post: 7th October 2009, 16:30
  4. QDoubleSpinBox: dot as comma
    By Raccoon29 in forum Newbie
    Replies: 4
    Last Post: 21st May 2008, 18:44
  5. QDoubleSpinBox
    By coderbob in forum Qt Programming
    Replies: 6
    Last Post: 20th March 2008, 11:30


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.