Click here to Skip to main content
11,932,103 members (53,230 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ QT
Hi Guys
I'm New In QT And C++.
I Design Calculator Using C++ And QT
I Using QLcdNumber In QT And I Want To Know How I Can Add Number To Outher Every Click On Button.
I Press Button 1
And Then I Press Button 2
Then QLcdNumber = 12
I Try To Use The + But It Calculate Them.

This My Code In Button 1 ( Event Clicked )

const int one = 1;
  int newvalue;
  if (ui->viewlcdnumber->value() == 0)
      newvalue = one + ui->viewlcdnumber->value();
Posted 17-Jan-13 9:25am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Can you simple multiply the old value *10?
newvalue = 10 * ui->viewlcdnumber->value() + 1 ;
Mohibur Rashid 17-Jan-13 21:12pm
string processing would be much simpler

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100