Remove deprecated members from dialog classes

And a few cleanups of out-dated comments and dead code.

Change-Id: I59c6b9129a21b8953626cb63c3ebbf9b6c49a657
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-04-15 16:55:41 +02:00
parent f728429335
commit fe4a5a27e0
10 changed files with 4 additions and 512 deletions

View File

@ -2167,34 +2167,6 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr
return dlg.selectedColor();
}
#if QT_DEPRECATED_SINCE(5, 12)
/*!
\obsolete
Pops up a modal color dialog to allow the user to choose a color
and an alpha channel (transparency) value. The color+alpha is
initially set to \a initial. The dialog is a child of \a parent.
If \a ok is non-null, \e {*ok} is set to true if the user clicked
\uicontrol{OK}, and to false if the user clicked Cancel.
If the user clicks Cancel, the \a initial value is returned.
Use QColorDialog::getColor() instead, passing the
QColorDialog::ShowAlphaChannel option.
*/
QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent)
{
const QColor color = getColor(QColor::fromRgba(initial), parent, QString(),
ShowAlphaChannel);
QRgb result = color.isValid() ? color.rgba() : initial;
if (ok)
*ok = color.isValid();
return result;
}
#endif
/*!
Destroys the color dialog.
*/

View File

@ -92,10 +92,6 @@ public:
const QString &title = QString(),
ColorDialogOptions options = ColorDialogOptions());
#if QT_DEPRECATED_SINCE(5, 12)
QT_DEPRECATED_X("Use getColor()") static QRgb getRgba(QRgb rgba = 0xffffffff, bool *ok = nullptr, QWidget *parent = nullptr);
#endif
static int customCount();
static QColor customColor(int index);
static void setCustomColor(int index, QColor color);

View File

@ -785,12 +785,6 @@ void QDialog::setVisible(bool visible)
return;
QWidget::setVisible(visible);
#if QT_DEPRECATED_SINCE(5, 13)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
showExtension(d->doShowExtension);
QT_WARNING_POP
#endif
QWidget *fw = window()->focusWidget();
if (!fw)
fw = this;
@ -957,153 +951,6 @@ void QDialog::adjustPosition(QWidget* w)
move(p);
}
#if QT_DEPRECATED_SINCE(5, 13)
/*!
\obsolete
If \a orientation is Qt::Horizontal, the extension will be displayed
to the right of the dialog's main area. If \a orientation is
Qt::Vertical, the extension will be displayed below the dialog's main
area.
Instead of using this functionality, we recommend that you simply call
show() or hide() on the part of the dialog that you want to use as an
extension. See the \l{Extension Example} for details.
\sa setExtension()
*/
void QDialog::setOrientation(Qt::Orientation orientation)
{
Q_D(QDialog);
d->orientation = orientation;
}
/*!
\obsolete
Returns the dialog's extension orientation.
Instead of using this functionality, we recommend that you simply call
show() or hide() on the part of the dialog that you want to use as an
extension. See the \l{Extension Example} for details.
\sa extension()
*/
Qt::Orientation QDialog::orientation() const
{
Q_D(const QDialog);
return d->orientation;
}
/*!
\obsolete
Sets the widget, \a extension, to be the dialog's extension,
deleting any previous extension. The dialog takes ownership of the
extension. Note that if \nullptr is passed, any existing extension will be
deleted. This function must only be called while the dialog is hidden.
Instead of using this functionality, we recommend that you simply call
show() or hide() on the part of the dialog that you want to use as an
extension. See the \l{Extension Example} for details.
\sa showExtension(), setOrientation()
*/
void QDialog::setExtension(QWidget* extension)
{
Q_D(QDialog);
delete d->extension;
d->extension = extension;
if (!extension)
return;
if (extension->parentWidget() != this)
extension->setParent(this);
extension->hide();
}
/*!
\obsolete
Returns the dialog's extension or \nullptr if no extension has been
defined.
Instead of using this functionality, we recommend that you simply call
show() or hide() on the part of the dialog that you want to use as an
extension. See the \l{Extension Example} for details.
\sa showExtension(), setOrientation()
*/
QWidget* QDialog::extension() const
{
Q_D(const QDialog);
return d->extension;
}
/*!
\obsolete
If \a showIt is true, the dialog's extension is shown; otherwise the
extension is hidden.
Instead of using this functionality, we recommend that you simply call
show() or hide() on the part of the dialog that you want to use as an
extension. See the \l{Extension Example} for details.
\sa show(), setExtension(), setOrientation()
*/
void QDialog::showExtension(bool showIt)
{
Q_D(QDialog);
d->doShowExtension = showIt;
if (!d->extension)
return;
if (!testAttribute(Qt::WA_WState_Visible))
return;
if (d->extension->isVisible() == showIt)
return;
if (showIt) {
d->size = size();
d->min = minimumSize();
d->max = maximumSize();
if (layout())
layout()->setEnabled(false);
QSize s(d->extension->sizeHint()
.expandedTo(d->extension->minimumSize())
.boundedTo(d->extension->maximumSize()));
if (d->orientation == Qt::Horizontal) {
int h = qMax(height(), s.height());
d->extension->setGeometry(width(), 0, s.width(), h);
setFixedSize(width() + s.width(), h);
} else {
int w = qMax(width(), s.width());
d->extension->setGeometry(0, height(), w, s.height());
setFixedSize(w, height() + s.height());
}
d->extension->show();
#if QT_CONFIG(sizegrip)
const bool sizeGripEnabled = isSizeGripEnabled();
setSizeGripEnabled(false);
d->sizeGripEnabled = sizeGripEnabled;
#endif
} else {
d->extension->hide();
// workaround for CDE window manager that won't shrink with (-1,-1)
setMinimumSize(d->min.expandedTo(QSize(1, 1)));
setMaximumSize(d->max);
resize(d->size);
if (layout())
layout()->setEnabled(true);
#if QT_CONFIG(sizegrip)
setSizeGripEnabled(d->sizeGripEnabled);
#endif
}
}
#endif
/*! \reimp */
QSize QDialog::sizeHint() const
{

View File

@ -69,13 +69,6 @@ public:
void setVisible(bool visible) override;
#if QT_DEPRECATED_SINCE(5, 13)
QT_DEPRECATED_X("Use show/hide on the affected widget instead") void setOrientation(Qt::Orientation orientation);
QT_DEPRECATED_X("Use show/hide on the affected widget instead") Qt::Orientation orientation() const;
QT_DEPRECATED_X("Use show/hide on the affected widget instead") void setExtension(QWidget* extension);
QT_DEPRECATED_X("Use show/hide on the affected widget instead") QWidget* extension() const;
#endif
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
@ -97,10 +90,6 @@ public Q_SLOTS:
virtual void accept();
virtual void reject();
#if QT_DEPRECATED_SINCE(5, 13)
QT_DEPRECATED_X("Use show/hide on the affected widget instead") void showExtension(bool);
#endif
protected:
QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());

View File

@ -1386,31 +1386,6 @@ void QFileDialog::setNameFilter(const QString &filter)
}
#if QT_DEPRECATED_SINCE(5, 13)
/*!
\property QFileDialog::nameFilterDetailsVisible
\obsolete
\brief This property holds whether the filter details is shown or not.
\since 4.4
When this property is \c true (the default), the filter details are shown
in the combo box. When the property is set to false, these are hidden.
Use setOption(HideNameFilterDetails, !\e enabled) or
!testOption(HideNameFilterDetails).
*/
void QFileDialog::setNameFilterDetailsVisible(bool enabled)
{
setOption(HideNameFilterDetails, !enabled);
}
bool QFileDialog::isNameFilterDetailsVisible() const
{
return !testOption(HideNameFilterDetails);
}
#endif
/*
Strip the filters by removing the details, e.g. (*.*).
*/
@ -1898,68 +1873,6 @@ QFileDialog::AcceptMode QFileDialog::acceptMode() const
return static_cast<AcceptMode>(d->options->acceptMode());
}
#if QT_DEPRECATED_SINCE(5, 13)
/*!
\property QFileDialog::readOnly
\obsolete
\brief Whether the filedialog is read-only
If this property is set to false, the file dialog will allow renaming,
and deleting of files and directories and creating directories.
Use setOption(ReadOnly, \e enabled) or testOption(ReadOnly) instead.
*/
void QFileDialog::setReadOnly(bool enabled)
{
setOption(ReadOnly, enabled);
}
bool QFileDialog::isReadOnly() const
{
return testOption(ReadOnly);
}
/*!
\property QFileDialog::resolveSymlinks
\obsolete
\brief whether the filedialog should resolve shortcuts
If this property is set to true, the file dialog will resolve
shortcuts or symbolic links.
Use setOption(DontResolveSymlinks, !\a enabled) or
!testOption(DontResolveSymlinks).
*/
void QFileDialog::setResolveSymlinks(bool enabled)
{
setOption(DontResolveSymlinks, !enabled);
}
bool QFileDialog::resolveSymlinks() const
{
return !testOption(DontResolveSymlinks);
}
/*!
\property QFileDialog::confirmOverwrite
\obsolete
\brief whether the filedialog should ask before accepting a selected file,
when the accept mode is AcceptSave
Use setOption(DontConfirmOverwrite, !\e enabled) or
!testOption(DontConfirmOverwrite) instead.
*/
void QFileDialog::setConfirmOverwrite(bool enabled)
{
setOption(DontConfirmOverwrite, !enabled);
}
bool QFileDialog::confirmOverwrite() const
{
return !testOption(DontConfirmOverwrite);
}
#endif
/*!
\property QFileDialog::defaultSuffix
\brief suffix added to the filename if no other suffix was specified

View File

@ -67,13 +67,6 @@ 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(QString defaultSuffix READ defaultSuffix WRITE setDefaultSuffix)
#if QT_DEPRECATED_SINCE(5, 13)
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE false)
Q_PROPERTY(bool confirmOverwrite READ confirmOverwrite WRITE setConfirmOverwrite DESIGNABLE false)
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)
@ -92,13 +85,10 @@ public:
ShowDirsOnly = 0x00000001,
DontResolveSymlinks = 0x00000002,
DontConfirmOverwrite = 0x00000004,
#if QT_DEPRECATED_SINCE(5, 14)
DontUseSheet Q_DECL_ENUMERATOR_DEPRECATED = 0x00000008,
#endif
DontUseNativeDialog = 0x00000010,
ReadOnly = 0x00000020,
HideNameFilterDetails = 0x00000040,
DontUseCustomDirectoryIcons = 0x00000080
DontUseNativeDialog = 0x00000008,
ReadOnly = 0x00000010,
HideNameFilterDetails = 0x00000020,
DontUseCustomDirectoryIcons = 0x00000040
};
Q_ENUM(Option)
Q_DECLARE_FLAGS(Options, Option)
@ -124,13 +114,6 @@ 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);
QStringList nameFilters() const;
@ -156,29 +139,12 @@ public:
void setAcceptMode(AcceptMode mode);
AcceptMode acceptMode() const;
#if QT_DEPRECATED_SINCE(5, 13)
void setReadOnly(bool enabled);
bool isReadOnly() const;
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;
QByteArray saveState() const;
bool restoreState(const QByteArray &state);
#if QT_DEPRECATED_SINCE(5, 13)
QT_DEPRECATED_X("Use setOption(DontConfirmOverwrite, !enabled) instead")
void setConfirmOverwrite(bool enabled);
QT_DEPRECATED_X("Use !testOption(DontConfirmOverwrite) instead")
bool confirmOverwrite() const;
#endif
void setDefaultSuffix(const QString &suffix);
QString defaultSuffix() const;

View File

@ -1321,42 +1321,6 @@ int QInputDialog::getInt(QWidget *parent, const QString &title, const QString &l
}
}
/*!
\fn int QInputDialog::getInteger(QWidget *parent, const QString &title, const QString &label, int value, int min, int max, int step, bool *ok, Qt::WindowFlags flags)
\deprecated use getInt()
Static convenience function to get an integer input from the user.
\a title is the text which is displayed in the title bar of the dialog.
\a label is the text which is shown to the user (it should say what should
be entered).
\a value is the default integer which the spinbox will be set to.
\a min and \a max are the minimum and maximum values the user may choose.
\a step is the amount by which the values change as the user presses the
arrow buttons to increment or decrement the value.
If \a ok is nonnull *\a ok will be set to true if the user pressed \uicontrol OK
and to false if the user pressed \uicontrol Cancel. The dialog's parent is
\a parent. The dialog will be modal and uses the widget \a flags.
On success, this function returns the integer which has been entered by the
user; on failure, it returns the initial \a value.
Use this static function like this:
\snippet dialogs/standarddialogs/dialog.cpp 0
\sa getText(), getDouble(), getItem(), getMultiLineText()
*/
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_QDOC)
double QInputDialog::getDouble(QWidget *parent, const QString &title, const QString &label,
double value, double min, double max, int decimals, bool *ok,
Qt::WindowFlags flags)
{
return QInputDialog::getDouble(parent, title, label, value, min, max, decimals, ok, flags, 1.0);
}
#endif
/*!
Static convenience function to get a floating point number from the user.

View File

@ -56,7 +56,6 @@ class Q_WIDGETS_EXPORT QInputDialog : public QDialog
{
Q_OBJECT
Q_DECLARE_PRIVATE(QInputDialog)
// Q_ENUMS(InputMode InputDialogOption)
QDOC_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode)
QDOC_PROPERTY(QString labelText READ labelText WRITE setLabelText)
QDOC_PROPERTY(InputDialogOptions options READ options WRITE setOptions)
@ -177,35 +176,15 @@ public:
int minValue = -2147483647, int maxValue = 2147483647,
int step = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) || defined(Q_QDOC)
static double getDouble(QWidget *parent, const QString &title, const QString &label, double value = 0,
double minValue = -2147483647, double maxValue = 2147483647,
int decimals = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags(),
double step = 1);
#else
static double getDouble(QWidget *parent, const QString &title, const QString &label,
double value = 0, double minValue = -2147483647,
double maxValue = 2147483647, int decimals = 1, bool *ok = nullptr,
Qt::WindowFlags flags = Qt::WindowFlags());
static double getDouble(QWidget *parent, const QString &title, const QString &label,
double value, double minValue, double maxValue, int decimals, bool *ok,
Qt::WindowFlags flags, double step);
#endif
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED static inline int getInteger(QWidget *parent, const QString &title, const QString &label, int value = 0,
int minValue = -2147483647, int maxValue = 2147483647,
int step = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags())
{
return getInt(parent, title, label, value, minValue, maxValue, step, ok, flags);
}
#endif
void setDoubleStep(double step);
double doubleStep() const;
Q_SIGNALS:
// ### emit signals!
void textValueChanged(const QString &text);
void textValueSelected(const QString &text);
void intValueChanged(int value);

View File

@ -52,9 +52,6 @@ class DummyDialog : public QDialog
{
public:
DummyDialog(): QDialog() {}
#if QT_DEPRECATED_SINCE(5, 13)
using QDialog::showExtension;
#endif
};
class tst_QDialog : public QObject
@ -66,10 +63,6 @@ public:
private slots:
void cleanup();
void getSetCheck();
#if QT_DEPRECATED_SINCE(5, 13)
void showExtension_data();
void showExtension();
#endif
void defaultButtons();
void showMaximized();
void showMinimized();
@ -80,9 +73,6 @@ private slots:
void deleteInExec();
#if QT_CONFIG(sizegrip)
void showSizeGrip();
#if QT_DEPRECATED_SINCE(5, 13)
void showSizeGrip_deprecated();
#endif
#endif
void setVisible();
void reject();
@ -96,17 +86,6 @@ private slots:
void tst_QDialog::getSetCheck()
{
QDialog obj1;
#if QT_DEPRECATED_SINCE(5, 13)
// QWidget* QDialog::extension()
// void QDialog::setExtension(QWidget*)
QWidget *var1 = new QWidget;
obj1.setExtension(var1);
QCOMPARE(var1, obj1.extension());
obj1.setExtension((QWidget *)0);
QCOMPARE((QWidget *)0, obj1.extension());
// No delete var1, since setExtension takes ownership
#endif
// int QDialog::result()
// void QDialog::setResult(int)
obj1.setResult(0);
@ -155,59 +134,6 @@ void tst_QDialog::cleanup()
QVERIFY(QApplication::topLevelWidgets().isEmpty());
}
#if QT_DEPRECATED_SINCE(5, 13)
void tst_QDialog::showExtension_data()
{
QTest::addColumn<QSize>("dlgSize");
QTest::addColumn<QSize>("extSize");
QTest::addColumn<bool>("horizontal");
QTest::addColumn<QSize>("result");
//next we fill it with data
QTest::newRow( "data0" ) << QSize(200,100) << QSize(50,50) << false << QSize(200,150);
QTest::newRow( "data1" ) << QSize(200,100) << QSize(220,50) << false << QSize(220,150);
QTest::newRow( "data2" ) << QSize(200,100) << QSize(50,50) << true << QSize(250,100);
QTest::newRow( "data3" ) << QSize(200,100) << QSize(50,120) << true << QSize(250,120);
}
void tst_QDialog::showExtension()
{
QFETCH( QSize, dlgSize );
QFETCH( QSize, extSize );
QFETCH( bool, horizontal );
DummyDialog testWidget;
testWidget.resize(200, 200);
testWidget.setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1Char(':')
+ QLatin1String(QTest::currentDataTag()));
testWidget.show();
QVERIFY(QTest::qWaitForWindowExposed(&testWidget));
testWidget.setFixedSize( dlgSize );
QWidget *ext = new QWidget( &testWidget );
ext->setFixedSize( extSize );
testWidget.setExtension( ext );
testWidget.setOrientation( horizontal ? Qt::Horizontal : Qt::Vertical );
QCOMPARE( testWidget.size(), dlgSize );
QPoint oldPosition = testWidget.pos();
// show
testWidget.showExtension( true );
// while ( testWidget->size() == dlgSize )
// qApp->processEvents();
QTEST( testWidget.size(), "result" );
QCOMPARE(testWidget.pos(), oldPosition);
// hide extension. back to old size ?
testWidget.showExtension( false );
QCOMPARE( testWidget.size(), dlgSize );
testWidget.setExtension( 0 );
}
#endif
void tst_QDialog::defaultButtons()
{
@ -434,7 +360,6 @@ void tst_QDialog::deleteInExec()
#if QT_CONFIG(sizegrip)
// From Task 124269
void tst_QDialog::showSizeGrip()
{
QDialog dialog(nullptr);
@ -461,62 +386,6 @@ void tst_QDialog::showSizeGrip()
QVERIFY(!sizeGrip->isVisible());
}
#if QT_DEPRECATED_SINCE(5, 13)
void tst_QDialog::showSizeGrip_deprecated()
{
QDialog dialog(0);
dialog.show();
QWidget *ext = new QWidget(&dialog);
QVERIFY(!dialog.extension());
QVERIFY(!dialog.isSizeGripEnabled());
dialog.setSizeGripEnabled(true);
QPointer<QSizeGrip> sizeGrip = dialog.findChild<QSizeGrip *>();
QVERIFY(sizeGrip);
QVERIFY(sizeGrip->isVisible());
QVERIFY(dialog.isSizeGripEnabled());
dialog.setExtension(ext);
QVERIFY(dialog.extension() && !dialog.extension()->isVisible());
QVERIFY(dialog.isSizeGripEnabled());
// normal show/hide sequence
dialog.showExtension(true);
QVERIFY(dialog.extension() && dialog.extension()->isVisible());
QVERIFY(!dialog.isSizeGripEnabled());
QVERIFY(!sizeGrip);
dialog.showExtension(false);
QVERIFY(dialog.extension() && !dialog.extension()->isVisible());
QVERIFY(dialog.isSizeGripEnabled());
sizeGrip = dialog.findChild<QSizeGrip *>();
QVERIFY(sizeGrip);
QVERIFY(sizeGrip->isVisible());
// show/hide sequence with interleaved size grip update
dialog.showExtension(true);
QVERIFY(dialog.extension() && dialog.extension()->isVisible());
QVERIFY(!dialog.isSizeGripEnabled());
QVERIFY(!sizeGrip);
dialog.setSizeGripEnabled(false);
QVERIFY(!dialog.isSizeGripEnabled());
dialog.showExtension(false);
QVERIFY(dialog.extension() && !dialog.extension()->isVisible());
QVERIFY(!dialog.isSizeGripEnabled());
dialog.setSizeGripEnabled(true);
sizeGrip = dialog.findChild<QSizeGrip *>();
QVERIFY(sizeGrip);
QVERIFY(sizeGrip->isVisible());
sizeGrip->hide();
dialog.hide();
dialog.show();
QVERIFY(!sizeGrip->isVisible());
}
#endif // QT_DEPRECATED_SINCE(5, 13)
#endif // QT_CONFIG(sizegrip)
void tst_QDialog::setVisible()

View File

@ -801,9 +801,6 @@ void tst_QFiledialog::isReadOnly()
QAction* renameAction = fd.findChild<QAction*>("qt_rename_action");
QAction* deleteAction = fd.findChild<QAction*>("qt_delete_action");
#if QT_DEPRECATED_SINCE(5, 13)
QCOMPARE(fd.isReadOnly(), false);
#endif
QCOMPARE(fd.testOption(QFileDialog::ReadOnly), false);
// This is dependent upon the file/dir, find cross platform way to test