PDA

View Full Version : QCurrencyWidget -- Help!



Preeteesh
9th August 2007, 21:23
Hey, i am trying to make a simple Currency control derived from QLineEdit. The Control should have a $ in start and . at some place in that line edit. The . should remain there only and not move. Say for example a line edit will contain something like "$ . " i.e $ some space then dot and then two spaces. When a user enters a text he can enter 11 press . and then say 11 so we have in a line edit "$11 .11" . Now as soon as user should enter the last digit or say leave the control (in case he only enters first 1st two digits and leaves) the text would change to $-----11.11. Can someone give me idea how to achieve it?

Also i used input mask as $000009.00 but when you enter something . keeps moving... to right.

Kindly help me with some sample code...!

jacek
9th August 2007, 22:50
when you enter something . keeps moving... to right.
That's because you use proportional font, switch to fixed width one, like Courier New, and the dot won't move.