Commit Graph

9057 Commits

Author SHA1 Message Date
Anton Kudryavtsev
681bd76e67 QStringView, QLatin1String: add indexOf methods
[ChangeLog][QtCore][QLatin1String] Added indexOf().

[ChangeLog][QtCore][QStringView] Added indexOf().

Change-Id: I9f56e5b40030e39b29e50914a46beb58013b537b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-10 07:16:42 +00:00
Jan Arve Saether
2b7edd0534 Fix bug with QLayout::replaceWidget(a, a)
It should effectively leave the layout untouched

Fixes: QTBUG-69706
Change-Id: I4d8232895bf1d1ae0d1b73156ef6ec6001d8968a
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2019-05-09 12:01:38 +00:00
Shawn Rutledge
7dd71e8125 Markdown: blockquotes, code blocks, and generalized nesting
Can now detect nested quotes and code blocks inside quotes, and can
rewrite the markdown too.

QTextHtmlParser sets hard-coded left and right margins, so we need to do
the same to be able to read HTML and write markdown, or vice-versa,
and to ensure that all views (QTextEdit, QTextBrowser, QML Text etc.)
will render it with margins.  But now we add a semantic memory too:
BlockQuoteLevel is similar to HeadingLevel, which was added in
310daae539 to preserve H1..H6 heading
levels, because detecting it via font size didn't make sense in
QTextMarkdownWriter.  Likewise detecting quote level by its margins
didn't make sense; markdown supports nesting quotes; and indenting
nested quotes via 40 pixels may be a bit too much, so we should consider
it subject to change (and perhaps be able to change it via CSS later on).
Since we're adding BlockQuoteLevel and depending on it in QTextMarkdownWriter,
it's necessary to set it in QTextHtmlParser to enable HTML->markdown
conversion.  (But so far, nested blockquotes in HTML are not supported.)

Quotes (and nested quotes) can contain indented code blocks, but it seems
the reverse is not true (according to https://spec.commonmark.org/0.29/#example-201 )

Quotes can contain fenced code blocks.

Quotes can contain lists.  Nested lists can be interrupted with
nested code blocks and nested quotes.

So far the writer assumes all code blocks are the indented type.
It will be necessary to add another attribute to remember whether the
code block is indented or fenced (assuming that's necessary).
Fenced code blocks would work better for writing inside block quotes
and list items because the fence is less ambiguous than the indent.

Postponing cursor->insertBlock() as long as possible helps with nesting.
cursor->insertBlock() needs to be done "just in time" before inserting
text that will go in the block.  The block and char formats aren't
necessarily known until that time.  When a nested block (such as a
nested quote) ends, the context reverts to the previous block format,
which then needs to be re-determined and set before we insert text
into the outer block; but if no text will be inserted, no new block
is necessary.  But we can't use QTextBlockFormat itself as storage,
because for some reason bullets become very "sticky" and it becomes
impossible to have plain continuation paragraphs inside list items:
they all get bullets.  Somehow QTextBlockFormat remembers, if we copy it.
But we can create a new one each time and it's OK.

Change-Id: Icd0529eb90d2b6a3cb57f0104bf78a7be81ede52
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2019-05-08 20:28:53 +00:00
Shawn Rutledge
82b26444a4 Change QTextMarkdownWriter to pass by const pointer and QAIM
- QObjects are always passed by pointer not by reference, by convention
- writeTable() takes QAIM rather than QATM to make testing via
  QStandardItemModel possible in the future

Change-Id: I5bc6b8cd9709da4fb5d57d98fa22e0cb34360944
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2019-05-08 20:28:44 +00:00
Shawn Rutledge
76716c4a9a Markdown: deal with horizontal rules (thematic breaks)
Change-Id: I14d4bcfe1a6c3bd87d1328f0abb81b2138545e4e
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2019-05-08 20:28:37 +00:00
Shawn Rutledge
040dd7fe26 Markdown: fix several issues with lists and continuations
Importer fixes:
- the first list item after a heading doesn't keep the heading font
- the first text fragment after a bullet is the bullet text, not a
  separate paragraph
- detect continuation lines and append to the list item text
- detect continuation paragraphs and indent them properly
- indent nested list items properly
- add a test for QTextMarkdownImporter
Writer fixes:
- after bullet items, continuation lines and paragraphs are indented
- indentation of continuations isn't affected by checkboxes
- add extra newlines between list items in "loose" lists
- avoid writing triple newlines
- enhance the test for QTextMarkdownWriter

Change-Id: Ib1dda514832f6dc0cdad177aa9a423a7038ac8c6
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2019-05-08 20:28:28 +00:00
Joerg Bornemann
ce1830fd21 Migrate Windows system libs to external dependencies
Started-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Change-Id: I211ce3252b836894aeeac1c85eb316d9596bca57
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-05-08 08:30:02 +00:00
Dmitry Kazakov
06b8644953 Fix notification of QDockWidget when it gets undocked
Before the patch the notification was emitted only when the docker
was attached to the panel or changed a position on it.

It looks like the old behavior was documented in a unittest,
so this patch might actually be a "behavior change".

Change-Id: Id3ffbd2018a8e68844d174328dd1c4ceb7fa01d3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-05-07 17:28:23 +00:00
Lars Knoll
92f9842732 Deprecate conversion functions between QList and QSet
Users should use range constructors instead to do the conversion.
Keep conversion methods between QList and QVector as these will turn
into a no-op in Qt 6, whereas forcing people to use range constructors
would lead to deep copies of the data.

Change-Id: Id9fc9e4d007044e019826da523e8418857c91283
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-07 14:15:44 +00:00
Lars Knoll
d510e1e7f9 Add swapItemsAt() to QVector
This closes one compatibility gap with QList, to make
it easier to replace QList with QVector in Qt6.

Change-Id: I5655bc4cd2150a6f09a1ed68c0742f3b42ca47e4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-07 14:15:37 +00:00
Liang Qi
c2b553784d Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	src/corelib/kernel/qobject.cpp
	src/corelib/kernel/qvariant.h
	src/corelib/tools/qlist.h

Done-With: Milian Wolff <milian.wolff@kdab.com>
Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io>
Change-Id: I6803f7239aa137a51a7467fab7cc7a01302a848d
2019-05-07 11:58:30 +02:00
Lars Knoll
0b373c2e36 Don't rely on functions that are deprecated
Change-Id: I4150368e44b43e45f3604bf0fc7dab38a15e5ec9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-06 20:04:51 +00:00
Lars Knoll
5ced1ff9fc Fix compilation with Qt 6
Change-Id: Ie165ab2f17740a996112b7e918b595d5873674a1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-06 20:04:45 +00:00
Lars Knoll
08101b2b27 Fix qplugin.h for Qt 6
Change-Id: I3ae6594a2982f990a5b3851a063b0b2f02d16bd9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-05 17:34:57 +00:00
Lars Knoll
82ddecfb17 Deprecate {to,from}Std{List,Vector}
ask our users to use the range constructors instead. This will allow
us to remove the include dependency towards <list> and <vector> in
Qt 6.

Change-Id: Id90f2058432e19941de1fa847100a7920432ad71
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-05 17:34:43 +00:00
Lars Knoll
e3b55616e2 Prefix QTextStream operators with Qt:: in tests
Change-Id: I852f016fcb619a9e634deee6efb1fe7930d974c8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-05-03 09:36:36 +00:00
Lars Knoll
f27f89f335 Don't use deprecated API
Change-Id: Ic56c22a1be5e69b371991c3e9ad98a1106848e78
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-03 09:36:22 +00:00
Liang Qi
b5c2535eb0 Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/3rdparty/pcre2/qt_attribution.json

Change-Id: Ibae941cb12662f27bd6962ee02bc235971c59a15
2019-05-03 10:44:24 +02:00
Allan Sandfeld Jensen
d775b1fcb3 Remove handling of missing Q_COMPILER_INITIALIZER_LISTS
Change-Id: Id65b39c787235a051262544932e6717d076f1ea0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-02 23:10:55 +00:00
Allan Sandfeld Jensen
78a7e54f8f Custom color-space based on chromaticities
Change-Id: I7fa6efa8993aa2b79ea60b6a21bf57c4f67a120f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-05-02 20:50:46 +00:00
Robert Loehning
884dc0be7f Remove redundant file from tests
Change-Id: Icb398f1ba32dd1cc3a1e042818750c253539fae3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-05-02 14:40:14 +00:00
Paul Lemire
389dec3e7c Only generate temporaries when it makes sense
- Never for global inputs
- Otherwise only if the temporary is referenced more than once
  -> meaning it's actually caching the result of some operation

Tests updated accordingly.

Change-Id: Ic76615370d23dee3965ca6350d5257a8be5a3e22
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2019-05-02 12:47:05 +00:00
Liang Qi
166889ddcb Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/corelib/kernel/qobject.cpp

Change-Id: I8ca1163a1fa8072dcd16ea4426c58219149599fd
2019-05-02 09:39:31 +02:00
Shawn Rutledge
355ecfb11c Add QTextMarkdownWriter::writeTable(QAbstractTableModel)
This provides the ability to write live data from a table to Markdown,
which can be useful to load it into a text document or a wiki.
But so far QTextMarkdownWriter is still a private class, intended to be
used experimentally from QtQuick and perhaps later exposed in other ways.

Change-Id: I0de4673987e4172178604e49b5a024a05d4486ba
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-05-02 04:10:35 +00:00
Alexander Volkov
ef3daddae1 Use QPlatformTheme::TouchDoubleTapDistance for touch events
... and update the cached values on theme change.

Modify tst_QWidget::touchEventSynthesizedMouseEvent()
to avoid unexpected double click detection.

Change-Id: I151c47e851ebba7550b1b09caca2781c28d7d3d9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-05-01 20:29:16 +00:00
Allan Sandfeld Jensen
b32b61f17e Remove handling of missing Q_COMPILER_RVALUE_REFS
Remove remaining handling of missing support for rvalue refs.

Change-Id: I78bab8bccfeeb9c76f464f345874364a37e4840a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-01 20:24:45 +00:00
Giuseppe D'Angelo
d4435a37ca Add qobject_cast operators for std::shared_ptr
Mimicking what we currently have for QSharedPointer, but also adding
* snake_case version (matching the ones in std)
* rvalue-overloaded versions (matching the C++2a overloads).

[ChangeLog][QtCore][QSharedPointer] Overloads of
qSharedPointerObjectCast have been added to work on std::shared_ptr.

Change-Id: I26ddffd82b000bf876e7c141fdce86a7b8c1d75a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-01 18:37:32 +00:00
Shawn Rutledge
23c2da3cc2 Add QTextMarkdownWriter, QTextEdit::markdown property etc.
A QTextDocument can now be written out in Markdown format.

- Add the QTextMarkdownWriter as a private class for now
- Add QTextDocument::toMarkdown()
- QTextDocumentWriter uses QTextMarkdownWriter if setFormat("markdown")
  is called or if the file suffix is .md or .mkd
- Add QTextEdit::toMarkdown() and the markdown property

[ChangeLog][QtGui][Text] Markdown (CommonMark or GitHub dialect) is now
a supported format for reading into and writing from QTextDocument.

Change-Id: I663a77017fac7ae1b3f9a400f5cd357bb40750af
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2019-05-01 14:31:27 +00:00
Volker Hilsheimer
78d0b6e975 Ignore failing test for free space on APFS
The file system appears to cache too aggressively, so if the reported
storage size doesn't change after flushing to disk, ignore the failure.

Change-Id: Iba7dce79591447fac296bfe92c2dc993d36d0c2a
Fixes: QTBUG-69868
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-30 10:58:13 +00:00
Joerg Bornemann
0e4326d717 Remove cruft from testProcessEOF.pro
TEMPLATE_PREFIX is gone since Qt 5.0.0.

Change-Id: I181962b942191187baf62f13d0abd17e7ebdcce1
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-04-30 10:51:02 +00:00
Tony Sarajärvi
3308a81942 Extend blacklisting of setWindowState to cover RHELs
Task-number: QTBUG-68864
Change-Id: I7503877fbbe6109806d9fd087514588d2ac640c7
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2019-04-29 17:11:08 +00:00
Jesus Fernandez
d647cf85fa Tests: Simplify MyCookieJar
Don't reimplement the protected functions in the base class just
override the access with the using keyword.

Change-Id: I323487d9ddb1d458d5faca020c3eb4d931a9b226
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-04-29 14:11:00 +00:00
Qt Forward Merge Bot
4a54e8fd82 Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: Ic712e8a84b01b212bb1121d7a2c9b85e0d2da9da
2019-04-29 01:00:22 +02:00
Qt Forward Merge Bot
9f1a1e320c Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Ibce9bfef928ce39070183c488ce86ae32e5ea705
2019-04-28 01:00:26 +02:00
Qt Forward Merge Bot
03f7d0a005 Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: I1c9449ab064deed1367a7e5dbedfcb489f28140e
2019-04-27 01:00:11 +02:00
Lars Knoll
b4cc294347 Fix page breaking with large images
Don't go into an infinite loop breaking pages, when an image is about
as large as the page. Correctly take top and bottom margins into account
when calculating whether the image could fit on one page.

Amends change 416b4cf685.

Fixes: QTBUG-73730
Change-Id: Id311ddf05510be3b1d131702f4e17025a9861e58
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-04-26 18:21:18 +00:00
Tony Sarajärvi
902ae438aa Extend blacklisting of dirsBeforeFiles as it's flaky
Task-number: QTBUG-75452
Change-Id: I4b35dfff6c0a888e62441e51985e0bccb2081be1
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2019-04-26 16:41:51 +00:00
Eirik Aavitsland
ecfda0d523 Fix manual lance test: avoid using deprecated api
...and other slight modernizations and minor fixes.

Change-Id: Ide587d9fe59ca9113ae775882c99a50debaf9000
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-04-26 07:47:12 +00:00
Qt Forward Merge Bot
0dff40adf8 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I6ecf7074eda57ef4954fb3fdc7a6d1e8cd229340
2019-04-26 01:00:13 +02:00
Christian Ehrlicher
c530ca1c17 QLineF: add intersects() as a replacement for intersect()
QLineF::intersect() does not follow the naming rules for functions.
Therefore add a replacement function intersects() instead and also
rename the return type from IntersectType to IntersectionType

[ChangeLog][QtCore][QLineF] added QLineF::intersects() as a replacement
for QLineF::intersect()

Change-Id: I744b960ea339cb817facb12f296f78cca3e7d938
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
2019-04-25 17:58:40 +00:00
Ryan Chu
658f12d735 Expose docker test server as an internal config to all modules
Before testserver becomes a stable feature, let's keep testserver.prf in
"mkspecs/features/unsupported". The test server's shared files will be
stored in "mkspecs/features/data/testserver".

Because the path of testserver has been changed, all the tests relying
on the docker servers should be updated as well.

Change-Id: Id2494d2b58ee2a9522d99ae61c6236021506b876
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-04-25 15:33:06 +00:00
Ryan Chu
713f77176e Support multi-stage builds to provision the configurations and test data
In order to reuse the test server to the external modules, it is much
easier to share the common configurations (scripts) and test data via
Dockerfile. In addition, the external module can create more layers
depending on their needs. Therefore, supporting multi-stage builds is
needed. The disadvantage is that the docker-compose needs to re-build
the images every time. However, it is just a one-time effort. If the
Dockerfile doesn't get changed, the extra build time can be ignored.

Because of multi-stage builds, the test server will keep a Dockerfile at
least. Therefore, the volume sharing is no more needed. The test data of
a service can be added into the images by using COPY/ADD commands.

NOTE:
This patch relies on docker-compose v1.21.0 (docker-compose build now
supports the use of Dockerfile from outside the build context).

Change-Id: Ib3f6a5fcf6979732ae8a40a494a1360fca4ac7bf
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-04-25 15:32:57 +00:00
Eirik Aavitsland
d6c3fa6e0c Fix aliased painting with non-uniform scaling
The full stroker does not produce good results for aliased lines
thinner than 1 pixel. Avoid it by making sure that such thin lines
are painted by the cosmetic stroker, even when they have
non-uniform transformation.

Fixes: QTBUG-73866
Change-Id: I7b5f0fa555903246e0c3fd92cd435cc8c0b15a24
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-04-25 06:07:00 +00:00
Marc Mutz
e6d9617c79 QHash/QMultiHash: add range constructors
QMap and QMultiMap will go in a separate commit, due to QMap's
insertion behavior that "reverses" the inserted elements.

[ChangeLog][QtCore][QHash] Added range constructor.

[ChangeLog][QtCore][QMultiHash] Added range constructor.

Change-Id: Icfd0d0afde27792e8439ed6df3e8774696b134d3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-25 00:10:03 +00:00
Edward Welbourne
80853afd73 Add startOfDay() and endOfDay() methods to QDate
These methods give the first and last QDateTime values in the given
day, for a given time-zone or time-spec.  These are usually the
relevant midnight, or the millisecond before, except when time-zone
transitions (typically DST changes) skip it, when care is needed to
select the right moment.  Adapted some code to make use of the new
API, eliminating some old cruft from qdatetimeparser_p.h in the
process.

[ChangeLog][QtCore][QDate] Added startOfDay() and endOfDay() methods
to provide a QDateTime at the start and end of a given date, taking
account of any time skipped by transitions, e.g. a DST spring-forward,
which can lead to a day starting at 01:00 or ending just before 23:00.

Task-number: QTBUG-64485
Change-Id: I3dd7a34bedfbec8f8af00c43d13f50f99346ecd0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-24 13:09:26 +00:00
Edward Welbourne
3abfa4dfff QtTestLib: handle float16 the same as double and float
In QCOMPARE, handle NaNs and infinities the way tests want them
handled, rather than by strict IEEE rules. In particular, if a test
expects NaN, this lets it treat that just like any other expected
value, despite NaN != NaN as float16 values. Likewise, format
infinities and NaNs specially in toString() so that they're reported
consistently.

Enable the qfloat16 tests that depend on this QCOMPARE() behavior.
Refise the testlib selftest's float test to test qfloat16 the same way
it tests float and double (and format the test the same way).

This is a follow-up to 37f617c405.

Change-Id: I433256a09b1657e6725d68d07c5f80d805bf586a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-24 13:09:15 +00:00
Edward Welbourne
934000c11a Implement qFpClassify(qfloat16)
This extends support for qfloat16 sufficiently for the things testlib
needs in order to treat it as a first-class citizen.  Extended tests
for qfloat to check qFpClassify() on it.

Change-Id: I906292afaf51cd9c94ba384ff5aaa855edd56da1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-24 13:08:52 +00:00
Edward Welbourne
2eb849ed51 Implement std::numeric_limits<qfloat16>
This shall make it more nearly a first-class numeric type; in
particular, I need some of these for testlib's comparing and
formatting of float16 to handle NaNs and infinities sensibly.

Change-Id: Ic894dd0eb3e05653cd7645ab496463e7a884dff8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-24 13:08:43 +00:00
Liang Qi
dc37318684 Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	src/gui/util/qshaderformat.cpp
	src/gui/util/qshaderformat_p.h
	src/widgets/graphicsview/qgraphicsitem_p.h

Change-Id: Idafd88eb9a0a15b4af29f6143d009c1ec8ceecca
2019-04-24 09:52:30 +02:00
Edward Welbourne
9dfc2aa75d Purge use of some deprecated methods from QDateTime tests
QDateTime's short names setUtcOffset() and utcOffset() have been
deprecated since 5.2, in favor of setOffsetFromUtc() and
offsetFromUtc().

QDate's shortDayName() and shortMOnthName() have been deprecated since
5.10, in favor of QLocale's dayName() and monthName().  Also, the
tests that were using them are testing methods only present when the
datestring feature is enabled; so condition them on that feature.

Change-Id: Ibfd4b132523ca8fbc1cb163353a44e0500877fd5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-23 17:31:21 +00:00