QScreen::grabWindow() is not always reliable because it grabs from the
framebuffer. (The window might then be covered by other windows, e.g.
"Stays on top"-Windows, popups etc).
If QScreen::grabWindow() fails we therefore fallback to
QWidget::grab(). This will not grab from the frame buffer, but it will
ask the widget to render itself (with its current state) to a pixmap
and return it.
QWidget::grab() should usually return the expected pixmap, and the
pixmap it gives is not subject to the state of the window manager.
This means that both QScreen::grabWindow() *and* QWidget::grab()
must produce an unexpected pixmap in order for the test to fail.
Change-Id: I276554155bb1e5b510d2a2d43628d91669464fe2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Code units 0xD800 .. 0xDFFF are not UCS-4, so we can't happily return them.
Instead, if we encounter a stray surrogate, replace it with 0xFFFD, which
is what Unicode recommends anyhow.
References:
§3.9 Unicode Encoding Forms
D76: Unicode scalar value: Any Unicode code point except high-surrogate
and low surrogate code points.
As a result of this definition, the set of Unicode scalar values consists
of the ranges 0 to D7FF_16 and E000_16 to 10FFFF_16, inclusive.
[...]
UTF-32 encoding form: The Unicode encoding form that assigns each Unicode
scalar value to a single unsigned 32-bit code unit with the same numeric
value as the Unicode scalar value.
§ C.2 Encoding Forms in ISO/IEC 10646
UCS-4. UCS-4 stands for “Universal Character Set coded in 4 octets.” It is
now treated simply as a synonym for UTF-32, and is considered the canonical
form for representation of characters in 10646.
§ 3.9 Unicode Encoding Forms (Best Practices for Using U+FFFD)
and
§ 5.22 Best Practice for U+FFFD Substitution
Whenever an unconvertible offset is reached during conversion of a code
unit sequence:
1. The maximal subpart at that offset should be replaced by a single
U+FFFD.
2. The conversion should proceed at the offset immediately after the
maximal subpart.
[...]
Whenever an unconvertible offset is reached during conversion of a code
unit sequence to Unicode:
1. Find the longest code unit sequence that is the initial subsequence of
some sequence that could be converted. If there is such a sequence, replace
it with a single U+FFFD; otherwise replace a single code unit with a single
U+FFFD.
2. The conversion should proceed at the offset immediately after the
subsequence which has been replaced.
[ChangeLog][QtCore][QString] QString::toUcs4 now does not return invalid
UCS-4 code units belonging to the surrogate range (U+D800 to U+DFFF)
when the QString contains malformed UTF-16 data. Instead, U+FFFD
is returned in place of the malformed subsequence.
Change-Id: I19d7af03e749fea680fd5d9635439bc9d56558a9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
That commit made QString::toXxx (8-bit) functions use C++11 ref
qualifiers, so we need to match it here.
Change-Id: I45b50464d36f858d012b12e0cb511aae347ddb6f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
UCS-4 iterator over a QString.
Kept private for now so we can still work on the API.
Done-with: Thiago
Change-Id: I377f8bb1921e591ee3292c08c3e097fb6bc7f0c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Because they make sense. I'm even thinking that the char16_t version
should get a QString implicit constructor. Maybe both encodings.
Change-Id: Ifffc61dd890795fbbbd5f7cb5efb3e6287d1270e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Showing, moving and resizing
Contrarily to what an NSWindow does to its NSViews, child NSWindows need
to be explicitly shown and hidden, and clipped if the parent NSWindow
changes geometry. Also, hiding an NSWindow will not hide its child
windows. This needed to be managed manually, adding 2 additional states
to QCocoaWindow to reflect whether a child window has been clipped out by
any ancestor geometry change, or hidden by any ancestor being hid. Also,
ordering out an NSWindow will remove it fromm its parent's child windows
array, making necessary to maintain a parallel list of child windows in
QCocoaWindow.
Stack order
Although child NSWindows can be ordered relatively to each other, they
need to be added again to be moved lower in the window stack. This also
means the windows above it need to be added on top.
Key (focus) status
One of the remaining issues, is to make sure the top level window keeps
the "key status" while still forwarding key events to the child window.
Keeping same event propagation
This use case is best illustrated with undocking QDockWidgets (if these
are child NSWindows). The main issue is to make sure the QDockArea will
get the mouse events right after undocking a dock widget. We used a similar
workaround as the "key status" problem, and manually forward the mouse
events to the dock area's QWindow.
Manual test, by Morten Johan Sørvig, included.
Task-number: QTBUG-33082
Task-number: QTBUG-22815
Change-Id: I50e34936fb82bff013e99f4bcb3bd0db0704c6ae
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Make the printer selection option api public on Windows to be
consistent with Mac, and with the print program api which is already
public.
Change-Id: I3da9684288348eaa43276ca8534a1d5809f7027b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Add support to the Mac and Windows print engines to preserve the
creator name when switching between native and pdf format.
Change-Id: Ie036af3140f24d8e34aa886f091384f93aa0157b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Mac supports Collate Copies using native api, so add support. Note
this is mostly only useful for setting the print dialog default, as
Mac supports server-side multiple copies so the app will never need to
collate the copies itself.
Change PDF and Windows to default to collate true to match Mac as this
is the behavior users expect.
Task-number: QTBUG-27724
Task-number: QTBUG-35251
Task-number: QTBUG-22144
Change-Id: Ia43dbc260b3a71aa5b267cca54c168ffbea794fc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Add support to the Mac print engine for set/get the Document Name using
the Job Name setting. Our documentation states this is one use that the
document name will be put to so is appropriate to be used.
Change the Windows print engine to default to a blank Docuemnt Name
consistent with the other print engines. If still blank when printing
then use a default value.
Task-number: QTBUG-27724
Task-number: QTBUG-22144
Change-Id: If590811b5720e6f759eabc290b578b94e221f9f4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
The PrintEngine keys are not consistently treated across the platforms
and are not properly tested. Start the process of making the print
engines behave consistently by documenting and testing the current
behavior. Ensure all unsupported features return a consistent
default value.
The auto test for valuePreservation() has been flaky depending on the
platform and installed printers so remove it and replace it with more
complete testing. If no native printers available then don't test
the native engines.
Fixes for the individual inconsistent keys will follow.
Task-number: QTBUG-26430
Change-Id: Iab914d7e0a5ae4a2cdc24c8645751f0910cf440c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This fixes the following case:
<blockquote>
<span />Foobar
</blockquote>
Qt would see the end of <span>, and consider the current block
tag as closed, thus resetting the block format, thus losing the
margin set for the current block (due to blockquote).
If you do
<blockquote>
<span>Foo</span>Foobar
</blockquote>
instead, then the same would not happen, since hasBlock is set
to false when we append text to the current inline node.
[ChangeLog][QTextDocument] Add support for empty inline elements
in block tags.
Task-number: QTBUG-33336
Change-Id: Ic566edfec96cb8d44d1c02932bb195bc921d1580
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
It was impossible to hide/show the close button after a QMdiSubWindow
was created.
Task-number: QTBUG-9933
Task-number: QTBUG-27274
[ChangeLog][QtWidgets][QMdiSubWindow] Fixed setWindowFlags() for QMdiSubWindow.
Change-Id: I7db9a1bef5ba8a8ace729acb85682c8b3de9c33c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Add overloads to the find() methods in QPlainTextEdit and QTextEdit
that find the next occurrence matching the passed regular expression.
These are convenience methods that eliminate the need to use the
document() method and the need to handle the QTextCursor return value.
[ChangeLog][QtWidgets][QPlainTextEdit] Added find method overload using QRegExp
[ChangeLog][QtWidgets][QTextEdit] Added find method overload using QRegExp
Change-Id: Ia6139b771e3ae4ca02e4b8ea7fde19e5dc71b9d8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
When drawing to and from the less common formats most of the cpu time
is spend in conversion. The conversion method is rather slow due to
using variable shifts and masks that the compiler does not have a chance
to optimize.
This patch changes the conversion methods to being templates fed by
constexpr methods. This allows the compiler to fully optimize the methods
yielding 2x->5x speedups.
The reliance on constexpr however means the optimized methods are only
used under C++11.
Change-Id: I2ec77c4c1c03f12ee463a694a2b59db0f0b52db1
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This makes the font merging possible and solves an issue
with the default font properties inheritance when used
in conjunction with QTextFormatCollection.
Change-Id: If8b543c011122dde9f086f5d696df3b042f7b90c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
introduced by b0b22e8d49 .
Change-Id: Ia57331ce9373a414f2bc56962412f20ef83bd7ca
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This simplifies the code a lot and avoids silly mistakes where a
specific integer type is missing (such as char16_t).
Change-Id: Id91dfd1919e783e0a9af7bfa093ca560a01b22d1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
...and thus consume 4 bytes less per glyph and increase the performance a bit.
It seems, the only CTFontGetAdvancesForGlyphs() returns both x and y
advances, though y advances are always equal to 0 for horizontal
orientation and x advances are always equal to 0 for vertical orientation.
Also, rename `advances_x` to `advances` for consistency
and declare QGlyphLayout's data size in a single place.
Change-Id: I56b20f893f8a6feb7aa870e3edbca99dd93ba2e2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
A few more HTTP status codes from the 4xx and 5xx series have been
added to QNetworkReply::NetworkError.
For content errors, the following codes have been added:
1. 409 - Resource Conflict
2. 410 - Resource Gone
For server related errors, the following codes have been added:
1. 500 - Internal Server Error
2. 501 - Operation Not Implemented
3. 503 - Service Unavailable
Few of the above codes are quite possible when communicating with REST
based services.
NOTE:
=====
* HTTP error status 400 is interpreted as
QNetworkReply::ProtocolInvalidOperationError.
* QNetworkReply::UnknownServerError is returned for all server related
errors (5xx) not listed above.
[ChangeLog][QtNetwork][QNetworkReply] Added more (specific) HTTP status
codes to NetworkError enum.
Task-number: QTBUG-30880
Change-Id: I9d2a133f6b3869f26710c6eb930dd8b08df31108
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
This aimed to disctinct joining types "L", "T", and "U" from just "U".
Unicode 6.3.0 has introduced a character with joining type "L" and
Unicode 7.0 will add a few more characters of joining type "L", so
we'll have to deal with it anyways.
[ChangeLog][QtCore][QChar] Added JoiningType enum and joiningType()
method that deprecates the old QChar::Joining enum and joining() method.
Change-Id: I4be3a3f745d944e689feb9b62d4ca86d1cf371b0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Currently QImage::pixel() returns the raw underlying pixel values for
RGB32. For all other pixel formats the returned value is either valid
ARGB32 or ARGB32PM.
This patch masks the undefined alpha field in RGB32 so that the return
value is well defined QRgb. It also fixes one test that relied on the
previous behavior.
Change-Id: If37463528268b7419733499d1f7bfd0d1097d21e
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Currently INV_PREMUL rounds strictly down. While PREMUL rounds evenly.
This patch adds 0x8000 to the intermediate results in INV_PREMUL before
right shifting, thereby achieving even rounding.
The rounding also makes PREMUL(INV_PREMUL()) into an identify operation,
which means we can safely convert ARGB32PM to ARGB32 and back without
ever losing color details. A test is added to verify this.
Change-Id: I1267e109caddcff0c01d726cb5c1c1e9fa5f7996
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
q_func() which is declared in Q_DECLARE_PUBLIC is usually private.
We should use q_ptr directly in QObjectPrivate::connect, otherwise
it does not compile when trying to access the private q_func
Change-Id: I235165a0994327102dbb31c390c2cafdffe806dc
Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This patch adds tests for the consistent handling of transparent
drawing results on opaque formats that was introduced with commit
6f7d370ade
Change-Id: If5d11d0f2e111ef88490a4dc20a64b0858ad5426
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This patch fixes an issue when a font that was added with QFontDatabase::addApplicationFont
can not be removed any more.
The reason for that is that QFontconfigDatabase::addApplicationFont adds the font to the FontConfig
application set from where it cannot be removed any more and is picked up every time the font database is
repopulated (e.g. after a call to QFontDatabase::removeApplicationFont).
This also fixes the QFontDatabase autotest which unfortunately does not fail on linux, because it tries
to add "FreeMono" (which in most cases is already there as a system font). So this patch removes FreeMono and adds
LED_REAL as test font.
Change-Id: I2fa5f4df0ad2099ac28673760ea25234c725dfc6
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Most of the test is executed in RTL mode since it is never restored.
Task-number: QTBUG-36395
Change-Id: I110966085a5a265f093fc4479eebc1f1bf0614c1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The tests then have a predictable, stable environment and do not depend
on file system operations.
Task-number: QTBUG-23697
Change-Id: Ibbd356f8bd7419ec4a3a88d2c0b5cd0830049790
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Implemented that way in src/widgets/widgets/qmdisubwindow.cpp:2081.
Change-Id: I82fdf0c04f1655a130c5e6a6f1e23d325d546ab3
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
The support for QArrayData variadic arguments without C++11 for GCC
has been removed in commit 69478da0f0 . Change the autotest to reflect
that, too.
Change-Id: I40468f5d67cb2db553fd7a7d5b604f46403ac538
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add ref qualified versions of QImage::convertToFormat, so that a
temporary QImage can be converted in-place to a format of equal depth.
[ChangeLog][QtGui][QImage]Added rvalue qualified convertToFormat method
for in-place conversion
Change-Id: I2eed5ffd63f5aea4ffa1147bf7607b02a49d9c5d
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
According to my profiling of Qt Creator, qHash and the SHA-1 calculation
are the hottest spots remaining in QtCore. The current qHash function is
not really vectorizable. We could come up with a different algorithm
that is more SIMD-friendly, but since we have the CRC32 instruction that
can read 32- and 64-bit entities, we're set.
This commit also updates the benchmark for QHash and benchmarks both
the hashing function itself and the QHash class. The updated
benchmarks for the CRC32 on my machine shows that the hashing function
is *always* improved, but the hashing isn't always. In particular, the
current algorithm is better for the "numbers" case, for which the data
sample differs in very few bits. The new code is 33% slower for that
particular case.
On average, the improvement (including the "numbers" case) is:
compared to qHash only QHash
Qt 5.0 function 2.54x 1.06x
Qt 4.x function 4.34x 1.34x
Java function 2.71x 1.11x
Test machine: Sandybridge Core i7-2620M @ 2.66 GHz with turbo disabled
for the benchmarks
Change-Id: Ia80b98c0e20d785816f7a7f6ddf40b4b302c7297
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Allows us to sanity check the iOS build in the CI.
Change-Id: I16f9bfafef3988dcab6efd3155503ca0d0b4d1d8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Moc should check full scope of any related objects or
gadget when it constructs extra data.
Change-Id: Ibd1b607a389cd4e788c0916984464cd9103d9c59
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Add support for using qCDebug and friends in the 'printf style' way.
This allows an almost mechanical conversion of existing qDebug, qWarning,
qCritical macros, and allows avoiding the size overhead the streaming
style incurs (mostly due to inlined QDebug code).
To handle this gracefully we require variadic macros (part of
C++11/C99). For compilers not supporting variadic macros we fall back
to checking the category in QMessageLogger.
[ChangeLog][QtCore][Logging] Allow qCDebug macros to be used in a printf
style.
Change-Id: I5a8fb135dca504e1d621bb67bf4b2a50c73d41b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Task-number: QTBUG-35743
[ChangeLog][QtTest][Windows] Use correct UTF-8 encoding for XML test results on platforms with different console encoding.
Change-Id: Ice9d03192098f931e5dac358928e0c4421ab715e
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Any cipher that is < 128 bits is excluded from the default SSL
configuration. These ciphers are still included in the list
of availableCiphers() and can be used by applications if required.
Calling QSslSocket::setDefaultCiphers(QSslSocket::availableCiphers())
will restore the old behavior.
Note that in doing so I spotted that calling defaultCiphers() before
doing other actions with SSL had an existing bug that I've addressed
as part of the change.
[ChangeLog][Important Behavior Changes] The default set of
ciphers used by QSslSocket has been changed to exclude ciphers that are
using key lengths smaller than 128 bits. These ciphers are still available
and can be enabled by applications if required.
Change-Id: If2241dda67b624e5febf788efa1369f38c6b1dba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
That way we can avoid name conflict with a namespace defined in
a different moc test
Change-Id: Id631d7c5556c9d6940e16dc53eb438dbcd0095eb
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>