summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Windows/Windows CE: Do not dynamically load shell32/coredll.Friedemann Kleint2014-01-072-32/+4
| | | | | | | | | Those libraries are contained in QMAKE_LIBS_CORE and GetSpecialFolderPath() is present in all supported versions. Change-Id: Iae40714e0f234625b063aeb50e29fc79c4aaa6ea Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Prevent foolish use of setuid when using Qt.Richard J. Moore2014-01-073-0/+50
| | | | | | | | | | | | | | | | In order to prevent people from shooting themselves in the foot, abort if we're running setuid. This behavior can be disabled by calling QCoreApplication::setSetuidAllowed(true) in order to support legacy code. [ChangeLog][QtCore][Important Behavior Changes] Running Qt applications that are setuid has been prevented. If you really need to do this then you can call QCoreApplication::setSetuidAllowed(true) before creating the QCoreApplication instance. Change-Id: I992a9a0cd8420693d438852a05666e3dbb2c9d6a Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* WinRT: Clean up core event dispatcherAndrew Knight2014-01-073-139/+88
| | | | | | | | | | | | | | | | - Move private classes in the .cpp file (they aren't needed outside) - Conform to Qt style, such as includes and braces - Use ComPtr where appropriate - Use foreach where appropriate - Remove non-functional wake/interrupt leftovers - Remove redundant timer list - Make the timer callback a static method, so it won't crash if it gets called on shutdown Task-number: QTBUG-35945 Change-Id: I5426fba2735e908a04ea60287f9936f5abde6644 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-036-45/+56
|\ | | | | | | Change-Id: Id13badc270db98806048753fd7fb658aa17f1ede
| * Add missed header to qfileselector.cpp.Ivan Komissarov2014-01-031-0/+4
| | | | | | | | | | Change-Id: I2fd6fb2ae1663730a008221f6beeef19a5307246 Reviewed-by: David Faure <david.faure@kdab.com>
| * Fix some typos in documentation.Jeff Tranter2014-01-022-3/+3
| | | | | | | | | | | | | | | | Fix some spelling and grammatical errors in comments that show up in Qt documentation. No changes to code. Change-Id: I2e946fda0bd9a2117f8e9b2fb300df9bf0a98a6c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
| * Improve QFileSelector docAlan Alpert2013-12-301-27/+36
| | | | | | | | | | | | | | | | | | Mostly just adding proper tags and sections, as well as a few grammatical fixes. Change-Id: I219517d740fa7385e923a9e09cb7e241378fcbdd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
| * Doc: Polish Qt::ConnectionType descriptionsSze Howe Koh2013-12-301-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Shorten Qt::AutoConnection description, rearrange to match the order of the subsequent rows. - Note the thread used in Qt::DirectConnection - "Emitter's thread" is ambiguous -- a signal is not necessarily emitted from the thread that the emitter lives in. - Misusing Qt::BlockingQueuedConnection WILL (not "can") cause a deadlock. Qt even issues an error message before it freezes. - Remove the \note command -- it breaks the table and displays the note in a new paragraph. Change-Id: Ib60cb665e0cd23e1e072402ec5d8be344b8454f7 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
| * Fix ‘looses precision’ warning in public APIKurt Pattyn2013-12-272-4/+4
| | | | | | | | | | Change-Id: I935e6f278e539f8e6aaca0bc381371ec85aa5c67 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Extend multimedia keysAllan Sandfeld Jensen2014-01-021-0/+5
| | | | | | | | | | | | | | | | | | Extends the Qt keycodes with four missing keys, common on remote controls: Guide, Info, Settings and Exit. Change-Id: I6789f13dbb662da4261a3c947757644e12306dd9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
* | Retain space settingKurt Pattyn2013-12-241-6/+22
| | | | | | | | | | Change-Id: I4584de9ba51610907c917a0e0ddf5f6f28d304a0 Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-12-2412-78/+63
|\| | | | | | | Change-Id: I2defae1904154283446b069d151c3ef57302ec7b
| * Doc: corrected broken linksNico Vertriest2013-12-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-34749 Corrected link to drag and drop example. Corrected link to {mandatory fields} Created target referring to macros for defining plugins Change-Id: I387a2d9bab428b2eacd8d371f08c72f42f7e2be2 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
| * Fix qlocale_blackberry buffer initializationRafael Roquetto2013-12-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QVarLengthArray inside qlocale_blackberry.cpp was being preallocated with 512 bytes, that means internally it could grow up to 512 bytes using the stack before switching to the heap, but its actual semantic size was still 0. After qt_safe_read(... buffer.data() ...) was being called, data was written to the QVarLengthArray buffer, but its semantic size was still 0, since it was not resized or anything. This triggered an assertion when buffer[bytes] = '\0' was assigned, since 'bytes' > buffer.size() ( == 0) despite buffer.capacity() == 512. Change-Id: I5503ee9b02413794f67730700fba05a4c194d465 Reviewed-by: Mehdi Fekari <mfekari@blackberry.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
| * Introduce Q_ATTRIBUTE_FORMAT_PRINTFHarald Fernengel2013-12-173-62/+20
| | | | | | | | | | | | | | | | Removes a lot of copy-paste code for flagging printf style functions. Change-Id: Iecc1e312d1f28b5cbb6b297039f1cdbbc888f843 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * qthread_win.cpp: Fix warnings when waiting for adopted threads.Friedemann Kleint2013-12-171-1/+5
| | | | | | | | | | | | | | Task-number: QTBUG-35591 Change-Id: I63169bd8a9758a7dad33d4231d3d6c9d71c7e252 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Clarify foreach's documentation on valued-containersAlejandro Exojo2013-12-171-3/+5
| | | | | | | | | | | | | | | | | | | | - Explain that values() is unnecessary and causes an extra copy. - Replace "are fastest" with "are faster". - Briefly explain the snippet. Change-Id: Iff1d3a0b6140fca1d78157aeeca3d538c4d78b84 Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Use the short time format of the current locale on WindowsThiago Macieira2013-12-161-2/+10
| | | | | | | | | | | | | | | | Windows 7 and later have LOCALE_SSHORTTIME, which is what we need. Task-number: QTBUG-33718 Change-Id: I4c3f113d17102a37fb752de56f06b312f27c7887 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
| * CMake: Generate config-specific moc parameters file.Stephen Kelly2013-12-161-0/+1
| | | | | | | | | | | | | | | | | | When using the visual studio generators, a moc parameters file for each configuration is generated. The content differs because the -DQT_NO_DEBUG may be added or not, depending on the configuration. Change-Id: I52eae536289d451df72df2e4dba709851279694a Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
| * Merge "Merge remote-tracking branch 'origin/release' into stable" into ↵Frederik Gladhorn2013-12-163-6/+17
| |\ | | | | | | | | | refs/staging/stable
| | * Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2013-12-123-6/+17
| | |\ | | | | | | | | | | | | Change-Id: I0cd3b1b33e6d9bec729d941b06aeeb3d21851820
| | | * Fix QtDeclarative and QtQml co-existence part three ;(v5.2.0Simon Hausmann2013-12-062-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately the QObject destroyed callbacks for QtQml and QtDeclarative can't be called in sequence, because if the QQmlData has the ownsMemory bit set, then the destroyed callback will delete the QQmlData, and the sub-sequent call to the destroyed callback of qml1 will try to dereference the QQmlData's first bit (ownedByQml1), which is already destroyed. This patch fixes that by simply sharing the assumption of the first bit indicating module ownership (QtQml vs. QtDeclarative) also to qtbase and using it to distinguish between which destroyed callback function to call. Task-number: QTCREATORBUG-10273 Change-Id: I2773a31a3e9b3a1c22d1c1f33b2f29f3296cb3cf Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| | | * Windows command line parsing: Do escape backslash.Friedemann Kleint2013-12-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will break network paths passed as command line arguments. Introduced by 4ff6951550cb6e39c3b31895c3af57037e90c9ac . Task-number: QTBUG-35432 Task-number: QTBUG-30628 Change-Id: Ice9ce15275ef69e9e9e82daf5a303e7c56294368 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | | Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Simon Hausmann2013-12-2312-92/+179
|\ \ \ \ | | | | | | | | | | | | | | | refs/staging/dev
| * | | | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-12-1612-92/+179
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qplatformtheme.h tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp Change-Id: Iecd3343d6a050b8764f78d809c4a1532aeba69e5
| | * | | QMetaType: Fix equality comparison of type-erased iterators.Stephen Kelly2013-12-131-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-33997 Change-Id: I0d4da562540df0e3732769881ba124cb980f6b82 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| | * | | QMetaType: Fix copy of type erased iteratorStephen Kelly2013-12-131-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Behavior differs depending on whether the iterator is a value_type*, or a different class entirely. Ensure that the correct behavior is used when copying. Task-number: QTBUG-33997 Change-Id: Ib6db2a3c4a5aa861b851833a7f0ecb855a3e828f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| | * | | QMetaType: Rename template type of type-erased iterator operations.Stephen Kelly2013-12-121-6/+6
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | This struct is a specialization for the case that the const_iterator is a pointer to the value type. Reflect that in the type name. Change-Id: I0a4ac03840658056285080860baec8313746c71c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| | * | Make QTemporaryDir file name more randomKai Koehne2013-12-121-14/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qrand() returns a number between 0 and RAND_MAX, which is only guaranteed to be bigger than 32767. Dividing it repeatedly means that the last bytes are always 0. [ChangeLog][QtCore][QTemporaryDir] Fixed bug in QTemporaryDir name generator that dramatically reduced randomness of the name. Change-Id: I90613a652e6384296aed827e2714fe63cd8797ee Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
| | * | QProcess/Win: allow child processes to change modes of the stdin pipeJoerg Bornemann2013-12-101-28/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To be able to call SetNamedPipeHandleState on stdin in a child process, we must create a read-end pipe handle with the FILE_WRITE_ATTRIBUTES flag set. This can't be done with CreateNamedPipe but only with CreateFile. Therefore we're creating the handles for the child process always with CreateFile now. Besides, it's conceptually cleaner to have the server handle of the named pipe in the calling process. [ChangeLog][QtCore][Windows] Fix regression from Qt4 in QProcess. It wasn't possible anymore to alter pipe modes of stdin in child processes. Task-number: QTBUG-35357 Change-Id: I85f09753d0c924bdc8a6cef1ea5dbe6b2299c604 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
| | * | QMetaStringTable: make ctor explicitMarc Mutz2013-12-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent commit 105d10de introduced the QMetaStringTable(QByteArray) constructor, but failed to mark it as explicit. The argument, the class' name, is not an equivalent representation of a string table, so mark the constructor explicit. Change-Id: I2f141969400b98d3253283bd6fb0b9d18f2d53b3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| | * | Don't check the Qt version across modules in -developer-buildThiago Macieira2013-12-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of enforcing the check, we'll simply trust developers to do the right thing. For one, it's useful to mix libraries during testing (regression testing, git bisects, etc.). For another, Qt developers are faced day-to-day with binary incompatibility issues anyway, so this check is mostly superfluous. If there's one commit we could be sure that isn't breaking binary compatibility, that's the "Bump Qt version" commit. And yet that's the one that would cause the fatal to trip... Change-Id: I8965f764a6ca1b2d125b42bce7ac6b27e3afc8ac Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| | * | Fix quadratic behavior in QMetaObjectBuilder when writing string tableSimon Hausmann2013-12-062-18/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QHash::key() is O(n) and we're calling it n times. That can make repeated calls to the meta object builder very slow, as for example QQmlPropertyMap when inserting properties repeatedly. Fortunately this is easy to fix, as the value in the hash map is also the index, so we can simply iterate over the hash once. With the exception of the class name, which we have to treat specially to ensure that it is always the first entry in the string table. Task-number: QTBUG-32720 Change-Id: Ic954c45c454107feee83216131f601cc69d4c63b Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| | * | Correct compiler warnings for sign conversionKurt Pattyn2013-12-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qstrlen() returns a uint. When assigned to an int, the compiler warns about sign conversions. Because these calls are used within templates, the code appears in user generated code, and hence the warnings cannot be suppressed by the -isystem directive. Using the -Werror flag, makes the user code fail. [ChangeLog][QtCore] Fixed sign conversion warnings in code using QMetaTypeId. Change-Id: Ib7603679d6526467f8cbb9d7bcf5f56c6af47ceb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * | QCommandLineParser: pluck some low-hanging fruit re: exception safetyMarc Mutz2013-12-062-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make QCommandLineParser::add{Help,Version}Option() QCommandLineOption::setDefaultValue() QCommandLineOptionPrivate::setNames() have transaction semantics: either they succeed, or they change nothing. It's trivial to provide this guarantee, so do it. Add a test for the surprising property that setDefaultValue("") resets defaultValues() to an empty QStringList instead of one that contains the empty string. Change-Id: I61623019de3c7d2e52c24f42cc2e23ec5fddc4da Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * | QTimeZone: Fix isValidId()John Layt2013-12-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix isValidId() which was failing valid IDs because it was splitting name parts by \ instead of /. it was also rejecting offset from UTC formats names. Add unit tests. Task-number: QTBUG-35025 Change-Id: I4d23d2e54f4a9fac9afcc4eff0a02d6f4af21385 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * | Replace the qCpuHasFeature function with a macroThiago Macieira2013-12-051-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to make sure that there's a constant propagation from the static variable that is filled in with the current code-generation options. With most compilers in debug mode, we'd carry dead code. With MSVC, even inlining is really bad even in release mode, and it doesn't perform constant propagation even with __forceinline. Change-Id: I7a95ff6622b864771243990bb5e205b2df0c33fc Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| | * | Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2013-12-053-5/+17
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure mkspecs/macx-ios-clang/features/default_post.prf tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp Change-Id: Iaba97eed2272bccf54289640b8197d40e22f7bf5
| | | * Document that disconnectNotify may be called with a mutex lockedOlivier Goffart2013-12-041-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And that connectNotify and disconnectNotify might be called from another thread Task-number: QTBUG-34829 Change-Id: Id118b97b92e9aa085a1d4368282294f90cfb1706 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
| | | * Android: Fix crash caused by QJNIs classLoader code.Christian Strømme2013-12-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases the classLoader is not able to resolve fully-qualified names that contains forward slashes. Unlike FindClass() which expects the fully-qualified name to contain slashes, the classLoader expects the binary name, i.e., with '.' as separator. This caused a crash in QtMultimedia when accessing a nested class. Task-number: QTBUG-35298 Change-Id: I77728352fbab930ae1914bc1cb2189e458e179e2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
| | | * Doc: Adjust description of the qreal typedefhjk2013-12-041-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I038df8034ee00868eeee18b1ed09f7a70e3dd77a Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | | Ensure proper order of includes in qglobal.hThiago Macieira2013-12-231-5/+8
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QAtomic will now depend on QTypeInfo, so shuffle the order to make sure the includes are right. The first set do not require anything but the macros from qglobal.h, then qflags.h requires qtypeinfo.h and qtypetraits.h, qatomic.h requires qtypeinfo.h and qglobalstatic.h requires qatomic.h. Of those, only qatomic.h isn't in global/, so we could even consider using "" includes, but I recall MSVC not honoring them correctly. Change-Id: I76c150254a99cdea8857445bdebf2e724eaa76bd Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | | Add the UTF16-to-Latin1 in-place converterThiago Macieira2013-12-132-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is only possible for two important reasons: 1) QString and QByteArray d pointers are both done with QArrayData and that class does not care that the alignof(T) changes from 2 to 1, so we can give the pointer from QString to QByteArray (after adapting the allocated size, which is now double) 2) conversion from UTF16 to Latin1 always has fewer bytes (exactly half) Change-Id: I17b2690c910f3de8db55156c6d6b5f55be06d827 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | | Improve the Latin1 conversion in QString a littleThiago Macieira2013-12-131-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, use Qt::Uninitialized, since we're about to overwrite the memory anyway with the new Latin 1 string. Second, move the actual body of the conversion to a static void function, which seems to improve code generation a little and, of course, paves the way for the in-place conversion. Change-Id: Iaed99ba1e52facad676510aa98443223e188d70a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | | Implement support for ref-qualified QString::toLatin1 & friendsThiago Macieira2013-12-134-23/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first step in implementing an in-place conversion of QString to QByteArray. This requires ref-qualifiers in member functions so we know that we have an rvalue QString. Converting from UTF-16 to Latin1 always requires half the memory. For conversion from UTF-16 to UTF-8, the typical string will also need the same memory or less: characters from U+0000 to U+007F consume one fewer byte; characters from U+0080 to U+07FF and from U+10000 to U+1FFFFF occupy the same space in UTF-8 and UTF-16; it's only the ones from U+0800 to U+FFFF that consume more space in the UTF-8 string. For the locale's 8-bit codec, we can't be sure and the code (currently) needs to go through QTextCodec anyway. This requires a #define set before #include'ing "qstring.h". However, since qstring.h is included by the QtCore PCH, we need an extra qmake compiler without the PCH flags to compile this .cpp. After this change, the distribution of calls in QtCore, Network, Gui, and Widgets is as follows: const & && toUtf8 31 (74%) 11 (26%) toLatin1 79 (77%) 24 (23%) toLocal8Bit 26 (16%) 138 (84%) Change-Id: Idd96f9ddb51b989bc59f6da50054dd10c953dd4f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | | Fix erroneous exclusion of classes from related meta objects in mocSimon Hausmann2013-12-121-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assume an unrelated class that declares an enum and uses Q_ENUMS. Consider then a class that uses UnrelatedClass::Enum as a Q_PROPERTY. We used to include UnrelatedClass in the primary class's related meta objects, in order to support use-cases like obj->setProperty("enumProperty", "ValueOfEnumAsString"); If however moc happens to see Q_DECLARE_METATYPE(UnrelatedClass::Enum), then it would exclude it from the related meta objects, which would silently break the string based enum value conversion. This was meant as an optimization, but it isn't apparent to the developer why sometimes the string conversion would work and sometimes not (depending on whether somebody declares that macro). This also becomes visible in QML, which relies on the same embedded type information for enum assignments. This patch removes that check in moc's code generator and cleans up the code a little. However always including the prefix of Q_PROPERTY(SomePrefix::Enum ...) is not correct either, because it may be that SomePrefix is a namespace, which would cause compilation issues. Therefore we limit the inclusion of related meta objects only to Q_OBJECT decorated classes the moc has seen, and for these we save the fully qualified name in the related meta objects array (for QTBUG-2151). While this patch makes the previous workaround for namespace issues by using a Q_DECLARE_METATYPE not workable anymore, by saving the fully qualified name we are making a hopefully sufficient effort to not require a workaround in the first place. There's always the new workaround of fully qualifying the type in Q_PROPERTY. One side-effect of this change is that in the autoPropertyMetaTypeRegistration test of tst_moc, the CustomQObject for Q_PROPERTY(CustomQObject::Number enumValue ...) is now a related meta object, and therefore when querying for the type of this property via QMetaProperty::userType(), we are now aware of this being an enum and try to resolve CustomQObject::Number via QMetaType::type(qualfiedName). As there is no guarantee for this to succeed, we must now also do what is done in the non-enum code path in ::userType(), which is to call the moc generated type registration function. Task-number: QTBUG-33577 Task-number: QTBUG-2151 Change-Id: Ibf20e7421cba464c558a25c76a7e1eef002c6cff Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | | Move-enable QSignalBlockerMarc Mutz2013-12-112-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When QSignalBlocker was reviewed, move semantics were asked for. This patch add them. This makes QSignalBlocker usable as a by-value argument (to transfer control of signal blocking into a function) as well as as a return value (to transfer control of signal blocking out of a function). Change-Id: I714aa2a283bb33dba76e860649e88ed202e913c5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | | Remove all "old atomic" code from QtThiago Macieira2013-12-1013-3702/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new atomic code was introduced in Qt 5.0. The platforms that did not get ported were announced as deprecated in Qt 5.2. The code is now removed in Qt 5.3. The status for the platform/compiler/OS combinations affected is: * Linux with GCC or Clang: still compiles on all platforms (via qatomic_cxx11.h or qatomic_gcc.h) * INTEGRITY with Green Hills compiler: no longer compiles * Solaris on UltraSPARC, with Sun Studio: no longer compiles * AIX on POWER5 or 6, with IBM Visual Age: no longer compiles (probably did not compile Qt 5.0 either) * VxWorks in kernel mode: no longer compiles [ChangeLog][General] Support for the following platforms has been removed, due to lack of interest in updating support: INTEGRITY, VxWorks, Solaris on UltraSPARC (with the Sun Studio compiler suite), AIX on POWER processors (with IBM Visual Age compiler suite). Change-Id: I8a961385fd95011c016b2b1eec52034794dae3e1 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Add Asset Locations to QStandardPaths::DataLocationAlan Alpert2013-12-104-5/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The locations of UI assets are deployed to is being added as a read-only location under DataLocation. As such a path is located differently on certain mobile platforms, such as Android and BlackBerry, having an entry in StandardPaths will make it easier to write cross-platform code. Change-Id: I4533c90ed7157725a8604591595b350c7f616723 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* | | Add operator!=() for timespec structs.Erik Verbruggen2013-12-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is not an attempt to complete this API, but rather preventing code like !(a==b) being used every time timespec structs are compared for unequality. Change-Id: I0edf3fd3c44a9350208adc6b3fb5fe8aec370a45 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>