Hi,
Does anyone know why this simple class exihits a wierd behavior ?
Q_OBJECT
public:
lineEdit()->setText( "Hello " );
}
lineEdit()->setText( txt );
}
};
class Test : public QAbstractSpinBox {
Q_OBJECT
public:
Test( QWidget *parent =0 )
:QAbstractSpinBox(parent){
lineEdit()->setText( "Hello " );
}
void setText( const QString &txt){
lineEdit()->setText( txt );
}
};
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
Test t;
t.show();
Test t;
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 ?
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 ??
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 ??
To copy to clipboard, switch view to plain text mode
Any clue why this happens?
Bookmarks