I am new to Qt and am having trouble getting the connect-SIGNAL-SLOT mechanism working. When I try to use the valueChanged signal with a QSlider subclass I get the error "No such signal SimpleSlider::valueChanged" on connect. If I try to do similar code with the sliderReleased signal connect returns true but the trace has the error message "QMetaObject::indexOfSignal: signal sliderReleased() from QSlider redefined in SimpleSlider" and my SLOT function never gets called. Below is my code. Please help.

Qt Code:
  1. #ifndef SIMPLESLIDER_H
  2. #define SIMPLESLIDER_H
  3.  
  4. #include <QtGui>
  5. #include "ui_simpleslider.h"
  6.  
  7. class SimpleSlider : public QSlider
  8. {
  9. Q_OBJECT
  10.  
  11. public:
  12. SimpleSlider(Qt::Orientation orientation, QWidget *parent = 0);
  13. ~SimpleSlider();
  14.  
  15. signals:
  16. void valueChanged(int value);
  17. void sliderReleased();
  18.  
  19. private slots:
  20. void valueHasChanged();
  21.  
  22. private:
  23.  
  24. };
  25.  
  26. #endif // SIMPLESLIDER_H
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include "simpleslider.h"
  2.  
  3. SimpleSlider::SimpleSlider(Qt::Orientation orientation, QWidget *parent)
  4. : QSlider(orientation, parent)
  5. {
  6. bool retval = connect(this, SIGNAL(valueChanged(int value)), this, SLOT(valueHasChanged()));
  7. retval = connect(this, SIGNAL(sliderReleased()), this, SLOT(valueHasChanged()));
  8. }
  9.  
  10. SimpleSlider::~SimpleSlider()
  11. {
  12.  
  13. }
  14.  
  15. void SimpleSlider::valueHasChanged()
  16. {
  17. QMessageBox::information(this, "SimpleSlider", "Value has Changed");
  18. }
To copy to clipboard, switch view to plain text mode