Click here to Skip to main content
13,398,400 members (36,685 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 |
Web03 | 2.8.180216.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2018
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