ボタンをクリックすると、モードレスの子 QDialog がその下からスライドします。私が抱えている問題は、アニメーション中に子が親の上にとどまることです。
親と重なっている子の部分にマスクを適用することで回避できると思いますが、子を親の下に配置するだけのより明白な方法が欠けているように感じます。
Qt4.5を使用しています。サンプルコードは次のとおりです。
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 the child dialog to the left of its parent.
childDlg->move(parentX - 150 * step, parentY);
}
前もって感謝します。