QDialog ベースのクラスによってスロットが呼び出されたとします。
他の場所でダイアログを作成します。
MyDialog *dlg = new MyDialog (this);
connect (dlg , SIGNAL(valueSet(QString)) , SLOT(slotGetValue(QString)));
dlg->exec ();
そして、スロットで、QObject である「最も深い」親クラスの削除を使用して、オブジェクトを削除します。
void slotGetValue (const QString & key)
{
// process the value we retrieved
// now delete the dialog created
sender()->deletLater ();
}
それはこれを行う正しい方法ですか?それは安全ですか?