Results 1 to 2 of 2

Thread: How to display numbers in Custom image fonts

  1. #1
    Join Date
    May 2011
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default How to display numbers in Custom image fonts

    Hi there,

    I was wondering how do you display numbers (Let say a whole number 32412) in a custom image fonts. I got the images that display 0 to 9. I was thinking of getting the each number position and display it with the custom image font that I created but I'm not sure whether this is memory sufficient. Any suggestions? Thank you.

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to display numbers in Custom image fonts

    There are many ways to do this. One straightforward approach: convert the number to a string; step through the string one character at a time. Arrange for your numeric images to have names like "imageX.png" where 'X' is the number it represents, like 'image3.png'. Now, append your character to "image" and append ".png" to that, and you're done.

    You can also convert the character back to an integer and store your images or their names in a suitably arranged array. You could also skip the integer/string conversion altogether with some minor arithmetic.

Similar Threads

  1. Qt Image Display...
    By mahe2310 in forum Qt Programming
    Replies: 9
    Last Post: 22nd July 2013, 10:06
  2. Replies: 3
    Last Post: 17th April 2010, 22:35
  3. How to use QLCDnumber to display negative numbers?
    By grissiom in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2010, 07:23
  4. How to Display the image in Qt
    By sdastagirmca in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2009, 07:17
  5. Display image
    By Pesho in forum Qt Programming
    Replies: 1
    Last Post: 14th September 2007, 01:21

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.