How to Create a Measurement Conversion Application in Qt?
Macro last edited by
I am trying to create a Simple Measurement Conversion Application Which is used to convert from mm to cm or vice versa. I started doing it with a QLineEdit and a Combo Box Which contains the Various units. When the User Enters a Value in the LineEdit and if he changes the unit in the Combo Box, Then the LineEdit should change its value according to its unit changed.
For Example: If i am entering the value as 100 in my Line Edit and my default unit is in mm. Now if i change this unit to Cm, then the LineEdit Value should change to 10. Can anyone please give your suggestions to solve this.
Thanks & Regards
DRAX last edited by
I think that would be better to make 2 of those.
Then, as you type in A1, you will write converted value to B1 (of course, corresponding to selected values in A2 and B2).
It is simpler and more practical. You can also expand code to work vice-versa too.
Going on your way, you would need to select each time unit in ComboBox when you want to convert it (or make "Convert" button), and if you convert as you type, then it would be hard to maintain original value + you might easily end up in never ending loop (actually, never ending recursion).
Sam last edited by
So what did you try, I dont think that it is feasible for us to complete your home work. First give it a try and if you get error/stuck then you can easily ask at the forum for help.
For the technical specification you can look into QComboBox SIGNALs , use signal & slots then accordingly update the text of your lineEdit.