From 28f5207ca08bed5c16474091a205bc8351574584 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 5 Mar 2015 22:25:45 -0800 Subject: QtCore: Fix const correctness in old style casts Found with GCC's -Wcast-qual. Change-Id: Ia0aac2f09e9245339951ffff13c8d4b2920a11fb Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcoreapplication.cpp | 2 +- src/corelib/kernel/qmetatype.cpp | 3 ++- src/corelib/kernel/qobject.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 8f58d1b7ad..37a26cf556 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -438,7 +438,7 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint static const char *const empty = ""; if (argc == 0 || argv == 0) { argc = 0; - argv = (char **)∅ + argv = const_cast(&empty); } #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) if (!isArgvModified(argc, argv)) { diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 58912e3fb7..729ca0e0d1 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1840,7 +1840,8 @@ public: void delegate(const T *where) { DestructorImpl::Destruct(m_type, const_cast(where)); } void delegate(const void *) {} void delegate(const QMetaTypeSwitcher::UnknownType*) {} - void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestructor(m_type, (void*)where); } + void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) + { customTypeDestructor(m_type, const_cast(static_cast(where))); } private: static void customTypeDestructor(const int type, void *where) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index cc6970eaeb..d07120e5a8 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4093,7 +4093,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) QDebugStateSaver saver(dbg); if (!o) return dbg << "QObject(0x0)"; - dbg.nospace() << o->metaObject()->className() << '(' << (void *)o; + dbg.nospace() << o->metaObject()->className() << '(' << (const void *)o; if (!o->objectName().isEmpty()) dbg << ", name = " << o->objectName(); dbg << ')'; -- cgit v1.2.3 From e6ddae07e1e571a7a6e0c531b961dbddcd217643 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 19 May 2015 15:03:12 +0200 Subject: Doc:added doc to undocumented functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-36985 Change-Id: Ic358682b276d67ef804f727bcf14191718613469 Reviewed-by: Topi Reiniƶ --- src/corelib/kernel/qmetaobject.cpp | 23 +++++++++++++++++++++++ src/corelib/kernel/qmetatype.cpp | 13 ++++++++++--- src/corelib/kernel/qobject.cpp | 7 +++++++ 3 files changed, 40 insertions(+), 3 deletions(-) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index fc161e6f89..6858209b12 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1533,6 +1533,29 @@ bool QMetaObject::invokeMethod(QObject *obj, ignores return values. */ +/*! + \fn QMetaObject::Connection::Connection(const Connection &other) + + Constructs a copy of \a other. +*/ + +/*! + \fn QMetaObject::Connection::Connection &operator=(const Connection &other) + + Assigns \a other to this connection and returns a reference to this connection. +*/ + +/*! + \fn QMetaObject::Connection &QMetaObject::Connection::operator=(Connection &&other) + + Move-assigns \a other to this object. +*/ +/*! + \fn QMetaObject::Connection::Connection(Connection &&o) + + Move-constructs a Connection instance, making it point to the same object that \a o was pointing to. +*/ + /*! \class QMetaMethod \inmodule QtCore diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 729ca0e0d1..7fadb66319 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -420,6 +420,16 @@ struct DefinedTypesFilter { \sa QMetaType::create() */ +/*! + \fn void *QMetaType::construct(int type, const void *copy) + \deprecated + + Constructs a value of the given type which is a copy of \a copy. + The default value for \a copy is 0. + + Deprecated, use the static function QMetaType::create(int type, + const void *copy) instead. +*/ /*! \fn void *QMetaType::construct(void *where, const void *copy = 0) const \since 5.0 @@ -1179,10 +1189,7 @@ bool QMetaType::isRegistered(int type) } /*! - \fn int qMetaTypeTypeImpl(const char *typeName, int length) \internal - - Implementation of QMetaType::type(). */ template static inline int qMetaTypeTypeImpl(const char *typeName, int length) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index d07120e5a8..6bc4d7e7ed 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4898,8 +4898,15 @@ QMetaObject::Connection& QMetaObject::Connection::operator=(const QMetaObject::C return *this; } +/*! + Creates a Connection instance. +*/ + QMetaObject::Connection::Connection() : d_ptr(0) {} +/*! + Destructor for QMetaObject::Connection. +*/ QMetaObject::Connection::~Connection() { if (d_ptr) -- cgit v1.2.3 From f8be9b8321246e0ddf0eba0deb4816a6188144a9 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 19 Jun 2015 13:15:26 +0200 Subject: Doc: Don't advertise QLocale::system() in QTranslator::load documentation Usually you want to use just QLocale(), and not QLocale::system(). They are both the same except when the user called QLocale::setDefault() beforehand. Change-Id: I2d9b13ac3ffec0005b1d9bf661eccdea276d34b1 Reviewed-by: Oswald Buddenhagen Reviewed-by: Martin Smith --- src/corelib/kernel/qtranslator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index a405df567f..360c5873d4 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -723,7 +723,7 @@ static QString find_translation(const QLocale & locale, For example, an application running in the \a locale with the following \l{QLocale::uiLanguages()}{ui languages} - "es", "fr-CA", "de" might call - load(QLocale::system(), "foo", ".", "/opt/foolib", ".qm"). load() would + load(QLocale(), "foo", ".", "/opt/foolib", ".qm"). load() would replace '-' (dash) with '_' (underscore) in the ui language and then try to open the first existing readable file from this list: -- cgit v1.2.3