Home Ask Login Register

Developers Planet

Your answer is one click away!

FrozenHeart February 2016

Why should I have to specify a parent for the QFileDialog

Why should I have to specify a parent for the QFileDialog?

const QString& file_name = QFileDialog::getSaveFileName(
    0, // this
    "Export",
    QDir::currentPath(),
    "Excel files (*.xlsx)"
);

What's the point? Can I just set it to 0?

Answers


Vladimir Bershov February 2016

Yes, you can set it to 0.
QFileDialog inherits QDialog. From Qt 5 QDialog documentation:

...A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent...

update: An important addition is in the first comment.

Post Status

Asked in February 2016
Viewed 1,110 times
Voted 7
Answered 1 times

Search




Leave an answer


Quote of the day: live life