Results 1 to 3 of 3

Thread: Unit always visible in QLineEdit

  1. #1
    Join Date
    Feb 2009
    Posts
    20

    Default Unit always visible in QLineEdit

    I want to have a QLineEdit, where the user can input numbers.

    After the number there should be always a unit shown (e.g. 'mm').
    The user should not be able to delete the mm, select or do what ever with it.
    The LayoutDirection is from left to right.

    I thougt a simple solution can be to add another LineEdit to the first one.
    And modify the style of the "unit - LineEdit" so that is looks like the two are one together.

    Or is there a better solution?Maybe with inputmask something?

  2. #2
    Join Date
    Apr 2009
    Location
    Italy
    Posts
    70
    Thanks
    23
    Thanked 15 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Unit always visible in QLineEdit

    You can do that with a QSpinBox and QSpinBox::setSuffix()

  3. #3
    Join Date
    Feb 2009
    Posts
    20

    Default Re: Unit always visible in QLineEdit

    That doesn't work very well, I have the layout direction right to left, but the suffix is still before the number, also when I use the prefix.
    I think thats a bug.

    And the other think is I don't want to limit the user in his input value, e.g. how many digits before and after the point.

Similar Threads

  1. Unit Converter Widget
    By baray98 in forum Qt Programming
    Replies: 13
    Last Post: 17th December 2016, 16:06
  2. Unit testing Gui applications
    By yop in forum Qt Programming
    Replies: 0
    Last Post: 17th May 2009, 15:40
  3. QBitArray (the smallest unit of them all)
    By baray98 in forum Qt Programming
    Replies: 3
    Last Post: 29th September 2007, 14:16
  4. QTest Unit Testing
    By bothapn in forum Qt Programming
    Replies: 1
    Last Post: 16th July 2006, 22:11
  5. How to unit test a Qt Gui
    By mitskits in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2006, 07:36

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.