Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to Create a Measurement Conversion Application in Qt?
Forum Updated to NodeBB v4.3 + New Features

How to Create a Measurement Conversion Application in Qt?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Macro
    wrote on last edited by
    #1

    Hi Developers,

    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

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DRAX
      wrote on last edited by
      #2

      I think that would be better to make 2 of those.
      A1: LineEdit
      A2: ComboBox
      B1: LineEdit
      B2: ComboBox

      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).

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sam
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved