path: root/src
diff options
authorThiago Macieira <>2017-03-03 11:46:26 -0800
committerThiago Macieira <>2017-03-31 21:08:14 +0000
commit62013d77721820976102581b4cbd31404c109903 (patch)
tree017b82667a61bfc76c8334b200d3ca60e0b65113 /src
parent507223a218aa218e80dd9eae9bd3958efda301cf (diff)
Mark to remove const from function parameters in QtCore public headers
Some compilers are known to complain about this with a warning. GCC complains about const on return values on -Wignored-qualifiers (enabled at -Wextra), so it's not too much of a jump to assume that others do too. Besides, this is not Qt Library API policy. As maintainer for QtCore, I'm exercising my prerrogative in specifying certain unspecified parts of the coding style, like I've done for constructor initializer lists. Since all the classes involved are exported (including QVector, through derived classes), we can't remove the qualifier until Qt 6, since there are compilers known to encode the qualifier in the mangled name (suncc). I'm not introducing #ifdef to silence unknown compilers unless we get an actual complaint. Change-Id: I33850dcdb2ce4a47878efffd14a876edef843c46 Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src')
3 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 7b0a9f986b..5a90314735 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -526,7 +526,7 @@ public:
static bool load(QDataStream &stream, int type, void *data);
- explicit QMetaType(const int type);
+ explicit QMetaType(const int type); // ### Qt6: drop const
inline ~QMetaType();
inline bool isValid() const;
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index c0e5f2f591..a2c5711993 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -464,7 +464,7 @@ public:
void create(int type, const void *copy);
bool cmp(const QVariant &other) const;
int compare(const QVariant &other) const;
- bool convert(const int t, void *ptr) const;
+ bool convert(const int t, void *ptr) const; // ### Qt6: drop const
// force compile error, prevent QVariant(bool) to be called
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index a526d35ddc..e345163c2f 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -291,6 +291,7 @@ public:
friend class QRegion; // Optimization for QRegion::rects()
+ // ### Qt6: remove const from int parameters
void reallocData(const int size, const int alloc, QArrayData::AllocationOptions options = QArrayData::Default);
void reallocData(const int sz) { reallocData(sz, d->alloc); }
void freeData(Data *d);