Commit Graph

39514 Commits

Author SHA1 Message Date
Andrew den Exter
345f86a2d8 Avoid re-encoding embedded images when writing an ODF file
If an embedded image is already encodeded as an png or jpg write the
data as is instead of decoding to a QImage and re-encoding as a new
image.

Change-Id: I479ae1fddbf59900a500497dd1bdf7449c21f273
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-05-13 13:03:01 +10:00
Christian Ehrlicher
aa8d3f90a4 QAbstractSpinBox: fix some ui glitches
Fix some ui glitches for QAbstractSpinBox:
 - update geometry when buttons are toggled on/off
 - calc button size with subControlRect instead hardcoded 20px
 - when buttons are not shown, don't add the button size in
   sizeFromContents for common and macOS style

Fixes: QTBUG-39713
Fixes: QTBUG-75303
Task-number: QTBUG-67126
Change-Id: Ibf330c76deb16358a481bba6bd429fff6a5d57ae
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-05-10 19:52:11 +02:00
Allan Sandfeld Jensen
12ebdf0281 Fix new[] delete mismatch in test
QScopedPointer uses normal delete, but we need delete[].

Change-Id: Id62a2c55f75ef4aa60580f5e04c4bf306a6dd3c9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-15 11:17:57 +02:00
Dongmei Wang
ad1d616033 wasm: add Qt Virtual Keyboard support
Change-Id: I454ab677cad25b50ba7b03ef2c4b6046e1227ce8
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2019-05-16 13:30:52 -07:00
Fredrik Orderud
2a2f04205c WASM: Make wasm_shell.html compatible with CMake configure_file
The CMake configure_file command is commonly used copy & modify template files
during the build process. One limitation, thought, is that configure_file
expect the variables to be replaced to be encoded using either a @APPNAME@ or
${APPNAME} convention.

This commit therefore changes "APPNAME" to "@APPNAME@" in wasm_shell.html to
make the HTML template file compatible with CMake configure_file.

With this commit, it becomes possible to write the following CMake function
that mimics what QMake is already doing:
function(copy_html_js_launch_files target)
  set(APPNAME ${target})
  configure_file("${_qt5Core_install_prefix}/plugins/platforms/wasm_shell.html"
                 "${target}.html")
  configure_file("${_qt5Core_install_prefix}/plugins/platforms/qtloader.js"
                 qtloader.js COPYONLY)
endfunction()

Change-Id: Ic38abdc498ba03b8d21f1b9b70aa1d480ae7f362
Reference: https://cmake.org/cmake/help/latest/command/configure_file.html
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-05-21 09:12:07 +02:00
Volker Hilsheimer
bd55a9d912 Fix canonicalFilePath() for files with trailing slashes
Such files do not exist (as per QFileInfo::exists), but on some
platforms that rely on realpath(), QFileInfo::canonicalFilePath did
not return the empty string.

Use the same logic on macOS as we already did on Android, and include
a test case. Remove the unnecessary dynamic memory allocation and
use a stack-allocated array instead, unless we use modern POSIX in
which case realpath() will alloc the memory for the result for us.

Change-Id: Ide987c68ebf00cbb7b1a66c2e9245a12c7807128
Fixes: QTBUG-44242
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-05-21 13:59:34 +02:00
Cristian Adam
bba44746f9 Disable debug plugin check for MinGW
MinGW doesn't have a debug and a release version of the CRT like
Visual C++ does. Disabling the check would allow distribution
only of a Release build of Qt.

Change-Id: Iecfa753217af96ca74091cd1d47400632629abdb
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-05-20 13:00:41 +00:00
Tor Arne Vestbø
e6036cfc5a macOS: Better document plain-text code-path in QMacPasteboard::retrieveData
Due to PasteboardCopyItemFlavorData converting newlines to '\r' for some
UTIs we have traditionally had to shortcut these UTIs via NSStringPboardType
instead of the mime converters such as QMacPasteboardMimeUnicodeText.

Let's explain this a bit better for future generations.

Note that public.utf8-plain-text doesn't seem to have this problem
anymore, but it's left in for now to not cause any regressions due
to behavior change.

Change-Id: I7dce80828865c6323ed308780b8ca07b7a3e7c17
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-05-15 16:30:16 +02:00
Tor Arne Vestbø
4504d9ca31 macOS: Remove broken UTF-16 handling in QMacPasteboard::retrieveData
The logic seems to be to prefer public.utf16-plain-text over the UTI
reported by the mime converter's flavorFor, but this doesn't make sense
for two reasons:

 1. If the converter reports a UTI from flavorFor, we should respect
    that as the preferred UTI. QMacPasteboardMimeUnicodeText already
    reports public.utf16-plain-text as expected.
 2. We don't know if the converter supports the public.utf16-plain-text
    UTI, which is the case for QMacPasteboardMimeTraditionalMacPlainText
    for example. The result is that we fail to retrieve any data. The
    reason we haven't been seeing this issue is that the code path above
    using qt_mac_get_pasteboardString will in most cases succeed and
    return early.

Change-Id: I0b7e0d09a97389a229e7a945f17fef74ad5c2fc0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-05-15 16:16:14 +02:00
Kavindra Palaraja
704b6bac13 doc: Explain how qmake finds for files included in your source code
Task-number: QTBUG-26651
Change-Id: Icc09e3272fcec8af0c33d79655159d13183c66ce
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-05-16 13:06:52 +00:00
Samuel Gaist
895db969a5 doc: improve QStandardItemModel code snippet
The snippet currently uses hard coded values for looping which
is not good practice. This patch fixes this using rowCount and
columnCount.

Change-Id: Ie532649353f757843426a18e9a50b86a2278f7a5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-05-16 06:48:37 +00:00
Qt Forward Merge Bot
264e66afb2 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I1bdc28a3ae825ea35e83f20fe16d2409515e5a3d
2019-05-16 01:00:11 +02:00
Edward Welbourne
d441f6bba7 Skip flaky qfloat16 1/inf == 0 test on QEMU/Arm64
It's not clear why this test fails - and only does so sometimes - but
fail it does, so we ned to skip it to let development keep going.  As
it happens, the same platform over-optimizes various computations
using qfloat16; which can at least be used to test for this platform,
since it wrongly distinguishes two qfloat16 values that theory and all
other platfomrs agree should coincide.

Fixes: QTBUG-75812
Change-Id: Ie9463d7dc21bca679337b475d13417b9f42bbf9b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2019-05-15 19:06:52 +00:00
Oliver Wolff
3b380c8481 winrt: Return monospace font for QFontDatabase::systemFont(QFontDatabase::FixedFont)
Fixes: QTBUG-75648
Change-Id: I0e5e5e012d3cd5985d1e9a63e776e73ce2d7bf98
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-05-15 18:08:01 +00:00
Shawn Rutledge
f4976f86cd Don't render PE_PanelItemViewRow under tree decoration if style says no
Fusion style's SH_ItemView_ShowDecorationSelected hint is hard-coded to 1,
but in QCommonStyle::drawPrimitive (which QFusionStyle inherits) it only
asked its own QFusionStyle::styleHint() before drawing the background that
happens to be under the tree row decoration (arrow thingy or +/- symbol).
And the style doing the rendering does not know about QStyleSheetStyle so
by the time we get to QCommonStyle::drawPrimitive() it's too late to check.
Therefore QTreeView needs to avoid calling it in this case.

Fixes: QTBUG-73251
Change-Id: I2d0ed4d3b2ee805a5602122273387982caa564f8
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-05-15 18:07:13 +00:00
Richard Moe Gustavsen
071a0a6937 iOS: be more careful about hiding the edit menu
The code that deals with text selection in the iOS QPA
plugin, listen for changes to text selection. And depending
on whether we have a selection or not, we show or hide
the selection handles together with the edit menu.

The problem is that the edit menu will also be told to
show from other places, even if there is no selection. And
for those cases, we should avoid closing it.

This patch will check, before we close the edit menu, if we're
tracking a selection. If not, we leave the edit menu alone.

Fixes: QTBUG-75099
Change-Id: I001d818fa2ad4a215cc3fa6aa4c7faf516e1ed59
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-15 17:37:47 +00:00
Frederik Gladhorn
61d990da96 Accessibility: Do not use the session bus if not connected
When there is no DBus session, there will be no Linux accessibility,
since it relies on the presence of DBus.

Fixes: QTBUG-50189
Fixes: QTBUG-51940
Change-Id: I7503011b39ba2a806ddc12e89d0f7bd72a628b64
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2019-05-15 16:59:04 +00:00
Eirik Aavitsland
1fd44915f9 Fix: freetype italic fonts in mono/aliased mode
FT_GlyphSlot_Oblique(), the Freetype function to synthesize a
slanted/italic font, only accepts glyphs with outline format. So
disable loading bitmap format glyphs when that function will be used.

Fixes: QTBUG-73586
Change-Id: I762a4bc34537e0725ead0fb063d50c997403143d
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-05-15 11:57:31 +00:00
Richard Moe Gustavsen
cc33dd0797 QMenu: show shortcuts in context menus by default
Change c2c3452ba introduced a new API in Qt to let QPA inform
whether or not shortcuts should be shown in context menus. This
was set to false by default, since by observation, this seemed to
be the most common behavior across platforms. The problem
is that it left no way for the application to override it; The
attribute Qt::AA_DontShowShortcutsInContextMenus simply doesn't work
when shortcuts are always off. And for some application, showing
shortcuts is not just a matter of look-and-feel, but also important
information to be able to use the application the way intended.

This patch reverts the behavior back to how it was in Qt-5.9, where
shortcuts where shown by default (except on macOS where we still keep
them off). It's no so much because the "always off" logic is wrong, but
because there is no (easy) way/work-around for an app developer to switch
them back on (until Qt-5.13, where a new API is introduced to fix the
situation: b1a9a77). And this lack of API can be a show-stopper for some
when upgrading from e.g 5.9 LTS to 5.12 LTS.

This downside of this patch, OTOH, is that it can cause more
change that what is normally wanted in a patch release. But out of
two evils, this is the best option. Those that wan't to hide shortcuts
can set AA_DontShowShortcutsInContextMenus to true, which now will
work.

[ChangeLog][QtWidgets][QMenu] Shortcuts are again shown by default
in context menus, except on macOS. They can be forced off by
setting AA_DontShowShortcutsInContextMenus to true.

Fixes: QTBUG-69452
Change-Id: Ibcc371395944ac5b19b1d20889940da271bf73d5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-05-15 11:40:12 +00:00
Kai Koehne
16eb2b7e32 Copy plugins.qmltypes files to build dir (again)
Since change c808a6978b plugins.qmltypes and designer/*  didn't
get copied anymore for a non-prefixed build. Fix this, and clean up surrounding
code.

Fixes: QTBUG-75682
Change-Id: Ic6de94a5b01dae08929a67cbaedde60d120a4807
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-05-15 11:01:50 +00:00
Mårten Nordheim
2544cfe80f Move forward-declaration inside of namespace
Including both qopenglextensions.h and qopenglcontext.h would cause
ambiguity for the compiler when using QOpenGLContext

Change-Id: If8e46741c86d7639f442b5ac05a4493da784eb2f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-05-15 10:58:49 +00:00
Timur Pocheptsov
95e1363802 QMacStyle - clear cached controls when changing themes
Having Aqua-themed controls in AquaDark theme looks interesting but not
very native. Clear cached Cocoa controls on theme change notification.

Change-Id: I884bf4434211be670aecc317935eb00b3fb6013c
Fixes: QTBUG-73652
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-15 03:38:11 +00:00
Sergio Martins
e9e16c7464 Warn when setting attributes after QCoreApplication is created
It's a recurring bug seen in user code and a warning will help
reduce it.

Warns only for the attributes that have such requirement in the docs,
but maybe we should be more strict and warn for any attribute.

Change-Id: I68148521953221ad0e8be1028181f52a7f22d2cc
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-14 21:43:50 +00:00
Laszlo Agocs
f6f0a9f3f6 eglfs: Make the logs from atomic support usable
Atomic being supported and atomic being requested are two different things.
(the latter is only true when QT_QPA_EGLFS_KMS_ATOMIC is set)

Log accordingly since this can be very important to know when investigating
problems.

Change-Id: I6947d18e7c0eaef3fe160095cb046770f9c93efe
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2019-05-14 11:39:43 +00:00
Michal Klocek
1e5deb0641 Add 'well-formated' JSON string values
Add support for surrogate code points U+D800 through U+DFFF,
represent them with JSON escape sequences.

https://github.com/tc39/proposal-well-formed-stringify

Change-Id: I84fea53a8ef400beebefdba10ea82dc510fe7dda
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-14 10:06:35 +00:00
Friedemann Kleint
fa59c4fd7d Merge "Merge remote-tracking branch 'origin/5.12' into 5.13" into refs/staging/5.13 2019-05-14 12:21:38 +00:00
Joerg Bornemann
871b65ab10 Add the c++latest CONFIG value to select the latest C++ standard
[ChangeLog][qmake] The CONFIG value c++latest was added to select the
latest C++ standard the currently used toolchain supports.

Task-number: QTBUG-75653
Change-Id: I22ddc9d293109d99e652b7ccb19d7226fca4716d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-14 08:01:40 +00:00
Friedemann Kleint
00e1917f85 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Id3d16035c9692af42e9c1bf512218f3c836ae2eb
2019-05-14 08:23:41 +02:00
Joni Poikelin
9bb5491c06 Fix QRasterBuffer::scanLine miscalculation with big images
scanLine is overflowing with big images. Similar change was made in
4f88475a96 to fix the same issue with
QImage::scanLine.

Fixes: QTBUG-75082
Change-Id: Ifedf28fa9a303c189dfcd12bd4ec11f438540c2e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-05-14 06:23:21 +00:00
Tor Arne Vestbø
09504d484c macOS: Guard against display on non-main threads
AppKit will in some cases ask our view to display on secondary threads if
we call APIs that are only supposed to be called on the main thread, such
as -[NSOpenGLContext setView:] or -[NSOpenGLContext update].

Forwarding this display-request is bad, as QtGui expects all window system
events to come on the main thread, and we can easily deadlock client code
such as the Qt Quick threaded renderer.

Change-Id: I1daeabf1dca6ca8ba908d3998b444a2089681e3a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-13 15:19:35 +00:00
Friedemann Kleint
7eed1e40d4 Windows QPA: Fix resize loops when moving fixed size windows between screens
Postpone the screen change until the DPI changed event in case a move
between screens with different DPI is detected.

Task-number: QTBUG-65580
Change-Id: I356f144b243d7d1ce7feabf0434c3f534b903965
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
2019-05-13 14:46:57 +00:00
Friedemann Kleint
d2fd9b1b98 Windows QPA: Fix window frame calculation in multi-monitor setups
When introducing EnableNonClientDpiScaling() for QTBUG-53255, the window
frame calculation was not adapted. That is, window frames were calculated
from the style for the primary screen only, causing

- minimum size constraints not being calculated correctly for applications
  on secondary screens when populating the MINMAXINFO structure.
- warnings about not being able to apply a geometry when moving fixed
  size windows across screens.

The calculation of the frames for propagating size hints is also no longer
required after 3035400f36, which retrieves
them from the WM_NCCALCSIZE message; QWindowsWindow::fullFrameMargins() can
be used instead.

For newly created windows, use the newly added AdjustWindowRectExForDpi()
function to calculate the initial frame size.

Change QWindowsGeometryHint from a class to a collection of static functions
and add overloads to calculate the frame.

In checkForScreenChanged(), update the margins until WM_NCCALCSIZE is
received.

Task-number: QTBUG-67777
Task-number: QTBUG-65580
Task-number: QTBUG-53255
Change-Id: Iff2d382b2b316adec6c1a0622ae8015dba6de371
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
2019-05-13 14:46:48 +00:00
Morten Johan Sørvig
3af7b27917 Fix QWindow::mapToGlobal()/mapFromGlobal() for multi-screen windows
Make these functions handle the case where a window spans multiple
screens, and high-DPI scaling is enabled, and the local position (in the
window) is not on the window primary screen (as returned by
QWindow::screen()).

This is done by detecting the case, and then calculating
the correct position using the native coordinate system.

[ChangeLog][QtGui] QWindow::mapToGlobal()/mapFromGlobal() now handle
windows spanning screens correctly.

Done-with: Friedemann Kleint<Friedemann.Kleint@qt.io>
Task-number: QTBUG-73231
Change-Id: I3c31b741344d9e85e4f5d9e60bae75acce2db741
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-05-13 13:52:32 +00:00
Morten Johan Sørvig
56acf089c7 wasm: support setting the font DPI from JS
We have not really been able to determine what the
default DPI should be, so make it configurable with
API on qtloader.js:

  qtLoader.setFontDpi(72);

Also lowers the default DPI to the standard value of
96 (down from Qt default 100).

Task-number: QTBUG-75510
Change-Id: Ica1164c8d80bb06519233adebf2c9e400c0991ce
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-13 12:29:21 +00:00
Liang Qi
ffdcad9e40 Merge "Merge remote-tracking branch 'origin/5.12' into 5.13" into refs/staging/5.13 2019-05-13 16:37:15 +00:00
Martin Smith
98cb9275d0 doc: clang reported two fake declarations to be the same
These declarations are provided for qdoc, but clang says they are the same:
template <typename Functor>
QMetaObject::Connection callOnTimeout(const QObject *context, Functor slot, Qt::ConnectionType connectionType = Qt::AutoConnection);
template <typename PointerToMemberFunction>
QMetaObject::Connection callOnTimeout(const QObject *receiver, PointerToMemberFunction slot, Qt::ConnectionType connectionType = Qt::AutoConnection);

clang accepts this one, but is it ok for the documentation?
template <typename MemberFunction>
QMetaObject::Connection callOnTimeout(const QObject *receiver, MemberFunction *slot, Qt::ConnectionType connectionType = Qt::AutoConnection);

Change-Id: I9d63b1bccfa8d73dbc17ab70c4415eb7891fbbe2
Reviewed-by: Martin Smith <martin.smith@qt.io>
2019-05-13 11:11:42 +00:00
Tor Arne Vestbø
3976df2805 macOS: Track screens via Quartz Display Services instead of NSScreen
Using NSScreen as the basis for tracking screens is not recommended, as
the list of screens can be added, removed, or dynamically reconfigured at
any time, and the NSScreen instance, or index in the NSScreen.screens array
may not be stable.

Quartz Display Services on the other hand tracks displays via a unique
display ID, which typically remains constant until the machine is restarted.
The lower level API also gives us earlier callbacks about screen changes
than the corresponding NSApplicationDidChangeScreenParametersNotification
does. By reacting to screen changes _before_ AppKit does, we can remove
workarounds for receiving window move and screen change notifications
before the screen was actually visibly reconfigured.

The new approach also handles changes to the primary screen, which
can happen if the user moves the menu bar in the macOS display
arrangement pane.

The device pixel ratio of the screen has been made into a cached
property, like all the other properties of QCocoaScreen. This is
more consistent, and allows us to qDebug the screen even when it
has been removed and we no longer have access to resolve the
properties from the associated Quarts display.

Change-Id: I2d86c7629ed3bf5fb8c77f174712633752ae4079
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2019-05-13 10:46:53 +00:00
Frederik Gladhorn
3da9d8a4fe Make sure QAccessibleTableCell is valid before reference
There are some cases (model resets in weird positions) where we would
crash due to accessing invalid model indices.

Fixes: QTBUG-61416
Fixes: QTBUG-71608
Change-Id: Ibfedcbd921a3145f3e1596ac424a77f2319a5c46
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2019-05-13 10:07:30 +00:00
Qt Forward Merge Bot
f8212b87d9 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I0c00ffe0eabebc919f22d6faa4bf958b288e8fd9
2019-05-12 01:00:08 +02:00
Laszlo Agocs
45aa3c73f7 hellogles3: Request core profile context
...instead of compatibility, in order to play nice with systems
that have no compatibility profile support (macOS). Instancing
needs OpenGL 3.x so sticking with 2.x contexts is not an option.

The example looks fully compatible with core profile so its
functionality should not change.

Change-Id: If0d554a6208973aa8a4fb86757e246d170cd0e71
Fixes: QTBUG-75680
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-11 12:01:53 +00:00
Tor Arne Vestbø
a9246c7132 Reset QWidget's winId when backing window surface is destroyed
We already reset it though e.g. QWidget::destroy, but if the backing
window is destroyed spontaneously or via another API we need to catch
that and send a WinIdChange event so clients who pulled out the original
winId will not think the pointer is still valid

Change-Id: I8556940ee871e81a51f73daeb2064f95bf41371c
Fixes: QTBUG-69289
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-05-11 12:01:40 +00:00
Giuseppe D'Angelo
41aa78856e QSharedPointer: fix threadsafety docs
Try and explain better the situation around QSharedPointer:
it's reentrant, not thread safe.

Change-Id: Ief9d28be8ea3fbaa6014cb6b999626db1bab52ca
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-11 10:16:40 +00:00
Vova Mshanetskiy
341c910688 Android: Fix wrong height of text editor context menu in some locales
Combined width of all four buttons (cut, copy, paste, select all) is
greater than width of the screen in some locales and/or on some devices.
This was causing width of the last button to be set to zero and height
of the whole popup to grow too much due to word wrapping in the last
button. The context menu used to look something like this then:

  Cut    Copy    Paste    S
                          e
                          l
                          e
                          c
                          t

                          a
                          l
                          l

This commit disables word wrapping and enables text ellipsizing for
button labels. This fixes height of the popup. In the long term though
Qt will probably have to implement an overflow button like in Android's
built context menu.

The linked bug report contains before and after screenshots.

Fixes: QTBUG-72933
Change-Id: I8e270dbf8ca66f99748cdc531a77e11a5ab11c2b
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-05-10 20:24:07 +00:00
Vova Mshanetskiy
c905ff4392 QAndroidInputContext: Fix start value of Cursor attribute in longPress()
The value of start for a QInputMethodEvent::Cursor attribute must be
specified relative to the start of preedit string, but longPress() was
specifying it relative to start of surrounding text. This was causing
QQuickTextInput to return wrong values of cursor and anchor rectangles.
And this was causing invalid positioning of cursor selection handles
after a long press.

Change-Id: Ief67e86dd90b09ebf2ba191a2b0311ff803afdd9
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-05-10 20:23:55 +00:00
Allan Sandfeld Jensen
4d2ee7f358 Add unvectorized fallback in case FP exceptions are not masked
If an application enables FP exceptions our FP-based unpremul will
raise the INVALID exception. Since disabling them locally might be slow
just take a slow path when detected.

Fixes: QTBUG-75592
Change-Id: Ie22a032a4f62229f68ad21ede359c62291adc9bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-05-10 19:35:10 +00:00
Ville Voutilainen
2a1651cc16 Make moc grok binary literals with digit separators
Task-number: QTBUG-75656
Change-Id: I6011ef2fb07497cc2a055d6828a1b6356927c281
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-05-10 18:34:02 +00:00
Tor Arne Vestbø
c99678fb19 macOS: Deliver geometry changes when content view changes frame
This was disabled in 9f22ac0aa0 under the
assumption that the windowDidResize callback was sufficient, but in the
situation when macOS native tabs are enabled, AppKit will report the
wrong geometry for the first windowDidResize callback when a new tab
is created.

We could potentially remove the geometry change in windowDidResize,
as the viewDidChangeFrame callback should be enough for content
views, but this is something that needs more investigation.

Change-Id: I85045507da1a01b4a906e6f88301f3321c660943
Fixes: QTBUG-75482
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-10 17:15:29 +00:00
Tor Arne Vestbø
123053bba8 macOS: Don't clip menu item drawing to bounding rect when using CoreText
The bounding rect was computed based on the font metrics HarfBuzz gave
us, but those may not be 1:1 with what CoreText ends up using. When that
happens, drawInRect: will line-break the last word, which makes it fall
completely outside of the single line bounding rect. This is not a good
failure mode, so we prefer to draw the text at a point instead, allowing
the resulting text to draw slightly outside of the bounding rect. This
is preferable to adding a random padding to the width and hoping it will
be enough to solve the problem.

Change-Id: Ifa58a33bd9fad689ed4ee947327b7079f3c1b61d
Fixes: QTBUG-74565
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-10 17:15:27 +00:00
Keith Kyzivat
b7edc811ec Work around VS2015/17 bitset + qfloat16.h compiler bug
[ChangeLog][QtCore][Global] Added the QT_NO_FLOAT16_OPERATORS macro in
order to work around a Microsoft <= VS2017 compiler bug that is
exposed when using std::bitset along with any Qt header that includes
<qfloat16.h>.

This is fixed in MSVC 2019[1], but the workaround is needed for
earlier versions.

In this case, cl.exe fails with
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\bitset(270): error C2666: 'operator /': 10 overloads have similar conversions
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qsize.h(364): note: could be 'const QSizeF operator /(const QSizeF &,qreal)'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qsize.h(194): note: or       'const QSize operator /(const QSize &,qreal)'
    c:\qt\5.12.0\msvc2017_64\include\qtcore\qmargins.h(427): note: or       'QMarginsF operator /(const QMarginsF &,qreal)'
    c:\qt\5.12.0\msvc2017_64\include\qtcore\qmargins.h(213): note: or       'QMargins operator /(const QMargins &,qreal)'
    c:\qt\5.12.0\msvc2017_64\include\qtcore\qmargins.h(207): note: or       'QMargins operator /(const QMargins &,int)'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(205): note: or       'double operator /(int,qfloat16) noexcept'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(205): note: or       'double operator /(qfloat16,int) noexcept'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(195): note: or       'float operator /(float,qfloat16) noexcept'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(195): note: or       'float operator /(qfloat16,float) noexcept'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(194): note: or       'double operator /(double,qfloat16) noexcept'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(194): note: or       'double operator /(qfloat16,double) noexcept'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(193): note: or       'long double operator /(long double,qfloat16) noexcept'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(193): note: or       'long double operator /(qfloat16,long double) noexcept'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qfloat16.h(176): note: or       'qfloat16 operator /(qfloat16,qfloat16) noexcept'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qpoint.h(402): note: or       'const QPointF operator /(const QPointF &,qreal)'
    C:\Qt\5.12.0\msvc2017_64\include\QtCore/qpoint.h(206): note: or       'const QPoint operator /(const QPoint &,qreal)'
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\bitset(270): note: or       'built-in C++ operator/(::size_t, )'
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\bitset(270): note: while trying to match the argument list '(::size_t, )'
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\bitset(266): note: while compiling class template member function 'std::bitset<8> &std::bitset<8>::set(::size_t,bool)'
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\include\bitset(39): note: see reference to function template instantiation 'std::bitset<8> &std::bitset<8>::set(::size_t,bool)' being compiled
    ..\Qt5.12.0-C2666\main.cpp(7): note: see reference to class template instantiation 'std::bitset<8>' being compiled

Invoke this workaround by defining the macro QT_NO_FLOAT16_OPERATORS
in user code prior to the inclusion of Qt includes in a translation
unit.

Arithmetic operators from qfloat16 will then not be present in that
compilation unit.

[1] https://developercommunity.visualstudio.com/content/problem/406329/compiler-error-c2666-when-using-stdbitset-and-cust.html

Task-number: QTBUG-72073
Change-Id: I58f8400bf933ad781d4213731695e20e0c482166
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-05-10 16:29:50 +00:00
Tor Arne Vestbø
3159845c9c macOS: Implement QCALayerBackingStore::toImage()
It's not part of the QBackingStore API, but clients such as the Qt Quick
software renderer access it through the platform backingstore, to grab
the window.

Change-Id: I203484ce13a5f8fb6815d27ab07f874fa9d16b8c
Fixes: QTBUG-75467
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-10 09:41:41 +00:00