qt - How to hide a QWidget under its parent? -
i have modal qdialog, on click of button slides modeless child qdialog out underneath it. problem have child stays on top of parent during animation.
i think away applying mask on portion of child overlaps parent, feels i'm missing more obvious way of placing child under parent.
i'm using qt 4.5. here's sample code:
void mainwindow::on_mymenu_triggered() { parentdlg = new qdialog(this); parentdlg->setfixedsize(250, 250); parentdlg->setmodal(true); parentdlg->show(); childdlg = new qdialog(parentdlg); childdlg->setfixedsize(150, 150); childdlg->show(); qtimeline* timeline = new qtimeline(1000, this); connect(timeline, signal(valuechanged(qreal)), this, slot(childdlgstepchanged(qreal))); timeline->start(); } void mainwindow::childdlgstepchanged(qreal) { int parentx = parentdlg->framegeometry().x(); int parenty = parentdlg->geometry().y(); // move child dialog left of parent. childdlg->move(parentx - 150 * step, parenty); }
thanks in advance.
child widgets rendered on parent have break relationship in order achieve affect looking directly. use raise() or lower() if both dialogs had same parent.
Comments
Post a Comment