Results 1 to 4 of 4

Thread: Slider not responding to Signal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Location
    My bed
    Posts
    21
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Slider not responding to Signal

    I made a program that converts celsius to fahrenheit and vice versa. It consists of two sliders: sl_celsius: and sl_fheit, and two lcd displays lcd_celsius and lcd_fheit.
    Moving sl_celsius displays the celsius temperature in lcd_celsius and the corresponding fahrenheit temperature in lcd_fheit. As the lcd_fheit changes, the sl_fheit also moves.
    The problem is that the reverse does not occur (i.e. moving the fahrenheit slider does not cause celsius to be displayed in lcd_celsius and sl_celsius does not move either). I do not understand why this happens.

    The connections are as follows:
    Qt Code:
    1. connect(ui->sl_celsius,SIGNAL(sliderMoved(int)),ui->lcd_celsius,SLOT(display(int)));
    2.  
    3. connect(ui->sl_celsius,SIGNAL(sliderMoved(int)),this,SLOT(calculateFahrenheitTemperature(int)));
    4.  
    5. connect(this,SIGNAL(celsiusSliderMoved(int)),ui->lcd_fheit,SLOT(display(int)));
    6.  
    7. connect(this,SIGNAL(celsiusSliderMoved(int)),ui->sl_fheit,SLOT(setValue(int)));
    8.  
    9. connect(ui->sl_fheit,SIGNAL(sliderMoved(int)),ui->lcd_fheit,SLOT(display(int)));
    10.  
    11. connect(ui->sl_fheit,SIGNAL(sliderMoved(int)),this,SLOT(calculateCelsiusTemperature(int)));
    12.  
    13. connect(this,SIGNAL(fheitSliderMoved(int)),ui->lcd_celsius,SLOT(display(int)));
    14.  
    15. connect(this,SIGNAL(fheitSliderMoved(int)),ui->sl_celsius,SLOT(setValue(int)));
    To copy to clipboard, switch view to plain text mode 

    and these are the definitions for custom fucntions:
    Qt Code:
    1. void TempConverter::calculateCelsiusTemperature(int temp)
    2. {
    3. celsius = (temp - 32)*(5/9);
    4. emit fheitSliderMoved(celsius);
    5. }
    6.  
    7. void TempConverter::calculateFahrenheitTemperature(int temp)
    8. {
    9. fahrenheit = ((temp * (9/5))+32);
    10. emit celsiusSliderMoved(fahrenheit);
    11. }
    To copy to clipboard, switch view to plain text mode 

    I'd appreciate any help, thanks!
    Last edited by eLancaster; 25th December 2010 at 16:38.

Similar Threads

  1. USB Keyboard is not responding in qt-embedded-4.4.3
    By grsandeep85 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 7th April 2011, 03:13
  2. Designer not responding to mouse
    By brtip in forum Newbie
    Replies: 0
    Last Post: 28th July 2010, 05:09
  3. Replies: 2
    Last Post: 21st March 2010, 09:01
  4. QGraphicsTextItem Linkactivated not responding
    By Pancho in forum Qt Programming
    Replies: 1
    Last Post: 2nd December 2009, 22:39
  5. Window not responding
    By markcole in forum Qt Programming
    Replies: 10
    Last Post: 18th April 2007, 21:53

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.