The color values of ppm and pgm images can be either 8 or 16 bits.
They can also be scaled to a smaller max value, and they can be
expressed either binary or ascii. For some of these permutations, Qt's
image handler lacked implementation or would decode the wrong color
value. This commit fixes that.
Task-number: QTBUG-18262
Task-number: QTBUG-35990
Change-Id: I7cf11c2366244f3a9b31c1a565a81e2658bc6a51
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in
qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess
headers, exclude the sources from compilation when switched off, guard
header inclusions in places where compilation without QProcess seems
supported, drop some unused includes, and fix some tests that were
apparently designed to work with QT_NO_PROCESS but failed to.
Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
operator=, which was only used for clearing, wasn't clearing the hash.
This led to a mismatch between the vector and the hash (given that the hash
points into the vector).
Spotted by interrupting kmail in gdb, and it was in this code
iterating over a 2000 entries hash (the first vector entries not matching
the hash, this code keep appending new entries for the same formats).
This fixes QTBUG-8862 again, the initial fix having been accidentally
reverted in 467b15a.
Change-Id: Ia34b3d002a0199e1930431a4bbdb2ec981ed4ffc
Task-number: QTBUG-8862
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We can defer the creation until the window is shown.
Change-Id: I3d5b45ae59ee0925996cf12cd46dd574c8c6ef95
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Remove the line setting the DPR from the source; the image
is moved.
Task-number: QTBUG-58653
Task-number: QTBUG-58645
Change-Id: I2de94681459dba1d69dee06da44617fb9fa35bcc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
When calculating the width of a text for drawing decorations on top,
we use the effective advance of the whole text after it has been
through the shaper.
However, in the case of QStaticText and QGlyphRun, there is shortcut:
Since we only have the glyph indexes and position of each glyph,
we use the position + advance of the right-most glyph to find the
right-most edge of the decoration. For this, however, we use the
advance of the glyph *out of context* of the rest of the string,
because the whole idea is to avoid doing the shaping of the string
with every draw call. In some rare cases, the advance of the
right-most character, in the context of the string, is different
from the advance of the standalone glyph.
Now, one way of fixing this would be to store the width of the
text in QStaticText and QGlyphRun, but since it is a very rare
artifact which is barely visible, I have opted to just work around
it in the test instead, the workaround being to force integer
metrics so that we don't get the small 0.2 pixel error.
Task-number: QTBUG-55217
Change-Id: I8d16d52f2ef27275cabb7d3865aeeaa31617ba3d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Recent HB changed the way of handling ZWJ/ZWNJ to be more in par
with other engines.
Change-Id: I8abacd195e4b247c8fa6d91ef1086e74da0a1efb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
The QFontMetricsF version of the test should not truncate the
returned values, as the results may then be wrong.
Change-Id: I17f97f846bb723709e695e8866e437d6888d275b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
OpenSUSE has a bitmap font called "Waree" while the test
is created for the TrueType font which is available on Ubuntu.
The style names are different, so we can use that to check
that we have the right one.
Change-Id: I808d0d1ecde9f10ed7730dc76ab3818490002ba9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Qt already supports high DPI icons using the “@nx” approach, where the
device pixel ratio that the image was designed for is in the file
name. However, our implementation of the freedekstop.org Icon Theme
specification did not support the Scale directory key:
https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout
This meant that users creating icons via QIcon::fromTheme() did not
get high DPI support. This patch fixes that.
[ChangeLog][QtGui][QIcon] Implemented support for Scale directory key
according to Icon Theme Spec. Icons created via QIcon::fromTheme()
now have high DPI support by specifying the Scale in the appropriate
entry of the relevant index.theme file.
Task-number: QTBUG-49820
Change-Id: If442fbc551034166d88defe607109de1c6ca1d28
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Amends 7896ae052a. The previous change
focused only on ZWJ and ZWNJ, but there are many other formatting characters
that we need to support and that may be rejected by the German keyboard-hack.
This opens up for all characters in the Other_Format category.
Task-number: QTBUG-58364
Change-Id: Idd967a9ae5b12060c851f6030b7e019508561696
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Use the new QImage method instead of operating on private API.
At the same time the code is improved to ensure the QImage is detached.
Change-Id: Ia015c0bb18d7bc62da38397594730254843e5a0d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This change allows painting via QPainter onto a QOpenGLWindow, QOpenGLWidget
or QOpenGLFramebufferObject when an core profile context is in use. This is
important on macOS in particular, where compatibility profiles are not
available, and so the only way to use modern OpenGL is via a core profile
context.
Added core profile compatible shaders with moder GLSL keywords.
The paint engine binds a VAO and two VBOs from now on, whenever VAOs are
supported. Note that this changes behavior also for OpenGL 2.x context that
have VAO support via extensions.
The Lancelot test suite gains support for core profile contexts. This can
be triggered via -coreglbuffer in place of -glbuffer when manually inspecting
via 'lance', while tst_lancelot will automatically run core context-based tests
whenever supported.
Task-number: QTBUG-33535
Change-Id: I6323a7ea2aaa9e111651ebbffd3e40259c8e7a9c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
QImage::reinterpretAsFormat can be used to change the format of an image
without converting the data, to correct wrong formats or narrow the
format to an opaque one if found to be opaque.
[ChangeLog][QtGui][QImage] A new method reinterpretAsFormat is has been
added to change the format of a QImage without converting the data.
Change-Id: I5e15bc5a1c474a35d3921b06299008ab2effd945
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The style name needs to be cleared if not present in the string,
otherwise the style name from qApp->font() (which propagates to
any default-constructed QFont) remains.
Change-Id: I9b6522a39a38526cced8a11ed02ae32582026480
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
The test failed if qApp->font() had a styleName() set,
when testing old serialization formats which didn't serialize it.
Change-Id: If0236d354be144b3a990e074a22f796fffb1ed18
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
- port Q_FOREACH to C++11 range-for
- port uses of inefficient QLists to QVector or C arrays
- port uses of dynamic containers with static content, to constexpr
C arrays
- fix algorithmic mistakes:
* use adjacent_find with greater<> to emulate C++11 std::is_sorted
instead of sorting the range and comparing it with the original
(and not even using stable_sort to do this).
* use std::unique == end() to detect absence of duplicates instead
of poplulating a QSet and comparing its size with that of the
original range.
* use a simple QCOMPARE instead of populating a QSet with statically-
known content, removing known options to be able to check that the
remaining options are unknown
Fixes errors pointed out by my tree's static checks.
Change-Id: I935dbc21d56b55889d96aaf6ec179624c6ce9047
Reviewed-by: David Faure <david.faure@kdab.com>
Private Use Area characters are quite valid input characters when used
in combination with a custom font. Joiners also serve an important language
purpose in semitic writing systems.
Note that there is a hack where we disregard any character produced
using CTRL or CTRL+SHIFT specifically because of German keyboards. I have chosen to
keep the hack in this patch to limit the change (though I have made an exception
for ZWJ and ZWNJ since both are produced using Ctrl+Shift on Windows), but it
will probably have to be reverted.
[ChangeLog][QtWidgets][Input] Accept characters in Private Use Area, as well as
zero-width joiners and zero-width non-joiners in input in QLineEdit and QTextEdit.
Task-number: QTBUG-42074
Task-number: QTBUG-57003
Change-Id: I73f3b7d587a8670de24e902dc52a51f7721dba5a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The ARGB32PM code-path doesn't have enough precision to accurately
render ARGB32 images, but the RGB64 code-path does. Since this is
already a slow configuration and the most costly part is the conversion
we can switch to the more accurate code-path for little cost.
Task-number: QTBUG-55720
Change-Id: Ifa0afba8d8cc0c2f699bb91f51726f4ee5228f3e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Throw out unused code and simply format table to only care about bpp
and use it consistently for all bpp.
Also makes QImage use the 180 degree memrotate, and fixes the tiled
packed qt_memrotate270 so it can be put to use.
Change-Id: If4ef1666fca960ce8e4ce32d85dc5f347b6986f4
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Commit 2bc7a40048 taught the CoreText font database to populate the
families lazily, and in the process added a guard to ensure that we
didn't populate internal fonts (prefixed with a '.'), as these fonts
would then show up in font selection dialogs.
Commit 909d3f5c7 then added support for private fonts, by making it
possible to filter out any private fonts from font selection daialogs.
But the guard was not removed, so we were still not populating these
fonts. This guard has been removed, and the filtering function has
been updated to include the conditions of the guard.
Next, commit e5e93345c5 used [UIFont fontNamesForFamilyName:] to verify
that each family that we registered with the font database would also
have matching fonts when finally populated. This is not the right approach,
as [UIFont fontNamesForFamilyName:] does not handle internal fonts.
Instead we trust what CTFontDescriptorCreateMatchingFontDescriptors()
gives us, but make sure to register the resulting font descriptors
with the original/originating font family, instead of the one we pull
out of the font descriptor.
Finally, as of iOS 10, we can use CTFontManagerCopyAvailableFontFamilyNames
instead of [UIFont familyNames], which gives us all of the internal font
families like on macOS, instead of just the user-visible families. For
earlier iOS versions we manually add '.PhoneFallback', as we know it
will be available even if not listed in [UIFont familyNames].
The end result is that we register and populate families like '.PhoneFallback',
which is critical to supporting more esoteric writing systems.
The check in tst_QFont that styles for a given family is not empty has
been removed, as we can't guarantee that on all platforms, which is
also documented for QFontDatabase::styles().
Task-number: QTBUG-45746
Task-number: QTBUG-50624
Change-Id: I04674dcb2bb36b4cdf5646d540c35727ff3daaad
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
The function was incorrectly handling green and blue color channels
causing them to be dropped. This affects drawing non 32-bit images onto
10-bit per color channels formats such as RGB30.
Change-Id: I9211e253b1a9da0dada5c418d592a8f531265989
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Several people agreed that the name was confusing and that this one
is better.
Task-number: QTBUG-54616
Change-Id: I31cf057f4bc818332b0551a27d1711599440207c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Sune Vuorela <sune@vuorela.dk>
The alpha channel of an RGB32 image was not properly ignored when doing
blending with partial opacity.
Now the alpha value is properly ignored, which is both more correct
and faster. This also makes SSE2 and AVX2 implementations match NEON
which was already doing the right thing (though had dead code for
doing it wrong).
Change-Id: I4613b8d70ed8c2e36ced10baaa7a4a55bd36a940
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
- Declare as Q_MOVABLE_TYPE
- Prevent QList<QPointerUniqueId> from being instantiated
(use QVector instead)
- Add equality relational operators
- Add qHash() overload
- Replace non-default ctor with named ctor.
- Add Q_DECL_NOTHROW.
- Add Q_DECL_CONSTEXPR.
- Rename numeric() -> numericId().
- Update docs.
The extension vector for this class calls for additional
properties to be added later, but these are not user-
settable. It thus suffices to rely on the only data
member, a qint64, which can be reinterpreted to an index
into an array or hash with actual objects. This allows
to make the class a Trivial Type (ie. no overhead over
an int) while still supporting later extension. Cf.
QSslEllipticCurve as another example of such a class.
The extension has to maintain the following invariants,
encoded into user code by way of being used in inline
functions:
- m_numericId == -1 <=> !isValid()
This is trivial to support. An extension could not and
still cannot reinterpret the qint64 member as a d-pointer,
but a d-pointer is only necessary for user-settable
properties where updating a central private data structure
would cause too much contention.
Add a test.
Since this type is used in other modules, keep the existing
functions, but mark them as deprecated with the expectation
that these compat functions be removed before 5.8.0 final.
Task-number: QTBUG-54616
Change-Id: Ia3ede0ecaeeef4cd3ffa94a72b1050bd409713a5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
We parse the EXIF header in order to get the proper orientation, so
let's be a bit more careful in what we accept. This patch adds better
handling for reading past the end of the stream, plus it limits the
number of IFDs read (to avoid processing too much data) and deals with a
pathological case of the EXIF file format: EXIF (due to its TIFF
origins) permits the offset to the next IFD to be backwards in the file,
which means it could result in a loop or pointing to plain corrupt data.
We disallow any backwards pointers, since it seems that's what other
decoders do (libexif, for example).
Change-Id: Iaeecaffe26af4535b416fffd1489332db92e3888
(cherry picked from 5.6 commit 02150649f95b8f46f826e6e002be3fa0b6d009bc)
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
../tst_qfile.cpp: In member function 'void tst_QFile::handle()':
../tst_qfile.cpp:2661:38: warning: ignoring return value of 'ssize_t read(int, void*, size_t)', declared with attribute warn_unused_result [-Wunused-result]
tst_qstatictext.cpp:862:58: warning: unused parameter 'textItem' [-Wunused-parameter]
../tst_qtcpsocket.cpp: In member function 'void tst_QTcpSocket::abortiveClose()':
../tst_qtcpsocket.cpp:2254:90: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
Test.cpp: In member function 'void My4Socket::read()':
Test.cpp:66:20: warning: 'reply' may be used uninitialized in this function [-Wmaybe-uninitialized]
../tst_qlocalsocket.cpp: In lambda function:
../tst_qlocalsocket.cpp:701:51: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
../tst_qtcpserver.cpp: In member function 'void tst_QTcpServer::linkLocal()':
../tst_qtcpserver.cpp:935:92: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
../tst_qtcpserver.cpp:940:92: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
Change-Id: Ic315069768bcb63a6b333c28ac65b0b992b0d43f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Turns the two set of tables in QDrawHelperGammaTables into two
QColorProfile classes that use similar structures and can be reused for
other gamma correction.
At the same time clean-up and improve the comma-correct blending code
to use the new profiles and QRgba64 precision.
Change-Id: I302bd87a5c836e1010fff6d633eeb56fd4ae2ff0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Looks up the canonical names of enumerated fonts and register them under
their preferred names if present.
Also changes the logic handling registration of english aliases, so it
is always done, even if it might in rare cases cause a double
registration since that is safe.
Task-number: QTBUG-53458
Change-Id: Ia010774b26072192b55697b717cc37442c852881
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Analogous to QWidget::setAttribute(), introduce an API to easily
enable/disable a single window flag without having to resort to
w.setFlags(w.flags() | Qt::NewFlag).
Change-Id: Ib0f7254a34c8d884cdec181c41b99e5ef035d954
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Change qtConfig(opengl(es2)?) to qtConfig(opengl) as that covers
the case without any regular expression.
Change-Id: I935e3150f87e195e8bd3d0e55b4ed43572b131cf
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Tests are not supposed to write into the build/application directory,
but rather should output to the temp directory.
Change-Id: Idcdf51226a2d547514aea2fbb2054998d8a3437e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
No-break-spaces should not be counted in the space data, but rather
be treated as any other non-breakable character. We were already
taking care of this in the loop we reach if the item starts with
a character which isn't whitespace, but there is a second loop for
items that begin with whitespace characters.
The result of this was that in certain circumstances where you gave
the nbsp its own format and made the line wrap, the previous line
would count an extra trailing space and it would swallow the first
character in its following line.
[ChangeLog][QtGui][Text] Fixed a bug where a no-break space would
sometimes cause the first character of the containing line to not be
displayed.
Task-number: QTBUG-56714
Change-Id: Idd760a389052e6de70f6cc397122b217987fa5f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We were throwing away important information by claiming that all
fonts support all the standard sizes in QFontDatabase on Windows
This caused the font dialog to list unsupported sizes for bitmap
fonts, unlike the native font dialog.
We would also claim to support creating bitmap fonts at
unsupported sizes, which would lead to
1. QFontInfo(font).pointSize() would return the requested size,
not the actual rendered size.
2. Bitmap fonts created at 64 pixels and higher would be invisible.
On Mac, there are no system bitmap fonts, and the use is not very
common, but installing some bitmap fonts on the system, it does
seem to ignore the sizes supported in the font and just displays
the standard list instead, so we keep the current behavior there.
[ChangeLog][QtGui][Text] Fixed list of supported sizes for
bitmap fonts on Windows.
Task-number: QTBUG-56672
Change-Id: Idbec2db9eb3381ab5ddf6259bd2befcba9b93564
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This is second attempt of change cd26e66c2e
This allows us to not have conflicts between the point ids between
different devices for QtQuick pointer handlers.
We do this in QtGui because we can then safely compare point ids from
QTouchEvent::TouchPoint and QQuickEventPoint.
(Point ids that QtQuick pointer handlers use will be based on the point
ids provided by QTouchEvent::TouchPoint::id)
[ChangeLog][QtGui][QTouchEvent][Important Behavior Changes]
Touch point ids are now unique even between different devices. As a
consequence of that, you cannot anymore assume that
QTouchEvent::TouchPoint::id has the same value as given by the native
platform nor the same value as given by synthesized touch points.
Change-Id: Iad2fd8c6a43ccc571a227a01134a1e8f829dfaf4
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Same behavior as QWidget, and allows platform plugins to maintain order of
native windows based on the QWindow hierarchy, instead of having to manually
keep track of window levels.
Change-Id: Iacc7e9ee2527f0737c9da6debc7cec101064f782
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
With the client message _NET_ACTIVE_WINDOW, not all window managers
will pass focus from a child window to its root window, Detect this
child-to-root case, and use xcb_set_input_focus() instead.
Task-number: QTBUG-39362
Change-Id: Ib32193018e3b725b323f87d7306c9ae9493d78a7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
The QTextDocument::toPlainText() converts some characters in the
text to ASCII, which can be problematic for use cases where you
want to save the precise contents of the document, e.g. in
Qt Creator. Since we don't want to change the behavior of
toPlainText(), we introduce a new function which returns the
raw text contents of the document instead, with no modifications.
[ChangeLog][QtGui][Text] Added QTextDocument::toRawText() function.
Task-number: QTBUG-56538
Change-Id: Ib6c48a16551c4c71c4c431760f993793d1af6806
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Fixes the test for width of condensed fonts so it doesn't depend
on the presence of the Liberation font on the system, and adds
another test that condensed sub-families can be matched
consistently. The latter will however not work on Windows until
QTBUG-53458 is solved.
Task-number: QTBUG-51335.
Change-Id: Id6d046274fa21b2dce0ad6b32dce7f1c8a92a4f4
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Commit c5db8fc74 changed all instances of Q_WS_FOO to have the prefix
Q_DEAD_CODE_FROM_QT4 instead, to make it clearer when reading the code
that the code in question was a left-over from Qt4, when we used
Q_WS_ defines instead of Q_OS_ defines.
This worked well for cases of #ifdef Q_DEAD_CODE_FROM_QT4, but less so
for cases of #ifndef Q_DEAD_CODE_FROM_QT4, where the code was actually
unconditionally included.
To make this even clearer, the defines have been replaced by checks for
1 or 0, with a comment describing how the code used to look in Qt4. The
use of constants in the check also makes it easier for editors to parse
the condition and show visually that the code is defined out.
Change-Id: I152070d87334df7259b417cd5e17d7b7950379b7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Previously when a new QOpenGLFramebufferObject was bound, the
QOpenGLContextPrivate::qgl_current_fbo member was also updated to point
to this new object.
But if a user called QOpenGLFramebufferObject::bindDefault(),
qgl_current_fbo was not unset, meaning that if the FBO object would be
deleted at some point, qgl_current_fbo would be a dangling pointer.
This patch makes sure to clear the value of qgl_current_fbo when
bindDefault() is called. It is cleared, and not set to point to another
object because the default platform OpenGL FBO is not backed by a
QOpenGLFramebufferObject.
Task-number: QTBUG-56296
Change-Id: I68b53d8b446660accdf5841df3d168ee2f133a90
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Also bump minimum required Qt version for Android: Ministro updates.
Conflicts:
src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java
src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
src/plugins/platforms/android/androidjnimain.cpp
Change-Id: I966f249bebf92da37bfdeb995ad21b027eb03301
Clip the transformed and rounded sourceClip to the source rectangle,
so we don't try to rotate pixels outside the source.
Task-number: QTBUG-56252
Change-Id: Ib9cb80f9856724118867aea37ead0b02a6c71495
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
... and avoid detach()ing potentially large data for just
preserving the QPlatformPixmap::pixelType().
A QBitmap differs from a QPixmap (its base class, urgh)
by always having a data != nullptr and a Bitmap pixel
type, yet load() was unconditionally setting 'data' to
nullptr on failure, turning a QBitmap into a non-QBitmap.
Fix by move-assigning a null QBitmap instead of resetting
'data'.
Add some tests.
Change-Id: Ida58b3b24d96472a5f9d0f18f81cc763edcf3c16
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The layout isn't actually created until endLayout() or setLineWidth() is
called. So in the case where this was not done, the height of the line
would be 0, thus multiple lines would be placed on top of each other, at
y == 0.
[ChangeLog][QtGui][Text] Fixed QStaticText when manually breaking lines
and no text width was set.
Task-number: QTBUG-56346
Change-Id: I7f6ed6260545882f05fe39b21134315eca7401b9
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
After e109b8a0f3, it is possible
that the cache will be flushed as a result of inserting a new
font rather than just when the timer event triggers. When doing
superscript and subscript text layouts, we would first get
a regular font engine, then a scaled one, and then reference
the regular font engine *after* getting the scaled one. If the
regular font engine was deleted as a result of inserting the scaled
one, we would get a dangling pointer and crash.
The situation was improved by 49926bb9ef.
You would now to switch between 256 different fonts in the layout
in order to trigger it. The test in the commit will trigger the
crash even with this change.
[ChangeLog][Qt Gui][Text] Fixed a crash that could happen if you
were doing many different text layouts with different fonts
and superscript or subscript alignment.
Task-number: QTBUG-53911
Change-Id: Ia33108252e030eff25924ef1b7c10b9d59b5bc8c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
There is no need to switch to the current directory, when there is no
process support. This also fixes running the test on sandboxed target
platforms.
Change-Id: I25fabb8b22d3510062a012884eb1eaab682901d3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The inefficiency of QColor(const char*) came to light by
a recent refactoring which showed that the existing char*
overload of qt_get_hex_rgb() was never called.
So, provide a QLatin1String interface for named colors
that allows user code to reach that internal function
without converting to QString first.
Change-Id: I74df7b570ef28c00e35ca4adf46c4b7c7e9994b3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Instead of creating files relative to the application binary, use a
temporary directory. This also cleans up the test data after execution.
Change-Id: I5d680fd01c60b0d33df06f9cb9aaef7c86279710
Reviewed-by: Jesus Fernandez <jesus.fernandez@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Move the different parts of configure.json/.pri into the libraries where
they belong.
Gui is not yet fully modularized, and contains many things related to
the different QPA plugins.
Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Change-Id: I6659bb29354ed1f36b95b8c69e7fce58f642053f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Not all tests have been updated to consider sandboxed targets causing
open/write errors.
Change-Id: Id7bb925c0faf04bf88cb126fb7c2846c38f36290
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
cf53aa21bf and 3aaa5d6b32
were reverted because of reconstruction in 5.7.
defineTest(qtConfTest_checkCompiler) in configure.pri is smart
enough to cover the case in a9474d1260.
DirectWrite: Fix advances being scaled to 0
Since 131eee5cd, the stretch of a font can be 0, meaning
"whatever the font provides". In combination with ec7fee96,
this would cause advances in the DirectWrite engine to be scaled to
0, causing the QRawFont test to fail.
Conflicts:
configure
mkspecs/features/uikit/device_destinations.sh
mkspecs/features/uikit/xcodebuild.mk
src/corelib/global/qglobal.cpp
src/corelib/global/qnamespace.qdoc
src/plugins/platforms/cocoa/qcocoamenuitem.h
src/plugins/platforms/windows/qwindowsservices.cpp
src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
src/widgets/kernel/qapplication.cpp
tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
[ChangeLog][QtGui][QTextDocument] Fixed a bug that would return a wrong
position when searching backward from the end of the document.
Task-number: QTBUG-48182
Change-Id: I6e88f808a50cb840f61e7bc579e2a28c5300089d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Some qpa backends do not provide a QPlatformNativeInterface. Hence,
check whether return value is valid.
Change-Id: Iab46bc59a151aa244fcfebf58edb37496369db89
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Use the new qtConfig macro in all pro/pri files.
This required adding some feature entries, and adding
{private,public}Feature to every referenced already existing entry.
Change-Id: I164214dad1154df6ad84e86d99ed14994ef97cf4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
These tests use helpers, which are not supported on UIKit platforms.
Change-Id: I51447754dba2cd2547be05c3767e4ff3b6b5a671
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Cap height is an important metric of font, in particular it is
required to make decent implementation of "initial-letter"
CSS property in QtWebKit.
Note that some fonts lack cap height metadata, so we need to
fall back to measuring H letter height.
Change-Id: Icf69d92159d070889085e20d31f2e397d796d940
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
If an entire font family is condensed or stretched and we match by
family name, the default stretch factor of 100 will make the font
engine try to synthesize it back to medium stretched font.
The existing code is already made to deal with a stretch of 0 that is
no longer used. This patch reintroduces 0 stretch to indicate no
specific stretch has been requested. Specifically setting stretch to
100 on a QFont will introduce the old behavior.
[ChangeLog][QtGui][QFont] The default value of QFont::stretch() is
now 0 to indicate any default stretch is acceptable.
Task-number: QTBUG-48043
Change-Id: I574747f980fd4f9893df828818aae99a07b41623
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Don't try to locate the text by coordinates at the edge of the text but
simply aim at the center vertically _and_ horizontally.
Task-number: QTBUG-52991
Change-Id: Ia9e84fc5d12491840e739c4eea730fe13058f3c7
Reviewed-by: Simo Fält <simo.falt@theqtcompany.com>
(Move QT_FORWARD_DECLARE_CG to qglobal.h)
This function converts to CGImage for supported formats. This
is done by creating a CGImageRef that reuses the QImage data.
The CGImage and QImage ref counting systems are bridged, implemented
by using CGDataProvider that holds a copy of the QImage.
Unlike the previous internal implementation this public version
does not implicitly convert unsupported formats to ARGB32_Premultiplied.
See included documentation for the complete description.
Change-Id: Ie3984a7a8331e02a6f1c42943caaf76854e93538
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
The test no longer writes to SRCDIR, so don't try to remove
generated files from there, either.
Amends bb5570082e.
Change-Id: I1d5df88b1865f3dbd914ec71147de61e173f2f4e
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
don't refer to non-existent feature 'OdfWriter', and test these
classes if we have a developer build.
Change-Id: I59b0d4bbba4958ed3bd76f504cd8b493dbd7f877
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
- port uses of dynamic containers with static content to constexpr
C arrays
Fixes errors pointed out by my tree's static checks.
Change-Id: I5e1cafa6e428500afae0d653ce48a7fb465c19ed
Reviewed-by: David Faure <david.faure@kdab.com>
Before: HexRgb: 0.00230 ms per iteration, HexArgb: 0.00290 ms per iteration
After: HexRgb: 0.00051 ms per iteration, HexArgb: 0.00061 ms per iteration
This showed up as a relevant optimization when profiling KIconLoader
which uses QColor::name() as part of the key -- thanks to Mark Gaiser for
the investigation and first suggestion of a solution. I have also seen
customer code writing a replacement for QColor::name() because it was
too slow to be used as a hash key.
Change-Id: I009ccdd712ea0d869d466e2c9894e0cea58f0e68
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Nothing fancy, just a safety-net for a following refactoring.
Change-Id: I5be87c86cd61e24bf96881d2485dd7560ea6184a
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>