0

次のコードを使用して、メイン ウィンドウ内で filedialog を呼び出しました。

QAction *actionWithShortcut = new QAction();
actionWithShortcut->setShortcut(Qt::CTRL + Qt::Key_9);
actionWithShortcut->setShortcutContext(Qt::ShortcutContext::WidgetWithChildrenShortcut);
// added this comment to check does it work at list outside filedialog
// addAction(actionWithShortcut);
QFileDialog *fd = new QFileDialog(this);
fd->addAction(actionWithShortcut);
connect(actionWithShortcut, &QAction::triggered, fd, &QFileDialog::reject);
fd->show();

しかし、アクションを追加できないQFileDialogか、どういうわけか省略されているようです。助言がありますか?すでにウィンドウ フラグ、オプションなどを試しましたが、解決策が見つかりません。

4

1 に答える 1