Results 1 to 3 of 3

Thread: maximum text width of interval

  1. #1
    Join Date
    Nov 2008
    Posts
    21
    Thanked 1 Time in 1 Post

    Default maximum text width of interval

    Hi,

    I need to find out the maximum text width of an interval, lets say [-100.50, 100.50] with precision of two.

    I can find out the text width using the QFontMetrics, but that works only for a sample string. I'd have to convert every number in the interval to a string and calculate the width for it to get the maximum. Is there an easier way?

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: maximum text width of interval

    What if you use [-888.88, 888.88] to calculate maximum string width (if I got you correctly)?

  3. #3
    Join Date
    Nov 2008
    Posts
    21
    Thanked 1 Time in 1 Post

    Default Re: maximum text width of interval

    why -888.88 and 888.88 ? it's not sure that the 8 is the "widest" character, it depends on the currently used font.

Similar Threads

  1. Phonon and the meta interval
    By huilui in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2012, 07:08
  2. QToolBox width fixed to maximum content width
    By ghorwin in forum Qt Programming
    Replies: 0
    Last Post: 10th July 2009, 10:58
  3. Maximum number of characters in width
    By ralphmerridew in forum Qt Programming
    Replies: 3
    Last Post: 27th May 2008, 02:55
  4. finding the time interval of executing a program
    By babu198649 in forum Qt Programming
    Replies: 1
    Last Post: 13th December 2007, 13:05
  5. Replies: 3
    Last Post: 20th November 2007, 08:03

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.