Results 1 to 15 of 15

Thread: Getting the value from a spinbox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Location
    Athens, Greece
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Smile Re: Getting the value from a spinbox

    Right on, JPN, about my mistake on the local/member variables - that is now corrected.

    So, I am now using:

    Qt Code:
    1. void Window::calculate()
    2. {
    3. int valJ1 = valueSpinBoxJ1->value();
    4. int valJ2 = valueSpinBoxJ2->value();
    5. int X = valJ1+valJ2;
    6. lcd3->display(X);
    7. qDebug("X = %.4f",X);
    8. }
    To copy to clipboard, switch view to plain text mode 

    lcd3 is working (obviously), but I still get consecutively "X=0.0000". My worry is that if I need to use X somewhere else, it will not be there with the correct value - how should I deal with that?

    Thanks for your help so far though!

    X-man

  2. #2
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Thanks
    43
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Getting the value from a spinbox

    whatup X-

    try:

    Qt Code:
    1. qDebug("X = %d",X);
    To copy to clipboard, switch view to plain text mode 

    your "X" variable is an int

  3. The following user says thank you to vonCZ for this useful post:

    X-man (28th September 2007)

  4. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Getting the value from a spinbox

    With
    Qt Code:
    1. qDebug() << X;
    To copy to clipboard, switch view to plain text mode 
    there would be no such problem..
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    X-man (28th September 2007)

  6. #4
    Join Date
    May 2007
    Location
    Athens, Greece
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Smile Re: Getting the value from a spinbox

    You are both right - i accidentally fixed when I turner all the v's to floats. So now everything works like a charm...

    ...till everything stops working again.

    Thanks for your replies, (unfortunately) I will get back with more questions

    X-man

Similar Threads

  1. spinbox
    By mickey in forum Newbie
    Replies: 5
    Last Post: 26th July 2006, 19:09
  2. spinbox
    By mickey in forum Newbie
    Replies: 2
    Last Post: 22nd May 2006, 08:35
  3. buttonGroup and spinBox
    By mickey in forum Newbie
    Replies: 9
    Last Post: 21st May 2006, 17:50
  4. problem with spinbox control ?
    By vinod in forum Qt Programming
    Replies: 3
    Last Post: 19th April 2006, 19:58
  5. a simple question: spinbox
    By mickey in forum Newbie
    Replies: 3
    Last Post: 27th February 2006, 15:37

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.