Kery
Kery

Reputation: 523

Do I understand the meaning of "take ownership" correctly in QT?

"Any existing proxy model will be removed, but not deleted. The file dialog will take ownership of the proxyModel."

This is from QT (5.4.0) document regarding the following method

QFileDialog::​setProxyModel(QAbstractProxyModel * proxyModel)

Here, "take ownership of the proxyModel", my understanding is that I don't need to delete the proxyModel, QFileDialog instance will delete it instead. Am I right?

After my testing I find that QFileDialog instance will not delete proxyModel if it is not the parent of proxyModel. So, I'm a little confused by the document. Maybe this is an error in the document, but I'm not sure.

Upvotes: 1

Views: 174

Answers (1)

Kery
Kery

Reputation: 523

The root cause has been found, i.e. setProxyModel only works when QFileDialog::DontUseNativeDialog is set.

Upvotes: 3

Related Questions