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. Simple Math Calculation Questions in QT (PyQt, Qt4 C++)
Forum Updated to NodeBB v4.3 + New Features

Simple Math Calculation Questions in QT (PyQt, Qt4 C++)

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 1.3k 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.
  • B Offline
    B Offline
    baxtorburgandy
    wrote on last edited by
    #1

    Im using PyQt and/or Qt4 C++ for the first time and trying create simple math calculations. What I need to do is use data from 2 inputs (QLineEdit) and run this calculation in the background:
    a - b = c
    c * 2 = d / 0.9 = sum
    The sum would then need to be printed on another QLineEdit. Is this possible in either PyQT or C++? An answer in either language would be much appreciated as I am using both.
    Also, just so all of my questions are out there, I have a number in QLineEdit and I need to find a data output based on a number range. Example:
    Input Number = 0.80
    0 - 0.19 = 5 0.2 - 0.49 = 10 0.50 - 0.79 = 15 0.80 - 1.09 = 20
    So the output (20 in this case) would need to also be output in another QLineEdit.
    Basically, the outputs are in QLineEdit because sometimes we need to change the value based on certain variables (weather, previous fertilizer applications, etc.) I am just a hobby programmer and I mainly work as a soil consultant so I am trying to build a program that inputs my lab data and I can run my calculations and speed up my turn around time. My company already runs calculations based in Excel and VB but I thought that it would be a fun project for me to try and build a new program in Qt. I have been spending countless hours in documentation, books, and tutorials and there are no answers anywhere. If there is any help that you can give me or at least give a link to something that may help, it would be greatly appreciated. Thank you very much and happy coding!

    EddyE R 2 Replies Last reply
    0
    • B baxtorburgandy

      Im using PyQt and/or Qt4 C++ for the first time and trying create simple math calculations. What I need to do is use data from 2 inputs (QLineEdit) and run this calculation in the background:
      a - b = c
      c * 2 = d / 0.9 = sum
      The sum would then need to be printed on another QLineEdit. Is this possible in either PyQT or C++? An answer in either language would be much appreciated as I am using both.
      Also, just so all of my questions are out there, I have a number in QLineEdit and I need to find a data output based on a number range. Example:
      Input Number = 0.80
      0 - 0.19 = 5 0.2 - 0.49 = 10 0.50 - 0.79 = 15 0.80 - 1.09 = 20
      So the output (20 in this case) would need to also be output in another QLineEdit.
      Basically, the outputs are in QLineEdit because sometimes we need to change the value based on certain variables (weather, previous fertilizer applications, etc.) I am just a hobby programmer and I mainly work as a soil consultant so I am trying to build a program that inputs my lab data and I can run my calculations and speed up my turn around time. My company already runs calculations based in Excel and VB but I thought that it would be a fun project for me to try and build a new program in Qt. I have been spending countless hours in documentation, books, and tutorials and there are no answers anywhere. If there is any help that you can give me or at least give a link to something that may help, it would be greatly appreciated. Thank you very much and happy coding!

      EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Hi @baxtorburgandy ,

      Welcome to the Qt forums

      There are some calculator examples that do what you need. You can look into them from Qt creator > examples. Search for calculator.

      Do you know about signal-slots? You will need them for sure. If input a changes send a signal, if input b changes send a signal and connect a slot that does the math.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • B baxtorburgandy

        Im using PyQt and/or Qt4 C++ for the first time and trying create simple math calculations. What I need to do is use data from 2 inputs (QLineEdit) and run this calculation in the background:
        a - b = c
        c * 2 = d / 0.9 = sum
        The sum would then need to be printed on another QLineEdit. Is this possible in either PyQT or C++? An answer in either language would be much appreciated as I am using both.
        Also, just so all of my questions are out there, I have a number in QLineEdit and I need to find a data output based on a number range. Example:
        Input Number = 0.80
        0 - 0.19 = 5 0.2 - 0.49 = 10 0.50 - 0.79 = 15 0.80 - 1.09 = 20
        So the output (20 in this case) would need to also be output in another QLineEdit.
        Basically, the outputs are in QLineEdit because sometimes we need to change the value based on certain variables (weather, previous fertilizer applications, etc.) I am just a hobby programmer and I mainly work as a soil consultant so I am trying to build a program that inputs my lab data and I can run my calculations and speed up my turn around time. My company already runs calculations based in Excel and VB but I thought that it would be a fun project for me to try and build a new program in Qt. I have been spending countless hours in documentation, books, and tutorials and there are no answers anywhere. If there is any help that you can give me or at least give a link to something that may help, it would be greatly appreciated. Thank you very much and happy coding!

        R Offline
        R Offline
        Rmiles
        Banned
        wrote on last edited by
        #3
        This post is deleted!
        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