Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, December 2006
QStackedWidget problem


Message 1 in thread

Hi,

I use a QStackedWidget as child of a QWorkspace:

  QMainWindow* window = new QMainWindow;
  QWorkspace* workspace = new QWorkspace;
  window->setCentralWidget(workspace);

  QStackedWidget* sw = new QStackedWidget;
  sw->addWidget(new QLabel);
  workspace->addWindow(sw);

Then I change the stack's current widget:

  sw->addWidget(w);
  sw->setCurrentWidget(w);

The MDI window displays the new widget, but it is not resized to the
size of the new child widget. E.g. if the first widget in there is a
QLabel with one line of text, and I replace this with a QLabel with two
lines ("hello\nworld"), only the first line is visible.

As soon as I touch the resize handle of the MDI window, it naps to the
correct size. But I'm unable to set the correct size programmatically...
So does anyone have a hint how I can solve this problem? I hope I
managed to describe it in an understandable manner.

Best,
M

--
 [ signature omitted ]