QtCore: mark obsolete functions as deprecated

Mark the following obsolete functions as deprecated so they can be
removed with Qt6:
 - QDataStream::unsetDevice()
 - QDir &QDir::operator=(const QString &path)
 - QDir::addResourceSearchPath()
 - QResource::addSearchPath()
 - QResource::searchPaths()
 - QSettings::setSystemIniPath()
 - QSettings::setUserIniPath()

Change-Id: I5edfb2b4ce1ad843fa5fcd5b4c475ab9352b05f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Christian Ehrlicher 2019-01-20 21:25:20 +01:00
parent 612e4c5233
commit 770b4afeed
8 changed files with 31 additions and 6 deletions

View File

@ -1060,6 +1060,7 @@ void QDir::setNameFilters(const QStringList &nameFilters)
d->nameFilters = nameFilters; d->nameFilters = nameFilters;
} }
#if QT_DEPRECATED_SINCE(5, 13)
/*! /*!
\obsolete \obsolete
@ -1079,6 +1080,7 @@ void QDir::addResourceSearchPath(const QString &path)
Q_UNUSED(path) Q_UNUSED(path)
#endif #endif
} }
#endif
#ifdef QT_BUILD_CORE_LIB #ifdef QT_BUILD_CORE_LIB
/*! /*!
@ -1806,6 +1808,7 @@ QDir &QDir::operator=(const QDir &dir)
return *this; return *this;
} }
#if QT_DEPRECATED_SINCE(5, 13)
/*! /*!
\overload \overload
\obsolete \obsolete
@ -1819,6 +1822,7 @@ QDir &QDir::operator=(const QString &path)
d_ptr->setPath(path); d_ptr->setPath(path);
return *this; return *this;
} }
#endif
/*! /*!
\fn void QDir::swap(QDir &other) \fn void QDir::swap(QDir &other)

View File

@ -105,7 +105,10 @@ public:
~QDir(); ~QDir();
QDir &operator=(const QDir &); QDir &operator=(const QDir &);
#if QT_DEPRECATED_SINCE(5, 13)
QT_DEPRECATED_X("Use QDir::setPath() instead")
QDir &operator=(const QString &path); QDir &operator=(const QString &path);
#endif
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
QDir &operator=(QDir &&other) Q_DECL_NOTHROW { swap(other); return *this; } QDir &operator=(QDir &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif #endif
@ -118,7 +121,10 @@ public:
QString absolutePath() const; QString absolutePath() const;
QString canonicalPath() const; QString canonicalPath() const;
#if QT_DEPRECATED_SINCE(5, 13)
QT_DEPRECATED_X("Use QDir::addSearchPath() instead")
static void addResourceSearchPath(const QString &path); static void addResourceSearchPath(const QString &path);
#endif
static void setSearchPaths(const QString &prefix, const QStringList &searchPaths); static void setSearchPaths(const QString &prefix, const QStringList &searchPaths);
static void addSearchPath(const QString &prefix, const QString &path); static void addSearchPath(const QString &prefix, const QString &path);

View File

@ -659,6 +659,7 @@ QStringList QResource::children() const
return d->children; return d->children;
} }
#if QT_DEPRECATED_SINCE(5, 13)
/*! /*!
\obsolete \obsolete
@ -700,6 +701,7 @@ QResource::searchPaths()
QMutexLocker lock(resourceMutex()); QMutexLocker lock(resourceMutex());
return *resourceSearchPaths(); return *resourceSearchPaths();
} }
#endif
inline uint QResourceRoot::hash(int node) const inline uint QResourceRoot::hash(int node) const
{ {

View File

@ -78,8 +78,12 @@ public:
const uchar *data() const; const uchar *data() const;
QDateTime lastModified() const; QDateTime lastModified() const;
#if QT_DEPRECATED_SINCE(5, 13)
QT_DEPRECATED_X("Use QDir::addSearchPath() instead")
static void addSearchPath(const QString &path); static void addSearchPath(const QString &path);
QT_DEPRECATED_X("Use QDir::searchPaths() instead")
static QStringList searchPaths(); static QStringList searchPaths();
#endif
static bool registerResource(const QString &rccFilename, const QString &resourceRoot=QString()); static bool registerResource(const QString &rccFilename, const QString &resourceRoot=QString());
static bool unregisterResource(const QString &rccFilename, const QString &resourceRoot=QString()); static bool unregisterResource(const QString &rccFilename, const QString &resourceRoot=QString());

View File

@ -3444,6 +3444,7 @@ QSettings::Format QSettings::defaultFormat()
return globalDefaultFormat; return globalDefaultFormat;
} }
#if QT_DEPRECATED_SINCE(5, 13)
/*! /*!
\obsolete \obsolete
@ -3477,7 +3478,7 @@ void QSettings::setUserIniPath(const QString &dir)
setPath(NativeFormat, UserScope, dir); setPath(NativeFormat, UserScope, dir);
#endif #endif
} }
#endif
/*! /*!
\since 4.1 \since 4.1

View File

@ -187,8 +187,12 @@ public:
static void setDefaultFormat(Format format); static void setDefaultFormat(Format format);
static Format defaultFormat(); static Format defaultFormat();
static void setSystemIniPath(const QString &dir); // ### Qt 6: remove (use setPath() instead) #if QT_DEPRECATED_SINCE(5, 13)
static void setUserIniPath(const QString &dir); // ### Qt 6: remove (use setPath() instead) QT_DEPRECATED_X("Use QSettings::setPath() instead")
static void setSystemIniPath(const QString &dir);
QT_DEPRECATED_X("Use QSettings::setPath() instead")
static void setUserIniPath(const QString &dir);
#endif
static void setPath(Format format, Scope scope, const QString &path); static void setPath(Format format, Scope scope, const QString &path);
typedef QMap<QString, QVariant> SettingsMap; typedef QMap<QString, QVariant> SettingsMap;

View File

@ -392,17 +392,18 @@ void QDataStream::setDevice(QIODevice *d)
dev = d; dev = d;
} }
#if QT_DEPRECATED_SINCE(5, 13)
/*! /*!
\obsolete \obsolete
Unsets the I/O device. Unsets the I/O device.
Use setDevice(0) instead. Use setDevice(nullptr) instead.
*/ */
void QDataStream::unsetDevice() void QDataStream::unsetDevice()
{ {
setDevice(0); setDevice(nullptr);
} }
#endif
/*! /*!
\fn bool QDataStream::atEnd() const \fn bool QDataStream::atEnd() const

View File

@ -131,7 +131,10 @@ public:
QIODevice *device() const; QIODevice *device() const;
void setDevice(QIODevice *); void setDevice(QIODevice *);
#if QT_DEPRECATED_SINCE(5, 13)
QT_DEPRECATED_X("Use QDataStream::setDevice(nullptr) instead")
void unsetDevice(); void unsetDevice();
#endif
bool atEnd() const; bool atEnd() const;