sunil.thaha
22nd February 2007, 10:38
Hi,
Does anyone know why this simple class exihits a wierd behavior ?
class Test : public QAbstractSpinBox {
Q_OBJECT
public:
Test( QWidget *parent =0 )
:QAbstractSpinBox(parent){
lineEdit()->setText( "Hello " );
}
void setText( const QString &txt){
lineEdit()->setText( txt );
}
};
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
Test t;
t.show();
Now I tried this, note that the setText() call after the show works, but not before it ?
Test t;
t.setText( "Before show"); // Will not work, to test it comment the setText below show
t.show();
t.setText( "Hi Hi "); // Calls to setText works after show ??
Any clue why this happens?
Does anyone know why this simple class exihits a wierd behavior ?
class Test : public QAbstractSpinBox {
Q_OBJECT
public:
Test( QWidget *parent =0 )
:QAbstractSpinBox(parent){
lineEdit()->setText( "Hello " );
}
void setText( const QString &txt){
lineEdit()->setText( txt );
}
};
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
Test t;
t.show();
Now I tried this, note that the setText() call after the show works, but not before it ?
Test t;
t.setText( "Before show"); // Will not work, to test it comment the setText below show
t.show();
t.setText( "Hi Hi "); // Calls to setText works after show ??
Any clue why this happens?