summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* QRegularExpression: fix count() when the RE matches a surrogateThiago Macieira2023-01-311-1/+7
| | | | | | | | | | | | | | | | When the match finds a surrogate pair as the first true Unicode character, then we need to skip both code units of the pair in order to restart the search. PCRE2 does not allow us to search for individual UTF-16 code units. That actually means that counting "." gives us the count of Unicode characters. Fixes: QTBUG-110586 Pick-to: 5.15 6.2 6.4 6.5 Change-Id: I194d0a32c94148f398e6fffd173d5b5be8137e19 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QStandardPaths/Unix: fix logic in xdgDataDirs() functionAhmad Samir2023-02-011-18/+25
| | | | | | | | | | | | | This method correctly ignores relative paths (as per the XDG basedir spec), but checking the list of dirs is empty should be moved to after splitting the env var, because even if the env var is not empty, if the paths in it are all relative the resulting list will be empty. Drive-by change: Split some code to a static helper, which will be used in xdgConfigDirs() too. Change-Id: If894751ba68b24ccc214f9a4bb2099be3f0e4349 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Short live q20::construct_at()!Friedemann Kleint2023-02-013-11/+49
| | | | | | | | | | | Move the helper from qsystemsemaphore.cpp to q20memory.h to prevent clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Id0127af1f0d51c87a5887090cc90ab232eff8093 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QDateTime: refactor readInt()Ahmad Samir2023-01-311-49/+67
| | | | | | | | | | | | | QStringView::toULongLong() only works with US-ASCII, so: - Always convert the text to parse to Latin1 - Use qstrntoull and make ParsedInt a typedef of QSimpleParsedNumber<qulonglong> The QStringView overload delegates to the QL1SV after converting the string to latin1. Change-Id: Iff7ac2c0afe6a180ca1b46a09ef0750e9b882c4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: use QtPrivate::qustrchrAhmad Samir2023-01-311-3/+8
| | | | | Change-Id: I3053da3381fbdd22243683f37dd9f55e58c621dc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: change replace_helper() to take a QStringViewAhmad Samir2023-01-311-17/+16
| | | | | Change-Id: Ib3fd5bda96f36bf42da1e5c7230b37fc048c02a4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove wiggly exampleJan Arve Sæther2023-01-312-2/+2
| | | | | | | | | It demonstrates timerEvent() and some QFontMetrics There are other examples that demonstrates this Pick-to: 6.5 Change-Id: I4ad6f30c8ef93c995f980545ed88ab13b9aa9c7d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* MetaObject: Apply some cosmeticsUlf Hermann2023-01-312-3/+7
| | | | | | | | Add missing white space to moc output and list all the values of QMetaObject::Call in the internal documentation. Change-Id: I57d0c5b88bfaee4ca3f2d4604564751b6d0cbe51 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtNetwork/Windows: Add exclusions for CMake Unity (Jumbo) buildsFriedemann Kleint2023-01-311-0/+19
| | | | | | | | | | | | The "interface" define in windows.h causes clashes with variables named "interface". It cannot be undef'ed since the winsock headers also uses it. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Id2daedfd6c57aae39a1fdfe92482f17884b68ef5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Document the shortcut isFile() for "exists and is a file"Andreas Hartmetz2023-01-311-2/+5
| | | | | | | | | One can figure out that something needs to exist in order to be a file, I guess, but the documentation carefully avoided mentioning it. So mention it. Change-Id: I5094d6cb88ce2e58f48d8978c9b858d19d209f92 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove redundant qsharedpointer.h #includesAhmad Samir2023-01-3119-19/+10
| | | | | | | In some cases added #include <QtCore/qshareddata.h>. Change-Id: Idc84c4ad6b0bd58e1a67af335dfcff67fdf80b2a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* jpeg handler: log error message on fatal errorIlya Fedin2023-01-311-0/+1
| | | | | | | | | | | Original libjpeg's handler has output_message call. As Qt doesn't have it, it logs non-fatal error, but skips the fatal ones which are likely more important to be logged than the non-fatal ones. Pick-to: 6.5 Change-Id: Iebb94db4d56705322e7569445d240ca4a7ed8f4a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QString: remove a try/catch from replace_helper()Ahmad Samir2023-01-311-65/+55
| | | | | | | | | | | | | | | I think it was there because of of the QChar array allocated on the heap (to store a copy of the "after" string when it's part of 'this' string) and the subsequent ::free() call; instead split some code to a static helper, and store the copy in a QVarLengthArray; the latter has SSO, so it'll only heap-allocate if needed, and will take care of deleting the data. Remove now unused textCopy() method. Change-Id: Iaf29d19ebd40d24948f0859d80f45e4c16e5bbce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: use QVLA instead of built-in arrayAhmad Samir2023-01-311-64/+24
| | | | | | | | | | | | | | This simplifies the code as a QVLA's size isn't limited to 1024. Also it allows the code to allocate a big enough buffer to hold the result, i.e. no reallocations. insert_helper() takes care of storing a copy of "after" if it points into "this" string; and "before" pointing into "this" isn't an issue since we collected the indices before starting the replacement. Change-Id: I612948187226439349118e65e9525ded2b387da0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: name args in replace() overloads consistentlyAhmad Samir2023-01-311-4/+4
| | | | | Change-Id: I169ecbc4ceaa6eded236fc7421a9eb2e782c6b9a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: use QtPrivate::q_points_into_rangeAhmad Samir2023-01-311-12/+5
| | | | | | | And remove the static helper pointsIntoRange(). Change-Id: Ie34b232d5cafdd92d46fe6c63ab32da4c68631d9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* xkbcommon: make shortcuts persistent across layoutsAndrey Butirsky2023-01-311-36/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | It can happen the same key has different Latin symbols on different layouts: for example, "`" symbol on English layout, no symbol ("^" dead key) on German and ";" symbol on Czech and Hebrew layouts. This creates a problem as these keys will produce different shortcuts depending on what layout is currently active. This patch makes keys generate the same shortcuts corresponding to the first Latin layout configured in the system, independently of layout actually active. For example, when having settings like: setxkbmap -model pc105 -layout "us,de" -option "grp:alt_shift_toggle" After Alt+Shift, the layout changes to de from us. But Ctrl+"^" still generates Ctrl+` shortcut which is from the first(or default) layout. [ChangeLog][QtGui][QXkbCommon] make keys produce the same shortcuts independently of current layout Fixes: QTBUG-108761 Change-Id: Id204a1609ca731f9c56ed3d32847ca18b94be4a0 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
* QtCore: Disambiguate QCalendar locale dataFriedemann Kleint2023-01-316-6/+18
| | | | | | | | | They cause clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ib86442c2d1b9abe57d3536b7a73a5e0ce78ce18d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtNetwork: Disambiguate static variablesFriedemann Kleint2023-01-313-12/+12
| | | | | | | | | They causes clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ifd0539c3b56dc395a860de927736f60ad766224a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtCore: Fix some macro clashesFriedemann Kleint2023-01-315-0/+16
| | | | | | | | | | | | | | The macro decode() in qurlquery.cpp clashes with the static helper function decode() in qurlrecode.cpp. The macro encode() in qurlquery.cpp clashes with QStringEncoder::encode(). Macro CBOR_ENCODER_WRITER_CONTROL is defined with various values in 3rdparty/tinycbor and qcborstreamwriter.cpp. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I8fdf696863e5b1e6fb0c5607b2dd5b46427b9104 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Improve readability of calendrical calculationsEdward Welbourne2023-01-315-67/+111
| | | | | | | | | | | | Use names that give some clue to the meanings of variables and constants. Provide some commentary to help the reader. Extract some functions and constants shared by the Roman-based calendars into a new namespace in qcalendarmath_p.h Purge some unnecessary headers in the process. Change-Id: I6fce18dc29a645f5a6e80ddfea4fd28dd6ecfe73 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Deploy QRoundingDown::qDivMod() in date-time calculationsEdward Welbourne2023-01-315-41/+36
| | | | | | | | | | This saves duplicate computations and incidentally now fixes some overflow issues. In the process, simplify some calendrical calculations. Fixes: QTBUG-109845 Change-Id: Iee331803e8281bbf822a001722a6faa3e66f6322 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Shift the base date for the Gregorian calendar's calculationsEdward Welbourne2023-01-311-4/+8
| | | | | | | | | | Internally it was using the start of March 4801 BCE and then adjusting the year by 4800; instead, use the start of March 1 BCE and save those adjustments. This incidentally aligns better with the Milankovic calendar's calculations. Change-Id: Ic64b4e1d4f65bbf1973a77f830e68f05f7949f4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Shuffle QGregorianCalendar's partsEdward Welbourne2023-01-311-26/+22
| | | | | | | | | | | | | | Before I embark on some cleanup in the calendrical calculations, move julianFromParts() to alongside partsFromJulian() - they're the static methods used to bypass virtuals internally - and pull out a duplicated comment from them to put before both. Move julianDayToDate() to sit with its fellow virtual shim, each calling one of the above, dateToJulianDay(). Change-Id: I581c08bae4c921c4a5cd48eebb66d46035d7d046 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Avoid overflow when computing remainders from QRoundingDown::qDiv()Edward Welbourne2023-01-312-4/+86
| | | | | | | | | | | | | | For a value in the partial interval just before the type's minimum, multiplying the qDiv() result back up by the factor overflows; so take care to adjust the values away from the bound. Introduce qDivMod() to take care of that; in due course, we can also use it where both quotient and remainder are wanted. Done-With: Thiago Macieira <thiago.macieira@intel.com> Change-Id: I541dae559f4f13ddec5b14376d3e22790b78311a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove dead code from QWasmCompositorMikolaj Boc2023-01-311-14/+0
| | | | | | | Some of the fields and functions are not used now. Remove those. Change-Id: I9313eee37374d82de2a1982a54843a70c58af426 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Improve documentation of data-driven testsEdward Welbourne2023-01-312-11/+14
| | | | | | | | | | | Mention addRow() as well as newRow(), even though the example only uses the latter. Link the best-practice section to the fuller story. Fixed a minor grammar glitch in the manual while I was about it. Pick-to: 6.5 Change-Id: Ib1c52cd8d2b6a04ea944d24d9d26c901b6cdf4e7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Rewrite the QtTest best practice guide on testing for warningsEdward Welbourne2023-01-312-15/+40
| | | | | | | | | | | It previously only covered ignoring them; we can now turn them into errors. Expand the section to include some motivation for why it is best practice to purge warnings from test output. That prepares the scene for how to suppress what's expected and make errors of the rest. Pick-to: 6.5 Change-Id: Ieb4b14b2b048d1db2fead004ee7471b82507722f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Object to creating duplicate entries in a test-data tableEdward Welbourne2023-01-312-0/+19
| | | | | | | | | | | | | | | | | | Tero Heikkinen caught tst_QQuaternion() using a duplicated test data tag and was surprised that testlib let it get away with that. That seems like a reasonable thing to discourage. While I'm at it, duplicate columns should be discouraged. [ChangeLog][QtTest] Duplicate data tags are now warned about. Every call to QTest::newRow() or QTest::addRow() should result in a distinct data tag. If they do not, a warning is produced. Likewise, duplicate column names are forbidden; each call to QTest::addColumn() should use a distinct name. Fixes: QTBUG-107185 Pick-to: 6.5 Change-Id: Idfdb7cdfdd71e1fe3db5cadb243eeecc83032922 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Avoid unneccessarily long text scansAllan Sandfeld Jensen2023-01-311-14/+20
| | | | | | | | | | Limit the scans to the processed length. Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-109838 Change-Id: If4b19bf6f97d788d0a227af3a80962bef26016fd Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Replace cargo-cult winrt snippet with unified header-includeMårten Nordheim2023-01-311-9/+1
| | | | | | Pick-to: 6.5 Change-Id: Ide9ec7e4d6c31220fa445d8acb63f7eeca60ab7c Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QtCore/Windows: Fix inconsistent linkage of helper qAppFileName()Friedemann Kleint2023-01-311-1/+1
| | | | | | | | | | | | MSVC is complaining about inconsistent linkage in CMake Unity (Jumbo) builds since the export is not declared. Since it is neither used nor declared in any header, remove the export. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ie6dbad0188b7fa42c0abd40c48cb50129badb38e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtGui: Remove superfluous macro qreal_to_fixed_26_6()Friedemann Kleint2023-01-311-1/+0
| | | | | | | | | | | | It appears to be unused in qpaintengine_raster.cpp and causes clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Initial-patch-by: Amir Masoud Abdol <amir.abdol@qt.io> Change-Id: I51585153ff99812b6539b6268e337e410f2ecc76 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QtGui: Disambiguate static variables in markdown codeFriedemann Kleint2023-01-312-69/+73
| | | | | | | | | | | It causes clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Initial-patch-by: Amir Masoud Abdol <amir.abdol@qt.io> Change-Id: I7d8c7a15dd8d3b7198b5ac1924a0f2bcf4415e06 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QtCore/QCalendarRegistry: Move helper CaseInsensitiveAnyStringViewLessThan ↵Friedemann Kleint2023-01-311-6/+3
| | | | | | | | | | | | | | out of anonymous namespace It causes a warning in CMake Unity (Jumbo) builds: src/corelib/time/qcalendar.cpp:46: warning: QtPrivate::QCalendarRegistry has a field QtPrivate::QCalendarRegistry::byName whose type uses the anonymous namespace [-Wsubobject-linkage] Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ie9598c3e87dd835b06cafe5392766bddc258b5ec Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove the unused QWasmWindow::m_pointerMoveCallbackMikolaj Boc2023-01-311-1/+0
| | | | | Change-Id: Ife43bb8d10b0d89f8364b5e2b4dd5349a7ad1110 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Update Harfbuzz to version 6.0.0Eskil Abrahamsen Blomfeldt2023-01-31293-23042/+33806
| | | | | | | | | | | | | | | | Note: This requires an update to the tst_qtextlayout test, because the test assumed that the Arabic string would always yield a run of two glyphs. This was a side effect of how Harfbuzz handled Qt's test font, which has zero font tables and cannot be used for shaping. With the Harfbuzz update, the Arabic text here yields a single cluster instead, which actually makes more sense, so the test has been made a bit more robust to support both cases. Pick-to: 6.2 6.5 Task-number: QTBUG-110338 Change-Id: I93d4cf8e3046dc93224e144d4c81d86bef4918d1 Reviewed-by: Lars Knoll <lars@knoll.priv.no> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Free the GLX framebuffer configurationsInho Lee2023-01-311-1/+6
| | | | | | | | Adds missing XFree for a glXChooseFBConfig Pick-to: 6.5 6.4 6.2 5.15 Change-Id: I4c30341f90666170dac5d90b0c65d1deff4e0818 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* tracegen: Give warning if flag value is npot2Antti Määttä2023-01-311-2/+2
| | | | | | | | | Flag values can have mask values, which have multiple bits set. Give warning instead of panic if a flag value is not power of two. Pick-to: 6.5 Change-Id: Ie67a5d820203219ce2eb91faf5dea8d6051a5e08 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Cross-reference newRow() and addRow() in QTest docs and improve wordingEdward Welbourne2023-01-311-12/+22
| | | | | | | | | | | | Mitch helpfully pointed out, in review of my change to the "Data Driven Testing" doc that the two functions didn't \sa each other, so I added that. Which naturally prompted a review of their language. Also, split a long line in the code. Pick-to: 6.5 Change-Id: I5f3e973052e0107bd5bdaeecaebe218e043380ff Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Don't implicitly cast BATCHED_TEST_NAME to qstringMikolaj Boc2023-01-311-1/+1
| | | | | | | | | Some tests disable implicit casts from char * to qstring. Use QStringLiteral in qtest.h to avoid compilation problems with such tests. Change-Id: I977b6d90e5a7a8f23298b13789302501606f63d3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QString: move more code to append_helperAhmad Samir2023-01-311-18/+17
| | | | | | | | This simplifies the append overloads. Change-Id: I76b56cb24fdd73018fdffd0ea288024a455bfc4b Reviewed-by: Mate Barany <mate.barany@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use QLatin1 QStringConverter methodsAhmad Samir2023-01-311-3/+1
| | | | | Change-Id: Ie28168250f3cd2a6ffe83f5ed783a1c21b754ee2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: remove private replace_helper() member functionAhmad Samir2023-01-312-88/+85
| | | | | | | | | | | | | | | | | It was private method, only used internally; replaced by a static helper, which allows changing its signature more freely without worrying about BC. We can pass it "this" by reference and the d-pointer via data_ptr(). It can be removed now without breaking BC because we can[1]: Remove private non-virtual functions if they are not called by any inline functions (and have never been). [1] https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C++#The_Do.27s_and_Don.27ts Change-Id: I7c4db42ae332af528e65ffd272f1149b92c01fba Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Fix spelling of QT_TARGETS_FOLDERKai Köhne2023-01-311-1/+1
| | | | | | | Pick-to: 6.5 Change-Id: Ibbbf5629893e7f6b3e4f8dbea7d42deb388c8861 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QUtiMimeConverter: document as public and fix \sinceVolker Hilsheimer2023-01-302-8/+7
| | | | | | | | | | | It's a new public API, so don't document it as internal. Fix the \since to 6.5 - it's an old class under a new name, and make a small language improvement in related documentation. Pick-to: 6.5 Change-Id: I57bfa868f19aa293c01d6a1f8bbbff1bebe7541a Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* QString: don't detach in replace(QChar, QChar, case)Ahmad Samir2023-01-301-20/+32
| | | | | | | | | If the string is shared, instead of detaching, create a new string and copy the characters from this string, replacing the ones matching "before" with "after", to the new string. Change-Id: I2c33690230d40f3121e60e242666460559258b7b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStandardPaths/Unix: minor cleanupAhmad Samir2023-01-301-7/+10
| | | | | | | | | - Better readability by returning early - Make a QRegularExpression static const so that the regex pattern is compiled only once Change-Id: Ic0d6bd4b068624c4ff60c6e71d09f20393adaa64 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVarLengthArray: implement ### Qt 7 remarksThiago Macieira2023-01-301-1/+6
| | | | | | | | The header qvarlengtharray.h isn't listed for the Bootstrap lib, but it is used by several .cpp files that are in that lib (like qstring.cpp). Change-Id: I69ecc04064514f939896fffd172f78e0f4e37391 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove QResourceGlobalData::resourceSearchPathsEdward Welbourne2023-01-301-14/+4
| | | | | | | | | | | The means to add entries to this QStringList were deprecated in 5.13 and removed in Qt 6, so the list is always empty and the one place that still references it only needs to check the empty path it adds to the list. Pick-to: 6.5 6.4 6.3 6.2 Change-Id: Ie1b3f13b33c04458bd03a4a1e3db0e33a76e89f6 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>