From 5e83a2eed2dc42a732bd9154bebe8dcb34cd6bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Wed, 12 Feb 2020 11:14:50 +0100 Subject: Deprecate one overload of QInputDialog::getDouble() for 5.15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...and merge the two overloads of getDouble() in Qt6 Change-Id: I55faa2ff222b41e48889a0ef14dd00a6da691c36 Reviewed-by: Tor Arne Vestbø --- src/widgets/dialogs/qinputdialog.cpp | 3 ++- src/widgets/dialogs/qinputdialog.h | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp index 1cb4be0682..eeb0613d79 100644 --- a/src/widgets/dialogs/qinputdialog.cpp +++ b/src/widgets/dialogs/qinputdialog.cpp @@ -1349,6 +1349,7 @@ int QInputDialog::getInt(QWidget *parent, const QString &title, const QString &l \sa getText(), getDouble(), getItem(), getMultiLineText() */ +#if QT_DEPRECATED_SINCE(5, 15) /*! Static convenience function to get a floating point number from the user. @@ -1380,7 +1381,7 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr { return QInputDialog::getDouble(parent, title, label, value, min, max, decimals, ok, flags, 1.0); } - +#endif /*! \overload Static convenience function to get a floating point number from the user. diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h index c3a5e59d53..ca893172f9 100644 --- a/src/widgets/dialogs/qinputdialog.h +++ b/src/widgets/dialogs/qinputdialog.h @@ -176,13 +176,24 @@ public: static int getInt(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()); + +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("This overload is deprecated. Use the overload that takes step as a final argument") 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()); +#endif +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + 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 // ### Qt 6: merge overloads 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, -- cgit v1.2.3