Hi,

Does anyone know why this simple class exihits a wierd behavior ?

Qt Code:
  1. class Test : public QAbstractSpinBox {
  2. Q_OBJECT
  3. public:
  4. Test( QWidget *parent =0 )
  5. :QAbstractSpinBox(parent){
  6. lineEdit()->setText( "Hello " );
  7. }
  8.  
  9. void setText( const QString &txt){
  10. lineEdit()->setText( txt );
  11. }
  12. };
To copy to clipboard, switch view to plain text mode 
I have subclassed a QAbstractSpinBox and in the constructor I have set the SpinBox's lineedit's text to "Hello" So In the code below I expect to see the text "Hello " inside the LineEdit but It remains blank

Qt Code:
  1. Test t;
  2. t.show();
To copy to clipboard, switch view to plain text mode 



Now I tried this, note that the setText() call after the show works, but not before it ?
Qt Code:
  1. Test t;
  2. t.setText( "Before show"); // Will not work, to test it comment the setText below show
  3. t.show();
  4. t.setText( "Hi Hi "); // Calls to setText works after show ??
To copy to clipboard, switch view to plain text mode 

Any clue why this happens?