I am trying to create a custom widget by reimplementing QSpingBox. The reason that I (think I) need to reimplement QSpinBox is because my values are floats not integers. So I need the spinbox to work with numbers between 1.61 and 4.0 and looking at the documentation for QSpinBox I need to reimplement mapValueToText and mapTextToValue to do this. Note this is not a plugin custom widget. Also I am using QT 3.3.4 at this time.

Here is my header file:
Qt Code:
  1. #include "qspinbox.h"
  2.  
  3. class GammaSpinBox: public QSpinBox {
  4.  
  5. Q_OBJECT
  6.  
  7. public:
  8.  
  9. GammaSpinBox(QWidget * parent = 0, const char * name = 0 );
  10.  
  11. QString mapValueToText( int value );
  12.  
  13. int mapTextToValue( bool *ok );
  14.  
  15. };
To copy to clipboard, switch view to plain text mode 

and here is my iplementation:

Qt Code:
  1. #include "gammaspinbox.h"
  2.  
  3. class GammaSpinBox : public QSpinBox
  4. {
  5. Q_OBJECT
  6. public:
  7.  
  8. GammaSpinBox(QWidget * parent = 0, const char * name = 0 ) : QSpinBox(161, 400, 1, parent, name)
  9. {
  10. }
  11.  
  12. QString mapValueToText( int value )
  13. {
  14.  
  15. return QString( "%1.%2" ) // 1.61 to 4.00
  16. .arg( value / 100 ).arg( value % 100 );
  17. }
  18.  
  19. int mapTextToValue( bool *ok )
  20. {
  21.  
  22. return (int) ( 100 * text().toFloat() );
  23. }
  24. };
To copy to clipboard, switch view to plain text mode 

When I try to build my app with one of these widgets placed in a dialog in designer I get the following error messages:

Qt Code:
  1. build/linux/gammaqt/uic_setgammabase.cc: In constructor `SetGammaBase::SetGammaBase(QWidget*, const char*, bool, uint)':
  2. build/linux/gammaqt/uic_setgammabase.cc:2459: error: invalid use of undefined type `struct GammaSpinBox'
  3. ....
  4. build/linux/gammaqt/setgammabase.h:21: error: forward declaration of `struct GammaSpinBox'
To copy to clipboard, switch view to plain text mode 

The ui file is setgammabase.ui and line 21 of setgammabase.h is:

class GammaSpinBox;

Line 2459 in uic_setgammabase.cc is:

GammaR = new GammaSpinBox( ButtonGroup4_2, "GammaR" );

It is probably something real basic that I am doing wrong but I can't see what it is. Any ideas?