Commit Graph

30853 Commits

Author SHA1 Message Date
Edward Welbourne
556b2ee773 Network (HTTPS): prevent recursion among ->close() methods
We observed a stack-trace in which, while handling an error,
QHttpNetworkConnectionChannel::close()'s call to its socket->close()
triggered (when the socket was a QSslSocket) a flush() which asked its
backend to transmit() which tripped over the original error, which
duly triggered endless recursion.  Transiently clear the socket
member, during its ->close(), to prevent this; do the same in abort(),
to preserve its structural correspondence to close().  Restructure
both so that any recursive call's setting of state is overwritten by
the top-level call's, while this still uses the prior socket state
(not the state after close() or abort() and any recursion) to
determine final state.

Task-number: QTBUG-56476
Change-Id: If69e97f7a77a729bf2338ed14214c65aa95f8b05
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-01-17 05:12:57 +00:00
Jake Petroules
7634225ad2 Fix whitespace, formatting, and line length in QOperatingSystemVersion
Change-Id: Ie26571a8098e8215a6bc1e0e363763e5fc546bcd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-17 01:40:54 +00:00
Sebastian Lösch
14bff46df4 Introduce QNetworkAccessManager::clearConnectionCache()
Sometimes it is desirable to use a new connection but keep already
entered user credentials for usability reasons. This is now possible by
clearing the connection cache (but keeping the authentication cache).

Change-Id: I2f5f64836ce19f81c8525701783a3da823dd468e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-01-16 11:04:46 +00:00
Pier Luigi Fiorini
abb47fc680 Add screen product information
Add new methods to QPlatformScreen that platform plugins can reimplement
in order to provide more information such as vendor, model and serial
number.

Expose that information as QScreen properties.

A use-case for this feature is a Wayland compositor that maps screens
to Wayland outputs hence it needs to replicate the information.

This information can also be added to the diagnostic output of qtdiag.

[ChangeLog][QtGui][QScreen] Add manufacturer, model and serialNumber
properties.

Change-Id: Ia6945f41023340602ef9d618e0d833a0c1825ab3
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-01-16 07:46:39 +00:00
Marc Mutz
3b0cd13222 QGradient: add a setStops fast-path for conformant QGradientStops
The setStops() docs state that the stops need to be sorted and the positions
must be valid. But the implementation sorts the stops and filters out invalid
ones, so we probably need to keep that behavior, which, however, causes memory
allocations and, potentially, O(N²) behavior, because setColorAt() uses a
form of Insertion Sort with linear scanning...

Add a fast-path for the common case that users adhere to the docs and pass
valid stops.

Change-Id: I93099a57bc4f37d1240a9e9f763618fd5095bc64
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-14 06:27:52 +00:00
Kimmo Ollila
01cade5050 Fix build for INTEGRITY
Change-Id: I2c41295688e962eb263f2180bebfd1dd37613804
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-01-13 07:52:16 +00:00
Jake Petroules
2f08a1d614 qglobal.cpp/QSysInfo::macVersion(): Silence deprecation warning
clang/g++ still warn when encountering the implementation of a
deprecated function.

Follows up 21a247adb4

Change-Id: I6ab1695acb520ef7ce7cb1896545d02607c3ce29
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-01-13 01:53:48 +00:00
Giuseppe D'Angelo
6255cb893d Remove qtypetraits.h's contents altogether
So that QFlags can use an (un)signed int matching the
underlying type as identified by the compiler and not by us.

Requires fixing a few warnings about sign conversion due to
QFlags misusages in qtbase that were either plain wrong, or
were relying on the enum being backed by an (un)signed int
when it wasn't.

Keep qtypetraits.h in the source tree in order to prevent
source breaks if some downstream #includes it (note however
that it did not contain any public API).

Change-Id: Ib3a92b98db7031e793a088fb2a3b306eff4d7a3c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 22:16:06 +00:00
Alexander Volkov
a4c25c0205 Add expandingListItems property to QListView
This property allows to change the default behavior in
which list items occupy the entire width of the column.
Setting it to false will reduce their widths to the
minimum values, thus allowing to have intermediate free
space. Then the user will be able to begin selections
by mouse from this space.

[ChangeLog][QtWidgets][QListView] Added expandingListItems property.

Change-Id: I6bd1b147fd0335324310a165104c36f6b0d6ac9f
Task-number: QTBUG-56606
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2017-01-12 17:54:52 +00:00
Alexander Volkov
dcec1420ea Use QString::asprintf(), QStringBuilder, and the multi-arg overload of QString::arg()
... instead of sequential .arg(const QString &) callings.
It saves memory allocations and prevents unexpected results
if replacing strings contain place markers.
Found with clazy's qstring-arg check.

Change-Id: I3912275a6e11c6fb7559ff5623f2e8cde9b7f07a
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 17:54:28 +00:00
Edward Welbourne
8f469e4a19 Remove two unused static methods of QDateTimePrivate
... along with the two matching unused methods of QDateTime's test.

Change-Id: Id11a4b1b0132587f0df451d49c0043e9425d87ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 16:42:21 +00:00
Gabriel de Dietrich
a50ed8685f QCocoaWindow: Fix 10.10 sheet API deprecation warning
'beginSheet:modalForWindow:modalDelegate:didEndSelector:
contextInfo:' is deprecated: first deprecated in macOS
10.10 - Use -[NSWindow beginSheet:completionHandler:]
instead [-Wdeprecated-declarations]

Similarly, although it won't emit any warning, we replace
the usage of -[NSApplication endSheet:] wit -[NSWindow
endSheet:].

Change-Id: Iae71247f818b7183d09c6831fa4cb1b71a54a87a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-01-12 02:14:25 +00:00
Jake Petroules
2b928ef6f9 Provide sensible defaults for QCoreApplication::applicationVersion
[ChangeLog][QtCore] QCoreApplication::applicationVersion now defaults to
an appropriate platform-specific value. On Windows, it defaults to the
PRODUCTVERSION parameter of the VERSIONINFO resource for classic desktop
apps, and the version attribute of the application package manifest for
Univeral Windows Platform apps. On Apple Platforms (macOS, iOS, tvOS,
watchOS), it defaults to the CFBundleVersion property of the information
property list (Info.plist) file. On Android, it defaults to the
android:versionName attribute of the AndroidManifest.xml manifest
element. On other platforms, the default remains an empty string.

Task-number: QTBUG-57715
Change-Id: I26f83dd00737e06f4321cf962aa5fab8398104ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 02:13:21 +00:00
Friedemann Kleint
5865e582fd Windows QPA/Open file dialog: Copy non-filesystem items
With the introduction of the new IFileDialog interfaces in Qt 5,
the open file dialog no longer was able to open items on
MTP mounted devices.

The Win32 API GetOpenFileName() used in Qt 4 would hide this
by creating a local copy of the file in the INetCache folder.

Add code to emulate the behavior in
QWindowsNativeOpenFileDialog::dialogResult().

Task-number: QTBUG-57070
Change-Id: I88cccfbf9697585225356cc864df67c86a912c91
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-11 14:40:41 +00:00
Friedemann Kleint
1d2a32d1c0 Windows QPA: Refactor conversion of IShellItem
Introduce a light wrapper class around IShellItem which
hides its idiosyncracies.

Task-number: QTBUG-57070
Change-Id: I60a825ea7a826d67859ab82537d614ecc3367692
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-11 14:40:36 +00:00
David Faure
f99589a515 modeltest: use QCOMPARE where possible
QVERIFY(a==b) is less useful than QCOMPARE(a, b) in case of an error.

Change-Id: Ibd294e7a1e9b55a9780551869c8477f6e41355ac
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-01-11 14:27:13 +00:00
Marc Mutz
2ee5b5de22 Remove unused QEmptyModel
It's not exported and, while all-inline, is not used anywhere in Qt.
Since it's in a private header, it follows that we can safely remove
it.

Change-Id: I4b5534e4cf8187232bdce0a9f7a4795ece1e3555
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-11 13:07:10 +00:00
Robin Burchell
5723c53708 moc: Don't test _id if there are no methods or properties
This is unnecessary (as the fallback behavior is return _id anyway),
and it makes coverity unhappy.

Coverity-Id: 173293
Change-Id: I91c016f3ed363319c6413ab3c2688698faf4f10f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-11 12:31:00 +00:00
Robin Burchell
1a7ebeb5cb moc: Don't check for signalList size
We already check methodList, and as it is comprised of signalList,
slotList and methodList from cdef, this is redundant.

Change-Id: I0d1791f821134060aa20a8ea9b57f049b2701bf9
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-11 12:30:54 +00:00
Edward Welbourne
4b4bd6ab98 Simplify fileTimeToQDateTime() by having it return a UTC time
This avoids so many complications.  The prior code, using
SystemTimeToTzSpecificLocalTime(), lead to unhelpful results when the
QDateTime() implementation used MS-POSIX's defective mktime().
Although SystemTimeToTzSpecificLocalTime() is actually more correct,
we were getting inconsistent results by mixing the two: and
eliminating the use of mktime() turns out to be decidedly tricky.  So,
to avoid inconsistency, stick with a UTC time (which is what FILETIME
is defined as).  Change QFileInfo's methods to explicitly convert
.toLocalTime() where appropriate and document that these methods do
indeed return local time (as we conjecture has been taken for granted
by callers).

Also added a regression test for the reported case of this going
wrong.  A time-stamp from before Russia's (permanent, not DST) change
of TZ could end up inconsistently handled between file-system
meta-data and raw date-time APIs, due to cross-talk between different
MS-Win time APIs.

[ChangeLog][QtCore][QFileInfo] Made sure that all file lifecycle times
are in local time. This was probably true before, but is now explicit.

Task-number: QTBUG-48306
Change-Id: Ic0b99d25c4168f623d31967bc60665c0c4f38a14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-11 11:53:27 +00:00
Tor Arne Vestbø
80bbaf6fad iOS: Detect mismatched calls to IM::update() before IM::setFocusObject()
The focus object should be updated, resulting in a reset(), before any
manual calls to update() from client code. To be on the safe side we
try to detect when this assertion fails and manually fix the situation,
so that we show/hide the keyboard correctly based on the new focus item.

Change-Id: I15a614cc9553b0a26b0dc7f7beefb56a84645861
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-01-11 11:36:34 +00:00
Timur Pocheptsov
ff5ce39e21 qhttp2protocolhandler - handle proxies correctly
For requests through proxy, the Request-URI (':path' header) must
contain full url.

Change-Id: Ibecdf4556b0cecf731da0f89b241bb86a07fa3ad
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-01-11 10:45:26 +00:00
Timur Pocheptsov
1636f3bc92 HTTP/2 - fix handling of GOAWAY frame
- Fix the case when we erroneously handled stream ID == 0 in a GOAWAY frame as
an invalid stream ID.
- _q_receivedReply: convert do{}while() loop into to while(){} to prevent
it from handling any frames after GOAWAY frame received and all active frame
finished.
- sendRequest - if we received GOAWAY, also clear spdyRequests in the connection
channel, otherwise it keeps re-trying to send requests!
- Http network connection channel never resets a protocolHandler in _q_encrypted/
_q_connected, which is BAD for HTTP/2, since HTTP/2 has unique per-connection
compression context and must be reset - now we recreate the protocol handler in
_q_encrypted or _q_connected (https/http).
- Update autotest.

Task-number: QTBUG-57600
Change-Id: Ib864ce52287bab23334ff43a83ba4b0b7cb52c60
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-01-11 10:39:43 +00:00
Tor Arne Vestbø
6f504a1cdd Widgets: report focus object change to QtGui before sending widget events
Updating the focus child means the focus object of the window has changed.
We need to report this to QtGui immediately so that it can e.g. inform the
input context of the new focus object, before widgets reacting to the focus
events start calling update() on the input method.

Change-Id: Ie3f7b835591e71519e3f384c2abdad53242c9736
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-01-10 23:24:57 +00:00
Oswald Buddenhagen
166f23eb92 make cross_compile a public feature
... so other modules (qtwebengine) can query it in a modular build.

Change-Id: I849947339e91db44be9280ead75fb423c62957e3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
2017-01-10 10:19:01 +00:00
Kimmo Ollila
03a59d1bb8 Add support for building for INTEGRITY using GHS toolchain
Initial support for INTEGRITY to build QtBase

Change-Id: I18f36b4dea9107f01e1c281e4b62880590c777a1
Reviewed-by: Tuukka Turunen <tuukka.turunen@theqtcompany.com>
Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
Reviewed-by: Risto Avila <risto.avila@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-10 10:06:23 +00:00
Giuseppe D'Angelo
a35a01aaa2 QForeachContainer: make it a move-only type
Honor the rule of five. Copy assignment was already disabled.
Disable also copy construction, but re-enable the move special
member functions.

This requires making the container non-const; to avoid detaches
and keep compatibility with containers that only have begin/end
(but not cbegin/cend), use qAsConst. This requires moving qAsConst
definition a bit up in the file.

Change-Id: I19cd74437cf69baceada9483920a21e96d7b1727
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 08:29:19 +00:00
Marc Mutz
b2173b54ef Long live QTest::addRow()!
This new function does the same as newRow(), except that it has a less confusing
name (in line with _add_Column()), and accepts printf-style arguments to avoid
the need to newRow(qPrintable(QString::asprintf())), a common pattern in client
code. It uses qvsnprintf() under the hoods, avoiding the need for the QString
const char* round-trip.

Port all in-tree users of newRow(qPrintable(QString::asnprintf())) to the new
function.

Change-Id: Icd5de9b7ea4f6759d98080ec30f5aecadb8bec39
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 07:47:26 +00:00
Friedemann Kleint
d135acfa43 Windows QPA: Implement setting the "Cancel" button text of file dialogs
The functionality was missing in IFileDialog. As of Windows 7;
IFileDialog can be queried for IFileDialog2, which provides it.

Task-number: QTBUG-44112
Change-Id: I0c0345d516bbc36f9bb519545f5eda1289c9ef23
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-01-10 07:21:52 +00:00
Allan Sandfeld Jensen
3d08f308f1 Fix toArgb32 on NEON
The color components were not correctly shuffled to ARGB host-order
form.

Discovered and tested with tst_QPainter::blendARGBonRGB on ARM.

Change-Id: I2ef9b6129dd83f3c6be0b30c0a5e3684564e6b2f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2017-01-09 12:03:31 +00:00
Alexander Volkov
7991a70d28 vnc: Replace Q_DECL_OVERRIDE by override
Change-Id: Id06dfc73d1ad41822b2f07b585f32e9e6e5d08f2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-01-09 10:21:44 +00:00
Jake Petroules
6b7e633248 Remove compatibility code paths for macOS < 10.10 and iOS < 8.0
Change-Id: I11bec0efc2b4d86adf64a58990260fee70f050ac
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-01-09 10:11:48 +00:00
Pier Luigi Fiorini
747e569597 eglfs: Activate the window on the primary screen
Having the window on the last screen focused is inconvenient since the
main application UI is likely to be shown on the primary screen.

Change-Id: I2e7945a903cb432d3428c773ac89c662374632c9
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-01-09 09:59:30 +00:00
Pier Luigi Fiorini
1087150f6a QOpenGLCompositorWindow virtual destructor
QOpenGLCompositorWindow had virtual methods and accessible non-virtual
destructor.

Change-Id: I50e5bc30e0fce9a39db83ae395fcab239b251c59
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-01-09 09:59:14 +00:00
Gunnar Sletta
a98652cfc2 A few fixes to evdev touch filtering
- Clamp the position to the bounding rect of the device
- Send TouchRelease only once

Change-Id: I8776079dbc886612e6adfb1fef5ec7cf14a8af3b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2017-01-09 06:13:21 +00:00
Elvis Angelaccio
3f455a4b53 Introduce QDir::isEmpty()
A directory is empty when it doesn't contain files or folders.
We can exploit QDirIterator::hasNext() to check whether this is the
case. This is efficient since it doesn't list the whole folder (in the
non-empty case).

Test cases are added for both the empty and non-empty cases.

Change-Id: I0f7e26782c0f97f9c16f928dab6cae37927875d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-08 16:11:34 +00:00
Pierre Rossi
5311d481c2 Doc update: reflect use of native font dialog by default on macOS
The documentation still stated that the Qt standard font dialog was
used.

Task-number: QTBUG-47572
Change-Id: Iff4262869efde2d9fefb38264b2f6f8a9d2f7483
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-01-08 09:07:51 +00:00
Martin Smith
1885952c23 qdoc: Exclude platform dependent .cpp files
clangqdoc can't parse platform dependent source files
because they try to include platform dependent system
include files. e.g., When clangqdoc is run on macOS,
the Windows system include files are not available.

This change adds all the platform dependent .cpp files
to the excludefiles config variable. This means that
qdoc comments are no longer allowed in the excluded
files. There shouldn't be any documentation in these
files anyway. Platform dependent documentation should
be in .qdoc files or in generic .cpp files that do not
try to include platform dependent include files.

Note that .m and .mm files are excluded programatically
in qdoc.

Change-Id: I8f93fe9f5604e558b3df8c8cc8ee723010bf885d
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-07 18:51:29 +00:00
Martin Smith
740ff1b881 qdoc: Remove Q_OS_* frome defines variable
In clangqdoc, we no longer define platform-specific
macros, because they make clang try to include too
much include stuff. Instead, when we have something
like #if defined(Q_OS_XXX) surrounding something we
want clangqdoc to see, we add the Q_CLANG_QDOC macro
like this: #if defined(Q_OS_XXX) || defined(Q_CLANG_QDOC).
This should not be done everywhere Q_OS_XXX is used, but
only where there is some platform-specific things we want
to document.

Change-Id: I97bb57e9b0c044899fa45b0beb02702906d5c89a
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-07 18:51:12 +00:00
Martin Smith
4f24e30f57 qdoc: Add config variable for clang defines
The qdoc 'defines' config variable lists values
that contain '*' to represent wildcards, but clang
doesn't accept them. This change adds a new config
variable called 'clangdefines' which explicitly
lists all the defines that match the wildcards.

It also lists several Qt defines for C++11 stuff,
because when clangqdoc comes into use, all the
supported compilers for Qt will support C++11
constructs.

There might be a few defines listed in clangdefines
that are unnecessary and maybe a few that we really
should not include, but we can adjust the list as
needed.

The clangqdoc code that reads this new config variable
will be added in a separate change. This change will
not affect the non-clang qdoc, because qdoc will just
ignore the clangdefines variable.

This change also adds Q_CLANG_QDOC to 'defines' and
to 'clangdefine'. Q_CLANG_QDOC is meant to be used
in the sources the way Q_QDOC is used. It indicates
that a particular use of Q_QDOC has been reviewed and
is still required for clangqdoc.

Change-Id: I3b00b18ec726196eda5cfa8411cd3e87433fec59
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-07 18:50:53 +00:00
Martin Smith
29bbbe5e60 doc: update QPrinter docs for clangqdoc
The docs for QPrinter contained a use of Q_QDoc to
declare an enum representing paper sizes for different
printers, but this special declaration for qdoc was
no longer needed, so it was removed. The real declaration
is in QPagedPaintDevice, which is the public base class
of QPrinter, and it is documented there. A few other
uses of Q_QDOC were examined and either removed or
upgraded to Q_CLANG_QDOC. One use of Q_OS_WIN was
changed to also be included for Q_CLANG_QDOC.

Change-Id: If6d810c624aa8d659fd0e3e753ba666d4d42ef83
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-06 20:18:39 +00:00
Martin Smith
9605f4f47b doc: clangqdoc documents the threads case
qmutex.h is updated to let clangqdoc document the threads case,
because the no-threads case is not interesting, and clang can
handle everything declared in qmutex.h. This change required
that a few minor qdoc errors be corrected in qmutex.cpp as well.

Change-Id: Icb4122f2179d6aad39dc68376498364820143297
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-06 20:18:19 +00:00
Gabriel de Dietrich
0e810e27a5 QMacStyle: Fix drawing of PE_IndicatorMenuCheckMark
... And refactor to use it for drawing CE_MenuItem.

This removes a couple calls to HITheme. Instead, we
use CoreText to render the checkmark character. Notice
that this is what we were doing with HITheme for
CE_MenuItem. Drawing PE_IndicatorMenuCheckMark was
done manually, and in a way that has not been updated.

Notice also that the choice of color from the palette
has also been fixed to look for the State_Selected state
instead of the State_On state, in accordance with
QCommonStyle. In fact, on macOS, the checkmark is never
rendered when the State_On bit is clear. Moreover, we
systematically pick the checkmark color from the style
option palette.

[ChangeLog][QtWidgets][QMacStyle] PE_IndicatorMenuCheckMark
looks for State_On instead of the State_Selected to set its
highlighted state. Its color is picked from the style option
palette.

Change-Id: Ib033df357fd83080cb4320c43949f75bb079c8a5
Task-number: QTBUG-57470
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-01-06 19:41:54 +00:00
Gabriel de Dietrich
64f4108c3a QMacStyle: Remove unused focusRectPolicy methods
Change-Id: I436c714aee25d8def4318a4b0aef022493dec19f
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-01-06 19:35:16 +00:00
Tor Arne Vestbø
60d6b3c565 macOS: Fix unused function warning in tst_QWidget
Change-Id: I9c3b1c2216b15bb8da961a4e188040e32d269809
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-01-06 16:30:06 +00:00
Tor Arne Vestbø
5da5586a96 iOS: Ensure that QPlatformBackingStore can clean up textures in dtor
We are using QPlatformBackingStore::composeAndFlush, which allocates
textures on our behalf using the context that we pass in, so we need
to keep the context alive (and make it current) for the duration of
the QPlatformBackingStore destructor, otherwise we're leaking textures
every time a window (dialog e.g.) is closed.

Change-Id: I1450fa0ff7a170d13ec59920566e4401b50cd513
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-01-06 16:30:00 +00:00
Tor Arne Vestbø
3c99bddb84 iOS: Center IM cursor rectangle within available space when showing keyboard
The cursor rectangle is translated into screen coordinates, and compared
against the screen geometry after subtracting the future keyboard rect
(which is already in screen coordinates). If the two do not overlap
completely, the root view is shifted accordingly so that the cursor
rectangle is placed in the center of the available space.

A future improvement would be to first check if centering the input
item's clip rectangle would bring the cursor within the available
geometry, before falling back to using the cursor rectangle. This
would look better for multi-line text inputs where the cursor is
not in the center.

Task-number: QTBUG-46747
Change-Id: If9b551b4d297e2a1f6d7f84b81628fa65c08edfd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-01-06 16:29:48 +00:00
Elvis Angelaccio
34f82b8abc Improve mime type filters in QFileDialog
This patch improves the handling of mime type filters in QFileDialog.

The main change is in selectMimeTypeFilter(), which was just falling back
unconditionally on selectNameFilter(). Instead, mime type filters should
have an higher priority than name filters.

This patch also adds a new selectedMimeTypeFilter() method, which is used in the unit test.

Change-Id: Ice8bb08f5ff46e4a942d539f6001424eca878f74
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-06 16:27:41 +00:00
Tor Arne Vestbø
bc80cef1d4 iOS: Limit duration of FirstResponderCandidate to becomeFirstResponder
We only need the FirstResponderCandidate for the duration of the call to
[super becomeFirstResponder]. Keeping it around longer means that when
emitting window activation events, which may result in changing the
first responder again, we may wrongly conclude that we're not allowed
to change the responder due to the FirstResponderCandidate still being
alive.

Change-Id: I8203e795cdde4128776283fe63a1907eb6ebc151
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-01-06 13:31:26 +00:00
Marc Mutz
8ad200dcb4 tst_QImageWriter: clean up
- 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>
2017-01-06 13:31:26 +00:00