PDA

View Full Version : StackedWidget overlapped



manucorrales
14th July 2006, 20:19
Hi, i am using a StackedWidget like this:


clientes = new DialogListaClientes();
articulos = new DialogListaArticulos();
facturas = new DialogListaFacturas();
stackedWidget->addWidget(articulos);
stackedWidget->addWidget(facturas);
stackedWidget->addWidget(clientes);
stackedWidget->setCurrentWidget(clientes);



Now whe i run the app, the three widgets are overlappedd, i mean there are the three visible. That is not correct, only one widget should be showed at time, right?

How can i fix this??

jpn
14th July 2006, 20:55
Now whe i run the app, the three widgets are overlappedd, i mean there are the three visible. That is not correct, only one widget should be showed at time, right?

How can i fix this??
Yes, there should be only one widget visible at time. Does it make any difference if you construct the widgets with the stacked widget as parent? Which exact version of Qt 4 is this, maybe time to update to the latest..?

manucorrales
14th July 2006, 20:59
What do you mean by "construct the widgets with the stacked widget as parent"?

I am using qt 4.1.4. I believe is the latest, but i am waiting for 4.2 to be stable for using it.

Thanks for your answer.

jpn
14th July 2006, 21:12
Ok, good. It's the latest.

I meant something like this:


clientes = new DialogListaClientes(stackedWidget);


But now after a tiny moment of thinking, I doubt that's the problem. What kind of widgets are these DialogLista*? Do they derive from QDialog? If so, I'm pretty sure that causes the problem.

manucorrales
14th July 2006, 21:16
Yep, there are QDialog subclasses. The strange thing is that use to work on previous versions of Qt.

Anyway, I can change and subclass of QWidget, right? What do you recommend?

Thanks.

jpn
14th July 2006, 21:18
Yeah, anything else than QDialog should do the trick. QDialog is a special widget whose behaviour differs from other widgets:

Note that QDialog uses the parent widget slightly differently from other classes in Qt. A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent's top-level widget (if it is not top-level itself). It will also share the parent's taskbar entry.