Results 1 to 2 of 2

Thread: How to leading 0 in Qspinbox?

  1. #1
    Join Date
    Sep 2019
    Posts
    6
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X

    Default How to leading 0 in Qspinbox?

    In Qspinbox when I select 1 I want add 0 before 1 to be like 01 in the spinbox How can I do that?
    sorry for my English.
    thank you for your reply

  2. #2
    Join Date
    Jul 2008
    Posts
    409
    Thanks
    9
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to leading 0 in Qspinbox?

    Hi, you can reimplement QSpinBox::textFromValue() and QSpinBox::valueFromText() to format the displayed string the way you like. You might also have to reimplement QSpinBox::validate().

    Ginsengelf

  3. The following user says thank you to Ginsengelf for this useful post:

    akkarachai (16th October 2019)

Similar Threads

  1. Replies: 16
    Last Post: 20th March 2015, 20:23
  2. Replies: 7
    Last Post: 27th December 2011, 14:28
  3. Replies: 5
    Last Post: 27th December 2011, 12:09
  4. QFontMetrics::leading() returns negative value.
    By JantarManter in forum Qt Programming
    Replies: 0
    Last Post: 19th May 2010, 15:45

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.