diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-06-11 23:49:35 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-06-11 23:49:35 (GMT) |
commit | 35521a8dac1cd10fe0e2bba9eb4df1b2a97320ef (patch) | |
tree | 5b75d2929a6a0e9db483c2a95f7cf81dc14de1dc /src/corelib/io | |
parent | 74c18979b927ba3dd82ed3f5ca362428c61c2675 (diff) | |
download | Qt-35521a8dac1cd10fe0e2bba9eb4df1b2a97320ef.zip Qt-35521a8dac1cd10fe0e2bba9eb4df1b2a97320ef.tar.gz Qt-35521a8dac1cd10fe0e2bba9eb4df1b2a97320ef.tar.bz2 |
Help people find poor uses of QString -> QUrl conversion.
Since a file name looks just like a relative URL, bugs can easily creep
in if QString can be assigned directly to a QUrl rather than, for example,
with an explicity "file:" scheme, or via QUrl::resolved(QUrl(...)).
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qurl.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index e9c4a8d..276872b 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -81,12 +81,17 @@ public: Q_DECLARE_FLAGS(FormattingOptions, FormattingOption) QUrl(); +#ifdef Q_EXPLICIT_URL_QSTRING_CONVERSION + explicit +#endif QUrl(const QString &url); QUrl(const QString &url, ParsingMode mode); // ### Qt 5: merge the two constructors, with mode = TolerantMode QUrl(const QUrl ©); QUrl &operator =(const QUrl ©); +#ifndef Q_EXPLICIT_URL_QSTRING_CONVERSION QUrl &operator =(const QString &url); +#endif ~QUrl(); void setUrl(const QString &url); @@ -235,7 +240,9 @@ public: { url = QString::fromLatin1(QUrl::toPercentEncoding(url).constData()); } +#ifndef Q_EXPLICIT_URL_QSTRING_CONVERSION inline QT3_SUPPORT operator QString() const { return toString(); } +#endif inline QT3_SUPPORT bool cdUp() { *this = resolved(QUrl(QLatin1String(".."))); |