Results 1 to 4 of 4

Thread: add two integers

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2012
    Posts
    3
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Windows

    Default add two integers

    how to add to integers,what is the easiest way to do it?

    ui->label2->setText(ui->plainTextEdit->toPlainText());
    int A,B,C;
    QString S1(ui->label->selectedText());
    QString S2(ui->label->selectedText());
    A = S1.toInt();
    B = S2.toInt();
    C = static_cast<int>(A)+ B; //need to add A + B but it gives 0 to me
    Last edited by Gishan; 8th September 2012 at 07:22.

Similar Threads

  1. Save 4 Integers in a QByteArray without memcpy
    By GonzoFist in forum Newbie
    Replies: 3
    Last Post: 17th May 2010, 23:15
  2. initialize QStringList with integers
    By tommy in forum Newbie
    Replies: 3
    Last Post: 13th May 2009, 06:48
  3. Only integers from QFontMetricsF width
    By StevenB in forum Qt Programming
    Replies: 3
    Last Post: 16th May 2008, 21:59
  4. how to get integers from mysql
    By eleanor in forum Qt Programming
    Replies: 9
    Last Post: 8th November 2007, 16:25
  5. Strings from LineEdit to Integers
    By Misko in forum Newbie
    Replies: 3
    Last Post: 12th August 2007, 11:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.