From 35fd077c803b7465325a94f02da3c4e10cb55bee Mon Sep 17 00:00:00 2001 From: Leonard Lee Date: Mon, 19 Aug 2013 11:29:32 +0200 Subject: Specify maximum array size for QByteArray. Task-number: QTBUG-33037 Change-Id: I3f39b1498fc70614402fca2281ffbd1a6ec4cf3f Reviewed-by: Thiago Macieira --- src/corelib/tools/qbytearray.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 6ce17e5e13..e993855e7e 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -645,6 +645,8 @@ static inline char qToLower(char c) store raw binary data, and when memory conservation is critical (e.g., with Qt for Embedded Linux). + The maximum array size of a QByteArray is under 2^30. + One way to initialize a QByteArray is simply to pass a \c{const char *} to its constructor. For example, the following code creates a byte array of size 5 containing the data "Hello": -- cgit v1.2.3 From ee50096830f7915db2078ad66d83283e3c97f5d9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 8 Jul 2013 12:17:35 +0200 Subject: Populate INTERFACE_LINK_LIBRARIES property in the cmake files. This is new in CMake 2.8.12 and replaces the old properties matching IMPORTED_INTERFACE_LINK_LIBRARIES_. Change-Id: I5d4c454972f2535f6792e95718c73d80c56ac24c Reviewed-by: Stephen Kelly --- src/corelib/Qt5CoreConfigExtras.cmake.in | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index e01b448351..db482fa9e6 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -133,6 +133,11 @@ if (NOT TARGET Qt5::WinMain) set(_isPolicyNEW $) get_target_property(_configs Qt5::Core IMPORTED_CONFIGURATIONS) foreach(_config ${_configs}) + set_property(TARGET Qt5::Core APPEND PROPERTY + INTERFACE_LINK_LIBRARIES + $<$:Qt5::WinMain> + ) + # For backward compatibility with CMake < 2.8.12 set_property(TARGET Qt5::Core APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} $<$:Qt5::WinMain> -- cgit v1.2.3 From 8074693425e06d2c4a8f130124658fe72f3e5ab9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 19 Jun 2013 17:56:04 +0200 Subject: CMake: Allow specifying a TARGET in invocations of macros. Forward-port of 9ce60ff509c4ff27fe861fc5b2080f50897a68c4 (Qt4Macros: Allow specifying a TARGET in invokations of macros., 2013-02-26) from cmake.git. This causes the INCLUDE_DIRECTORIES and COMPILE_DEFINITIONS to be used from the specified target when running moc. Change-Id: I868a35ade3c6b059e64d226291cf2046709d86d4 Reviewed-by: Stephen Kelly --- src/corelib/Qt5CoreMacros.cmake | 80 ++++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 29 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index 6630885257..dca257f080 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -94,34 +94,45 @@ endmacro() # helper macro to set up a moc rule -macro(QT5_CREATE_MOC_COMMAND infile outfile moc_flags moc_options) - # For Windows, create a parameters file to work around command line length limit - if(WIN32) - # Pass the parameters in a file. Set the working directory to - # be that containing the parameters file and reference it by - # just the file name. This is necessary because the moc tool on - # MinGW builds does not seem to handle spaces in the path to the - # file given with the @ syntax. - get_filename_component(_moc_outfile_name "${outfile}" NAME) - get_filename_component(_moc_outfile_dir "${outfile}" PATH) - if(_moc_outfile_dir) - set(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir}) - endif() - set(_moc_parameters_file ${outfile}_parameters) - set(_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") - string(REPLACE ";" "\n" _moc_parameters "${_moc_parameters}") - file(WRITE ${_moc_parameters_file} "${_moc_parameters}") - add_custom_command(OUTPUT ${outfile} - COMMAND ${Qt5Core_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters - DEPENDS ${infile} - ${_moc_working_dir} - VERBATIM) +macro(QT5_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target) + # Pass the parameters in a file. Set the working directory to + # be that containing the parameters file and reference it by + # just the file name. This is necessary because the moc tool on + # MinGW builds does not seem to handle spaces in the path to the + # file given with the @ syntax. + get_filename_component(_moc_outfile_name "${outfile}" NAME) + get_filename_component(_moc_outfile_dir "${outfile}" PATH) + if(_moc_outfile_dir) + set(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir}) + endif() + set (_moc_parameters_file ${outfile}_parameters) + set (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") + string (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}") + + if(moc_target) + set(targetincludes "$") + set(targetdefines "$") + + set(targetincludes "$<$:-I$\n>") + set(targetdefines "$<$:-D$\n>") + + file (GENERATE + OUTPUT ${_moc_parameters_file} + CONTENT "${targetdefines}${targetincludes}${_moc_parameters}\n" + ) + + set(targetincludes) + set(targetdefines) else() - add_custom_command(OUTPUT ${outfile} - COMMAND ${Qt5Core_MOC_EXECUTABLE} - ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile} - DEPENDS ${infile} VERBATIM) + file(WRITE ${_moc_parameters_file} "${_moc_parameters}\n") endif() + + set(_moc_extra_parameters_file @${_moc_parameters_file}) + add_custom_command(OUTPUT ${outfile} + COMMAND ${Qt5Core_MOC_EXECUTABLE} ${_moc_extra_parameters_file} + DEPENDS ${infile} + ${_moc_working_dir} + VERBATIM) endmacro() @@ -133,7 +144,13 @@ function(QT5_GENERATE_MOC infile outfile ) if(NOT IS_ABSOLUTE "${outfile}") set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") endif() - qt5_create_moc_command(${abs_infile} ${_outfile} "${moc_flags}" "") + if ("x${ARGV2}" STREQUAL "xTARGET") + if (CMAKE_VERSION VERSION_LESS 2.8.12) + message(FATAL_ERROR "The TARGET parameter to qt5_generate_moc is only available when using CMake 2.8.12 or later.") + endif() + set(moc_target ${ARGV3}) + endif() + qt5_create_moc_command(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}") set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file endfunction() @@ -145,17 +162,22 @@ function(QT5_WRAP_CPP outfiles ) qt5_get_moc_flags(moc_flags) set(options) - set(oneValueArgs) + set(oneValueArgs TARGET) set(multiValueArgs OPTIONS) cmake_parse_arguments(_WRAP_CPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) set(moc_files ${_WRAP_CPP_UNPARSED_ARGUMENTS}) set(moc_options ${_WRAP_CPP_OPTIONS}) + set(moc_target ${_WRAP_CPP_TARGET}) + + if (moc_target AND CMAKE_VERSION VERSION_LESS 2.8.12) + message(FATAL_ERROR "The TARGET parameter to qt5_wrap_cpp is only available when using CMake 2.8.12 or later.") + endif() foreach(it ${moc_files}) get_filename_component(it ${it} ABSOLUTE) qt5_make_output_file(${it} moc_ cpp outfile) - qt5_create_moc_command(${it} ${outfile} "${moc_flags}" "${moc_options}") + qt5_create_moc_command(${it} ${outfile} "${moc_flags}" "${moc_options}" "${moc_target}") list(APPEND ${outfiles} ${outfile}) endforeach() set(${outfiles} ${${outfiles}} PARENT_SCOPE) -- cgit v1.2.3 From c7c3a78075eb05db6714b21c61aad722b275ec8c Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 19 Aug 2013 16:29:29 +0200 Subject: Add json/savegame example. There wasn't any example documentation besides json.html, which doesn't actually describe usage of the various QJson* classes. This also makes each QJson* class page link back to json.html. Change-Id: If5ad6493d2728df0cec7bdbbc5790f0b755f816c Reviewed-by: Friedemann Kleint Reviewed-by: Jerome Pasion Reviewed-by: Lars Knoll --- src/corelib/doc/qtcore.qdocconf | 3 ++- src/corelib/doc/src/datastreamformat.qdoc | 2 ++ src/corelib/doc/src/json.qdoc | 2 ++ src/corelib/json/qjsonarray.cpp | 2 ++ src/corelib/json/qjsondocument.cpp | 2 ++ src/corelib/json/qjsonobject.cpp | 6 ++++-- src/corelib/json/qjsonparser.cpp | 2 ++ src/corelib/json/qjsonvalue.cpp | 2 ++ 8 files changed, 18 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index 0e275ee8d4..752e8eb946 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -36,6 +36,7 @@ exampledirs += \ ../ \ snippets \ ../../../examples/threads/ \ - ../../../examples/tools/ + ../../../examples/tools/ \ + ../../../examples/json/ imagedirs += images diff --git a/src/corelib/doc/src/datastreamformat.qdoc b/src/corelib/doc/src/datastreamformat.qdoc index 99a0a077cd..b6efe6aa33 100644 --- a/src/corelib/doc/src/datastreamformat.qdoc +++ b/src/corelib/doc/src/datastreamformat.qdoc @@ -369,4 +369,6 @@ \li The items (T) \endlist \endtable + + \sa {JSON Support in Qt} */ diff --git a/src/corelib/doc/src/json.qdoc b/src/corelib/doc/src/json.qdoc index 89e1bcac34..5bffe98ae5 100644 --- a/src/corelib/doc/src/json.qdoc +++ b/src/corelib/doc/src/json.qdoc @@ -99,6 +99,8 @@ A valid JSON document is either an array or an object, so a document always starts with a square or curly bracket. + \sa {JSON Save Game Example} + \section1 The JSON Classes diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp index fb8d2e83ff..8dd7f6092f 100644 --- a/src/corelib/json/qjsonarray.cpp +++ b/src/corelib/json/qjsonarray.cpp @@ -71,6 +71,8 @@ QT_BEGIN_NAMESPACE it has been created from as long as it is not being modified. You can convert the array to and from text based JSON through QJsonDocument. + + \sa {JSON Support in Qt}, {JSON Save Game Example} */ /*! diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp index bdb46528d3..05d57e2ab9 100644 --- a/src/corelib/json/qjsondocument.cpp +++ b/src/corelib/json/qjsondocument.cpp @@ -76,6 +76,8 @@ QT_BEGIN_NAMESPACE A document can also be created from a stored binary representation using fromBinaryData() or fromRawData(). + + \sa {JSON Support in Qt}, {JSON Save Game Example} */ /*! diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index 43336de2e7..362d01384e 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -70,6 +70,8 @@ QT_BEGIN_NAMESPACE it has been created from as long as it is not being modified. You can convert the object to and from text based JSON through QJsonDocument. + + \sa {JSON Support in Qt}, {JSON Save Game Example} */ /*! @@ -604,7 +606,7 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const Multiple iterators can be used on the same object. Existing iterators will however become dangling once the object gets modified. - \sa QJsonObject::const_iterator + \sa QJsonObject::const_iterator, {JSON Support in Qt}, {JSON Save Game Example} */ /*! \typedef QJsonObject::iterator::difference_type @@ -799,7 +801,7 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const Multiple iterators can be used on the same object. Existing iterators will however become dangling if the object gets modified. - \sa QJsonObject::iterator + \sa QJsonObject::iterator, {JSON Support in Qt}, {JSON Save Game Example} */ /*! \typedef QJsonObject::const_iterator::difference_type diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp index b151af7955..8721f06064 100644 --- a/src/corelib/json/qjsonparser.cpp +++ b/src/corelib/json/qjsonparser.cpp @@ -86,6 +86,8 @@ QT_BEGIN_NAMESPACE \since 5.0 \brief The QJsonParseError class is used to report errors during JSON parsing. + + \sa {JSON Support in Qt}, {JSON Save Game Example} */ /*! diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index 3fbc811948..9dd9a9cab9 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -81,6 +81,8 @@ QT_BEGIN_NAMESPACE Values are strictly typed internally and contrary to QVariant will not attempt to do any implicit type conversions. This implies that converting to a type that is not stored in the value will return a default constructed return value. + + \sa {JSON Support in Qt}, {JSON Save Game Example} */ /*! -- cgit v1.2.3 From 1f8c179c6cd6d6c79e5bbd1a85e3d4252eeafa79 Mon Sep 17 00:00:00 2001 From: Takumi Asaki Date: Wed, 21 Aug 2013 18:04:44 +0900 Subject: Doc: Add Q_OS_ANDROID macro Change-Id: If428f0b7c1540e809f756f426a6d222acea5d310 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/corelib/global/qglobal.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 85cb698afc..6e5de68b01 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1165,6 +1165,13 @@ bool qSharedBuild() Q_DECL_NOTHROW Defined on Linux. */ +/*! + \macro Q_OS_ANDROID + \relates + + Defined on Android. +*/ + /*! \macro Q_OS_FREEBSD \relates -- cgit v1.2.3 From 362ea2dedeeca351ae36fcf860cc47b2f12830cf Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 20 Aug 2013 11:30:11 -0700 Subject: Soft-deprecate obscure feature on property getters returning pointers moc actually generates the right code for getters returning a pointer to the type in question, or a reference to the type (a reference, one would assume, does not require code changes). However, the same extension is not valid for the setter: it can't receive the new value by pointer. Therefore, let's soft-deprecate the feature by removing its existence from the documentation. Task-number: QTBUG-33091 Change-Id: I27844213e051ec7fafeb4744089a0653aea6f1f3 Reviewed-by: Olivier Goffart Reviewed-by: Jerome Pasion --- src/corelib/doc/src/objectmodel/properties.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/src/objectmodel/properties.qdoc b/src/corelib/doc/src/objectmodel/properties.qdoc index d1690c5908..70f0b88e06 100644 --- a/src/corelib/doc/src/objectmodel/properties.qdoc +++ b/src/corelib/doc/src/objectmodel/properties.qdoc @@ -67,7 +67,7 @@ \li A \c READ accessor function is required if no \c MEMBER variable was specified. It is for reading the property value. Ideally, a const function is used for this purpose, and it must return either the property's type or a - pointer or reference to that type. e.g., QWidget::focus is a read-only + const reference to that type. e.g., QWidget::focus is a read-only property with \c READ function, QWidget::hasFocus(). \li A \c WRITE accessor function is optional. It is for setting the -- cgit v1.2.3 From f3a53eae80bda8bb9364e5caa6b0e1cf0dd9ce87 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 27 Aug 2013 11:52:56 +0200 Subject: Revert "Fix compilation for Android ARMv5" This reverts commit 9fa1bdeeb2bca6f9ba370fce594a47a066a7e81a which is no longer needed because the Android NDK now contains a toolchain without the bug for which it was a work-around. Task-number: QTBUG-31051 Change-Id: I601ba2fccb927ee7e818644de4474700e2eec8f1 Reviewed-by: BogDan Vatra --- src/corelib/global/qglobal.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index cde3e96ed1..a70dc52e9f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -203,11 +203,7 @@ typedef quint64 qulonglong; QT_BEGIN_INCLUDE_NAMESPACE typedef unsigned char uchar; typedef unsigned short ushort; -#if defined(Q_QDOC) || !defined(Q_OS_ANDROID) typedef unsigned int uint; -#else -# include -#endif typedef unsigned long ulong; QT_END_INCLUDE_NAMESPACE -- cgit v1.2.3