]> git.lyx.org Git - features.git/commitdiff
Fix Qt deprecation warn for setConfirmOverwrite()
authorScott Kostyshak <skostysh@lyx.org>
Fri, 6 Mar 2020 14:18:59 +0000 (09:18 -0500)
committerScott Kostyshak <skostysh@lyx.org>
Fri, 6 Mar 2020 14:56:01 +0000 (09:56 -0500)
Fix the following warning:

  error: ‘void QFileDialog::setConfirmOverwrite(bool)’ is deprecated: Use setOption(DontConfirmOverwrite, !enabled) instead [-Werror=deprecated-declarations]

Note in the change that "false" changes to "true" because the option
is *Dont*ConfirmOverwrite.

QFileDialog::setConfirmOverwrite() is obsolete at least since 4.8
and QFileDialog::setOption() is available since 4.5 [1].

[1] https://doc.qt.io/archives/qt-4.8/qfiledialog-obsolete.html
[2] https://doc.qt.io/qt-5/qfiledialog.html#setOption

src/frontends/qt/FileDialog.cpp

index f4bc5fd385528ea43a23cd66813ca605ebe04790..fb05f43e557c712ff22a76b0527ed63173fd3d3c 100644 (file)
@@ -102,7 +102,7 @@ FileDialog::Result FileDialog::save(QString const & path,
                LyXFileDialog dlg(title_, path, filters, private_->b1, private_->b2);
                dlg.setFileMode(QFileDialog::AnyFile);
                dlg.setAcceptMode(QFileDialog::AcceptSave);
-               dlg.setConfirmOverwrite(false);
+               dlg.setOption(QFileDialog::DontConfirmOverwrite, true);
                if (selectedFilter != 0 && !selectedFilter->isEmpty())
                        dlg.selectNameFilter(*selectedFilter);