Results 1 to 2 of 2

Thread: Subclass QDoubleSpinBox

  1. #1
    Join Date
    Mar 2008
    Posts
    57
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Subclass QDoubleSpinBox

    I would like to subclass a QDoubleSpinBox with the range of 0.50 to 999.

    The user cannot enter a value textually, since it is an embedded system and there
    are only a few buttons. To alter the value in the spinbox, there are up/down buttons.

    My problem is that the value should always have two significant digits.

    Values between 0.50 and 0.99 -> two decimals -> singleStep 0.01
    Values between 1.0 and 9.9 -> one decimals -> singleStep 0.1
    Values between 10 and 999 -> no decimal -> singleStep 1

    What is the most suitable solution? QDoubleValidator?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Subclass QDoubleSpinBox

    Why would you want to subclass the spinbox to do that? Just set its properties properly...

Similar Threads

  1. QDoubleSpinBox
    By coderbob in forum Qt Programming
    Replies: 6
    Last Post: 20th March 2008, 11:30
  2. Validator for QDoubleSpinBox
    By ehamberg in forum Qt Programming
    Replies: 3
    Last Post: 15th March 2008, 11:37
  3. QSqlQueryModel write subclass
    By skuda in forum Qt Programming
    Replies: 6
    Last Post: 29th October 2007, 16:18
  4. QT4: Sorting in QTreeWidget (subclass)
    By Michiel in forum Qt Programming
    Replies: 21
    Last Post: 29th March 2006, 18:08
  5. QFrame subclass does not reparent
    By high_flyer in forum Qt Programming
    Replies: 2
    Last Post: 21st March 2006, 22:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.