Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to Adding of two values form the two textEdit contrlos??
Forum Updated to NodeBB v4.3 + New Features

How to Adding of two values form the two textEdit contrlos??

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 3 Posters 3.9k 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.
  • A Offline
    A Offline
    alanka_kishore
    wrote on last edited by
    #1

    @
    void MainWindow::on_addButton_clicked()
    {
    ui->label->setText(ui->textEdit->toPlainText() + ui->textEdit_2->toPlainText());

    }
    @
    Help me please..
    i am starter in this....
    i didnt find function for the adding..
    i am using.. "Qt_SDK_Win_offline_v1_1_4_en"

    Edit: please use @ tags around code sections to improve readability; Andre

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alanka_kishore
      wrote on last edited by
      #2

      okk, coool

      any one plz reply for this post...
      "How to Adding of two values form the two textEdit contrlos??":http://developer.qt.nokia.com/forums/viewthread/13873/

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        What is the problem you are experiencing exactly?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          [quote author="alanka_kishore" date="1327739552"]okk, coool

          any one plz reply for this post...
          "How to Adding of two values form the two textEdit contrlos??":http://developer.qt.nokia.com/forums/viewthread/13873/[/quote]

          I have moved this post from this totally unrelated "topic":http://developer.qt.nokia.com/forums/viewthread/13744/ to where it belongs. Please don't do this kind of thing. It is very rude to cry out for attention to your own problems in the middle of somebody else's conversation on an unrelated issue.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alanka_kishore
            wrote on last edited by
            #5

            ok cool, thank you
            i want to prepare simple app.. Which is like two text boxs, one submit button, one lable..
            My intenstion is to add two integer in the text boxes when i click on the submit button.. Answer will display in the lable...
            Can u please suggest.. Whay projeect i have select... Which way i can add the two intger from the text boxes...
            Waiting for reply...
            Thank you

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              Adding integers is different from "adding" strings. The latter is really a simple way to write a concatenation of two strings.

              A textbox contains a string. It does not magically become an integer. If you want to have integers, you either use a widget that supplies those directly (like, QSpinBox), or you will have to convert the string to an integer explicitly first. QString has a whole range of to<Type> methods to choose from. However, pay attention to the bool* ok flag. You are going to need it if you are converting user-entered data!

              The integers you then have (after converting from string), can be added. Now, you end up with having an integer, that you want to set as a text on a QLabel again. Luckely, you can do the conversion the other way around as well. One way for that is using QString::number(), but you can also use the QString::arg() way.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                alanka_kishore
                wrote on last edited by
                #7

                thank you...
                I will try today...

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mkhpad
                  wrote on last edited by
                  #8

                  This might be helpful if u understand it.........

                  http://developer.qt.nokia.com/forums/viewthread/4494

                  Harish.M

                  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