Hello,
I've noticed that I my widgets will only get shown when I create them at the initialisation of the class(in the constructor, or functions that were (indirectly) called by the constructor. If they're created later, they are(for some strange reason) not shown.
To show what I mean:
Qt Code:
  1. class Myclass : public QWidget {
  2. Q_OBJECT
  3. public: Myclass(QWidget *parent=0, const char *name=0); QPushButton *but1, *but2;
  4. protected slots: void createbutton()
  5. };
  6.  
  7. Myclass::Myclass(QWidget *parent, const char *name) : public QWidget(parent, name) {
  8. but1 = new QPushButton("click to add button", this);
  9. connect(but1, SIGNAL(clicked()), this SLOT(createbutton()));
  10. }
  11. void Myclass::createbutton() {
  12. but2 = new QPushButton("but2", this); // Will not be shown
  13. }
To copy to clipboard, switch view to plain text mode 
I'm currently creating a dialog, using QPtrList, but I can't add widgets to QPtrList at initialization, because I get the information needed to create the widgets after i'm logged in, and that results in the widgets not being shown. However, when I add some widgets(just to test it) in the constructor, it does show them.
My question is: Is there someway to add the widgets later and still show them(maybe by adding those widgets manually to a QObject list?)?
Thanx in advance,
Hylke