QtWidgets: mark QDialog/QFileDialog functions as deprecated
Mark some long obsolete functions as deprecated so the can be removed with Qt6: - QDialog::setOrientation()/orientation() - QDialog::setExtension()/extension()/showExtension() - QFileDialog::setNameFilterDetailsVisible()/isNameFilterDetailsVisible() - QFileDialog::setResolveSymlinks()/resolveSymlinks() Change-Id: Ibbd5b4192ea8ab483d6b2a8dbf9879f29f9ee86d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
d6d33f0b80
commit
edc455c69b
@ -946,6 +946,7 @@ void QDialog::adjustPosition(QWidget* w)
|
||||
move(p);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
@ -1090,7 +1091,7 @@ void QDialog::showExtension(bool showIt)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*! \reimp */
|
||||
QSize QDialog::sizeHint() const
|
||||
|
@ -69,11 +69,12 @@ public:
|
||||
|
||||
void setVisible(bool visible) override;
|
||||
|
||||
void setOrientation(Qt::Orientation orientation);
|
||||
Qt::Orientation orientation() const;
|
||||
|
||||
void setExtension(QWidget* extension);
|
||||
QWidget* extension() const;
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED void setOrientation(Qt::Orientation orientation);
|
||||
QT_DEPRECATED Qt::Orientation orientation() const;
|
||||
QT_DEPRECATED void setExtension(QWidget* extension);
|
||||
QT_DEPRECATED QWidget* extension() const;
|
||||
#endif
|
||||
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
@ -96,7 +97,9 @@ public Q_SLOTS:
|
||||
virtual void accept();
|
||||
virtual void reject();
|
||||
|
||||
void showExtension(bool);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED void showExtension(bool);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
|
@ -1359,6 +1359,7 @@ void QFileDialog::setNameFilter(const QString &filter)
|
||||
}
|
||||
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\property QFileDialog::nameFilterDetailsVisible
|
||||
\obsolete
|
||||
@ -1380,6 +1381,7 @@ bool QFileDialog::isNameFilterDetailsVisible() const
|
||||
{
|
||||
return !testOption(HideNameFilterDetails);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@ -1879,6 +1881,7 @@ bool QFileDialog::isReadOnly() const
|
||||
return testOption(ReadOnly);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\property QFileDialog::resolveSymlinks
|
||||
\obsolete
|
||||
@ -1899,6 +1902,7 @@ bool QFileDialog::resolveSymlinks() const
|
||||
{
|
||||
return !testOption(DontResolveSymlinks);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\property QFileDialog::confirmOverwrite
|
||||
|
@ -65,11 +65,13 @@ class Q_WIDGETS_EXPORT QFileDialog : public QDialog
|
||||
Q_PROPERTY(FileMode fileMode READ fileMode WRITE setFileMode)
|
||||
Q_PROPERTY(AcceptMode acceptMode READ acceptMode WRITE setAcceptMode)
|
||||
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE false)
|
||||
Q_PROPERTY(bool resolveSymlinks READ resolveSymlinks WRITE setResolveSymlinks DESIGNABLE false)
|
||||
Q_PROPERTY(bool confirmOverwrite READ confirmOverwrite WRITE setConfirmOverwrite DESIGNABLE false)
|
||||
Q_PROPERTY(QString defaultSuffix READ defaultSuffix WRITE setDefaultSuffix)
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
Q_PROPERTY(bool resolveSymlinks READ resolveSymlinks WRITE setResolveSymlinks DESIGNABLE false)
|
||||
Q_PROPERTY(bool nameFilterDetailsVisible READ isNameFilterDetailsVisible
|
||||
WRITE setNameFilterDetailsVisible DESIGNABLE false)
|
||||
#endif
|
||||
Q_PROPERTY(Options options READ options WRITE setOptions)
|
||||
Q_PROPERTY(QStringList supportedSchemes READ supportedSchemes WRITE setSupportedSchemes)
|
||||
|
||||
@ -117,8 +119,12 @@ public:
|
||||
void selectUrl(const QUrl &url);
|
||||
QList<QUrl> selectedUrls() const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use setOption(HideNameFilterDetails, !enabled) instead")
|
||||
void setNameFilterDetailsVisible(bool enabled);
|
||||
QT_DEPRECATED_X("Use !testOption(HideNameFilterDetails) instead")
|
||||
bool isNameFilterDetailsVisible() const;
|
||||
#endif
|
||||
|
||||
void setNameFilter(const QString &filter);
|
||||
void setNameFilters(const QStringList &filters);
|
||||
@ -148,8 +154,12 @@ public:
|
||||
void setReadOnly(bool enabled);
|
||||
bool isReadOnly() const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use setOption(DontResolveSymlinks, !enabled) instead")
|
||||
void setResolveSymlinks(bool enabled);
|
||||
QT_DEPRECATED_X("Use !testOption(DontResolveSymlinks) instead")
|
||||
bool resolveSymlinks() const;
|
||||
#endif
|
||||
|
||||
void setSidebarUrls(const QList<QUrl> &urls);
|
||||
QList<QUrl> sidebarUrls() const;
|
||||
|
@ -854,9 +854,9 @@ void tst_QFiledialog::resolveSymlinks()
|
||||
|
||||
// default
|
||||
QCOMPARE(fd.resolveSymlinks(), true);
|
||||
fd.setResolveSymlinks(false);
|
||||
fd.setOption(QFileDialog::DontResolveSymlinks, true);
|
||||
QCOMPARE(fd.resolveSymlinks(), false);
|
||||
fd.setResolveSymlinks(true);
|
||||
fd.setOption(QFileDialog::DontResolveSymlinks, false);
|
||||
QCOMPARE(fd.resolveSymlinks(), true);
|
||||
|
||||
// the file dialog doesn't do anything based upon this, just passes it to the model
|
||||
@ -1119,7 +1119,7 @@ void tst_QFiledialog::setNameFilter()
|
||||
|
||||
QFileDialog fd;
|
||||
fd.setNameFilters(filters);
|
||||
fd.setNameFilterDetailsVisible(nameFilterDetailsVisible);
|
||||
fd.setOption(QFileDialog::HideNameFilterDetails, !nameFilterDetailsVisible);
|
||||
fd.selectNameFilter(selectFilter);
|
||||
QCOMPARE(fd.selectedNameFilter(), expectedSelectedFilter);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ void tst_QFileDialog2::showNameFilterDetails()
|
||||
QFileDialog fd;
|
||||
QComboBox *filters = fd.findChild<QComboBox*>("fileTypeCombo");
|
||||
QVERIFY(filters);
|
||||
QVERIFY(fd.isNameFilterDetailsVisible());
|
||||
QVERIFY(!fd.testOption(QFileDialog::HideNameFilterDetails));
|
||||
|
||||
|
||||
QStringList filterChoices;
|
||||
@ -261,12 +261,12 @@ void tst_QFileDialog2::showNameFilterDetails()
|
||||
<< "Any files (*.*)";
|
||||
fd.setNameFilters(filterChoices);
|
||||
|
||||
fd.setNameFilterDetailsVisible(false);
|
||||
fd.setOption(QFileDialog::HideNameFilterDetails, true);
|
||||
QCOMPARE(filters->itemText(0), QString("Image files"));
|
||||
QCOMPARE(filters->itemText(1), QString("Text files"));
|
||||
QCOMPARE(filters->itemText(2), QString("Any files"));
|
||||
|
||||
fd.setNameFilterDetailsVisible(true);
|
||||
fd.setOption(QFileDialog::HideNameFilterDetails, false);
|
||||
QCOMPARE(filters->itemText(0), filterChoices.at(0));
|
||||
QCOMPARE(filters->itemText(1), filterChoices.at(1));
|
||||
QCOMPARE(filters->itemText(2), filterChoices.at(2));
|
||||
|
@ -439,7 +439,7 @@ void FileDialogPanel::restoreDefaults()
|
||||
m_showDirsOnly->setChecked(d.testOption(QFileDialog::ShowDirsOnly));
|
||||
m_allowedSchemes->setText(QString());
|
||||
m_confirmOverWrite->setChecked(d.confirmOverwrite());
|
||||
m_nameFilterDetailsVisible->setChecked(d.isNameFilterDetailsVisible());
|
||||
m_nameFilterDetailsVisible->setChecked(!d.testOption(QFileDialog::HideNameFilterDetails));
|
||||
m_resolveSymLinks->setChecked(d.resolveSymlinks());
|
||||
m_readOnly->setChecked(d.isReadOnly());
|
||||
m_native->setChecked(true);
|
||||
|
Loading…
Reference in New Issue
Block a user