質問

私はモーダルのQdialogを持っています。ボタンをクリックすると、その下から程度の子供Qdialogをスライドさせます。私が抱えている問題は、アニメーション中に子供が親の上にとどまることです。

親と重複する子供の部分にマスクを塗ることで逃げることができると思いますが、子供を親の下に置くだけのより明白な方法が欠けているように感じます。

QT 4.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);
}

前もって感謝します。

役に立ちましたか?

解決

子供ウィジェットは常に親の上にレンダリングされているため、探している影響を直接達成するためには、その関係を破らなければなりません。次に、両方のダイアログが同じ親を持っていた場合、raigh()またはlower()を使用できます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top