質問

I have an app that uses a 3rd party GUI framework, but I want to open files with using QFileDialog. I'm thinking of instantiating a subclass of QWidget that is invisible and serves the purpose of serving up the dialog.

Is there a better way to do this?

役に立ちましたか?

解決

I don't see any need for an invisible widget, since the file dialog doesn't require a a parent widget in order to be shown up.

Since the dialog needs to have a Qt event loop running, you will need to either show the dialog modally using exec(), or using one of the static functions like getOpenFileName.

To use any of the widget classes, including the file dialog, you need to have an instance of QApplication, although that instance doesn't have to have its exec() method called.

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