Commit Graph

7114 Commits

Author SHA1 Message Date
Liang Qi
90c425642d Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/common/linux-android.conf
	src/gui/opengl/qopengl.h
	src/network/socket/qnativesocketengine_winrt.cpp
	src/network/socket/qnativesocketengine_winrt_p.h
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
	src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
	sync.profile

Change-Id: If70aaf2c49df91157b864cf0d7d9513546c9bec4
2016-11-16 12:35:36 +01:00
Oswald Buddenhagen
c05f0a83fd qmake: make discard_from() patch up QMAKE_INTERNAL_INCLUDED_FILES as well
when the file's effects are discarded, the mention of the file should be
as well.

Change-Id: I894b7e2b887dd34d18533b197bfa9d0d84d647e7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-11-15 22:44:27 +00:00
Oswald Buddenhagen
965e861e61 qmake: let discard_from() discard function definitions as well
for completeness.

Change-Id: I3ffc14e041408c773e277442828170e3df04ec8d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-11-15 22:44:23 +00:00
Allan Sandfeld Jensen
887e260a93 Improve QMake JSON error
We can not improve the result from JSON parsing without changing API,
so instead recalculate the line and column based on input and offset.

Change-Id: I54149233f71023aa5d30deff854d6f3406c5c48c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-11-15 17:27:01 +00:00
Allan Sandfeld Jensen
e133f0cca4 Improve error offset in JSON parsing
Do not consume white-space after a token before the token has been
parsed, otherwise we end up with misleading offsets. This also fixes
a wrong error of illegal number in several cases.

Change-Id: I492ca4de0346a1d0ab73b1c23d7a72dba812664c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-11-15 14:19:23 +00:00
Liang Qi
9808b53fde Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	configure
	src/plugins/platforms/eglfs/qeglfsintegration.cpp
	src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp

Change-Id: Id2da7c775439adb62646d5b741ee7c638042b34b
2016-11-15 09:58:16 +01:00
Lars Knoll
94f9ee79a6 Clean up some conditions in our pro files
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>
2016-11-14 19:22:17 +00:00
Friedemann Kleint
d91bf00c43 tst_QFileSystemModel::specialFiles(): Remove Windows parts
The test created a Windows shortcut (.lnk) and checked on its existence.
It was not found in the first test since QFileSystemModel returned
the resolved file name (linktarget.txt). When fixing this by querying
QFileSystemModel::fileInfo()::fileName(), the 2nd test failed since
shortcut files are not considered system files.
Amends change 3b093034b6.

Task-number: QTBUG-53890
Task-number: QTBUG-20968
Task-number: QTBUG-29403
Change-Id: Iec58b52532b44d12759eaa6c8d63a8a4dc8d1bc3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-11-14 15:26:32 +00:00
Oswald Buddenhagen
8db556d299 fix $$section()'s bad argument count error message
the autotest was also broken, because it was created by pasting the
bogus message into the result ...

Change-Id: I02b8663b96c7d96cdb3c19639e2213e49fd2bcec
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-11-14 12:18:56 +00:00
Maurice Kalinowski
dffde23a0a Fix writing into application directory
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>
2016-11-11 15:36:10 +00:00
Lars Knoll
bfaa8925d5 Improve the validation algorithm for binary JSON
Add better boundary checks and catch (hopefully all)
cases where invalid binary JSON could cause crashes.

Change-Id: I206510b7c5e3ba953802a5f46645878e65704ecc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-11-11 12:34:27 +00:00
Gabriel de Dietrich
5cff7d2b67 QComboBox: Prioritize the model font for popup items
On Mac, we use QComboMenuDelegate specifically as
item delegate for the popup list. It happens that
the order of resolving the font for each item
individually would prioritize QComboBox's font
instead of whatever the assigned model's FontRole
would specify.

The fix only requires checking whether FontRole is
valid before falling back QComboBox's properties.

Change-Id: I7208ad1911b30cc52c826c1884a1e19f5acd9fb4
Task-number: QTBUG-56693
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-11-10 05:40:29 +00:00
Eskil Abrahamsen Blomfeldt
15414257b3 Don't count no-break spaces as trailing spaces
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>
2016-11-09 16:24:46 +00:00
Kai Koehne
615270a300 Rename QtPrivate::is_[un]signed to QtPrivate::Is[Un]signedEnum
Any other use than for enums should use std::is_[un]signed. Make this
explicit by renaming the type traits.

Change-Id: I494158563c95c710e710d0d337f4e547006df171
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-09 09:13:29 +00:00
Kai Koehne
5c3b16706f Remove compiler-specific implementations of Q_IS_ENUM
Since the macro is now just a wrapper for std::is_enum,
its use is also deprecated.

[ChangeLog][QtCore][Global] Q_IS_ENUM is deprecated.
Use std::is_enum<>::value instead.

Change-Id: I09b9f4559c02c81f338cace927873318f2acafde
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-09 09:13:01 +00:00
Daniel Vrátil
9de3b15d07 QLabel: take DPR of QMovie in account when calculating sizeHint
QLabel already does that for QPixmap, so just do the same for
QMovie's current pixmap.

Task-number: QTBUG-48157
Change-Id: I7b26460f778e56ff017a5efd433f8929f30e4b41
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-11-09 09:09:26 +00:00
Kai Koehne
ed7f77071d Replace custom type traits with std one's
Remove most type traits from qtypetraits.h, but keep the custom
implementation of is_signed/is_unsigned. This gets rid of
BSD-3 licensed code from Google in a public header (hugh!).

The custom implementations for is_signed/is_unsigned are kept
because the implementations in gcc's standard headers do not
work as we expect for enums - both is_signed and is_unsigned
always returns false there - see also
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59027

[ChangeLog][QtCore][General] Qt now relies on type traits from
the C++ standard library.

Change-Id: I3f2188b46949f04ca4482a6ac9afd3482103f0e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-08 15:31:17 +00:00
Morten Johan Sørvig
356f5bbac3 Cocoa: Make child window cursors work correctly
The existing cursor logic had a couple of issues:

- It made the faulty assumption that we could not use
the NSWindow invalidateCursorRectsForView API for
child NSViews.

- It used NSWindow invalidateCursorRectsForView and
NSView resetCursorRects. This API has been replaced
by the more general NSTrackingArea API.

- It did not implement falling back to the parent
window cursor if the current window has no cursor
set.

Document that QWindow cursors work the same way as
QWidget cursors in that a QWindow with no set cursor
will fall back to the parent window cursor.

Change the cocoa platform code to use NSTrackingArea
exclusively and implement NSView cursorUpdate which
sets the cursor. Handle immediate change on QWindow::
setCursor() manually.

Add QWindow::effectiveWindowCursor() and
applyEffectiveWindowCursor() which finds the correct
window cursor.

Add a manual test for the child window, child widget,
and QWidget::createWindowChild cases.

Task-number: QTBUG-33479
Task-number: QTBUG-52023
Change-Id: I0370e11bbadb2da95e8632e61be6228ec2cd5e9d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2016-11-08 12:30:45 +00:00
Allan Sandfeld Jensen
baebb6aa26 QVariant to QJsonValue::Null conversion
Adds a few missing parts of the conversion from QVariant to QJsonValue
after the introduction of the nullptr QVariant. The conversion the other
way is already implemented.

Change-Id: I8b25dec4b476c4761c5098a60944ff11c36f8bec
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-11-08 09:50:32 +00:00
Eskil Abrahamsen Blomfeldt
95d1273548 Windows: Don't claim bitmap fonts support all standard sizes
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>
2016-11-07 08:32:37 +00:00
Liang Qi
a732576a66 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	config.tests/win/msvc_version.cpp
	configure.pri
	mkspecs/macx-ios-clang/features/default_post.prf
	mkspecs/macx-ios-clang/features/resolve_config.prf
	mkspecs/features/uikit/default_post.prf
	mkspecs/features/uikit/resolve_config.prf
	src/corelib/io/qsettings_mac.cpp
	src/corelib/json/qjsondocument.cpp
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/cocoa/qnswindowdelegate.h
	src/plugins/platforms/cocoa/qnswindowdelegate.mm
	src/plugins/platforms/ios/ios.pro
	src/plugins/platforms/ios/kernel.pro
	src/plugins/platforms/ios/qiosintegration.h
	src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
	tests/auto/gui/painting/qpainter/tst_qpainter.cpp
	tools/configure/environment.cpp

Change-Id: I654845e54e40f5951fb78aab349ca667e9f27843
2016-11-01 06:02:55 +01:00
Liang Qi
8e20daae9f Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/platforms/minimalegl/qminimaleglintegration.cpp

Change-Id: Ia6ab42a6daadbf8abc085c971545904d49ea4b56
2016-10-31 09:26:35 +01:00
André Somers
4c00246fea Fixed crash taking null central widget
When no central widget has been set, calling takeCentralWidget should
just return a null pointer instead of crashing.

[ChangeLog][QtWidgets][QMainWindow] Fixed crash using takeCentralWidget when
the central widget was not set.

Task-number: QTBUG-56628
Change-Id: I240ccf4caa41d2716a78851571fbfbf444a4922e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-10-28 14:11:42 +00:00
Liang Qi
af0d0b9c06 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/platforms/ios/ios.pro
	src/plugins/platforms/ios/kernel.pro
	src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.h
	src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
	src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileenginefactory.h
	src/plugins/platforms/ios/qiosintegration.h
	src/widgets/widgets/qcombobox.cpp
	tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
	tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp

Change-Id: Ibaee7cbbba99e7c4b1d8926e55932ffa6030ce45
2016-10-27 10:23:39 +02:00
Thiago Macieira
6ec86513dd Increase the resolution for QDeadlineTimer unit test
Apparently, the CI can run something over 1000x slower than on my
machine. We're getting over 100 ms delays in operations that shouldn't
have taken more than half a millisecond. The last report was of 136%
over budget, so I multiplied the resolution by 4.

Change-Id: I9093948278414644a416fffd1474406967b2a6ee
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2016-10-26 03:16:26 +00:00
Thiago Macieira
047e3f8f04 Autotest: fix silly mistake in assigning where a comparison was intended
The file descriptor has been closed and this test is checking if we get
EBADF.

Change-Id: I33dc971f005a4848bb8ffffd1478eaffd99aa2e9
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-10-25 22:55:46 +00:00
Gabriel de Dietrich
9c83d7f871 QCocoaMenuBar: Update even if no window is attached
Then we need to check if the current active (or focused)
window has any menubar associated. In case there isn't,
and the menubar has no window associated, then we should
update immediately.

The previous condition is still valid.

Change-Id: I4532ccc87354d91c76b53f5433dc3944b9e29584
Task-number: QTBUG-56275
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2016-10-24 21:14:02 +00:00
Erik Verbruggen
f6eb570c7d Darwin: normalize all watched paths to composed from
This will be done by all POSIX APIs for strings coming in that way, but
because other code (like NSWhateverViews) will most likely return
decomposed form, we make sure that those are in composed form too.

Task-number: QTBUG-55896
Change-Id: I065e11cee6b59706d4346ed20d4b59b9b95163b8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-10-24 15:10:42 +00:00
Jarek Kobus
cee4d0c0b7 Add a resetClean() method to the undo stack
With the current API it is not possible to reset the
index into -1. We have setClean() method, but
we are lacking setDirty(). This is needed
in case when the document has changed outside
of the editor and nothing has changed
in the undo stack history. In this case we
don't know the state of the file modified
externally so we need to mark that editor's
contents is different from the file contents
and undoing or redoing commands can't bring
the editor to the clean state.
This may also be useful to call it when
we created a new document and haven't saved
it yet or when the document was restored
from backup file.

Task-number: QTCREATORBUG-17048
Change-Id: I64e2052b3559299e0b6939831557a07a59a851b6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-24 13:03:40 +00:00
Liang Qi
28628a5d5e Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/platforms/eglfs/qeglfshooks.cpp

Change-Id: I483f0dbd876943b184803f0fe65a0c686ad75db2
2016-10-22 21:19:57 +02:00
Marc Mutz
e70e168abb Plug leaks in tst_QWizard
This completely over-engineered piece of code has a hierarchy of
Operation subclasses encapsulating but three actual operations
on a QWizard.

Because these operations and their containers were all allocated
on the heap, but never deleted, asan went crazy and reported over
50 leaks (not the record so far, but a (distant) second).

Since these collections are passed through addColumn/QFETCH, too,
it's nearly impossible to track their lifetimes. So instead of
trying, delegate that to the runtime, ie. pack the Operation
objects into QSharedPointer and pass around those instead.

Change-Id: I8a0fe7a60cd30aed618667affaa030e80cf2b1ac
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
2016-10-22 10:20:22 +00:00
Marc Mutz
0e888ae1a1 tst_QGraphicsItem: plug remaining leaks
Store QGraphicsItems that are either not added to a scene or
removed from it again and that are also not children of other
items - iow: those that were leaked, even on successful runs
of the tests, in either a QScopedPointer, or, where that'd
cause too much churn due to adding of .data() calls, back the
pointer by a stack-allocated object.

This fixes the remaining leaks reported by GCC 6.2.1's ASan on
successful runs of tests/auto/widgets/graphicsview/qgraphicsitem.

Change-Id: I61c3a1cd39b9e96e83c5d7b8cf392e0b26ecbaf0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
2016-10-22 10:20:14 +00:00
Marc Mutz
080daae7cd Plug new leaks in tst_QFormLayout
The new takeRow() functions return a pair of pointers to
QLayoutItems and, as the name particle 'take' suggests,
releases ownership of these layout items. Which in turn
means that the caller of the function is supposed to deal
with them.

This was not done here.

To fix, write a RAII class that takes ownership of the
returned layout items, deleting them when it goes out of
scope or gets a new value assigned (only move special
member functions are implemented, making the class move
-only).

Deleting the QLayoutItems is not so easy, though:
QFormLayout has a special function for clearing the
QLayoutItems out, so it appears that just calling their
destructors is not going to fly (though I don't know off
the top of the head why that should be a problem).

Solve this, for now, by adding the layout items back into
a temporary QFormLayout for destruction.

Change-Id: If862989207b20f1e3f757c19ec9d498c4491184f
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-21 21:49:21 +00:00
Marc Mutz
686c44a69b Plug remaining leaks in tests/auto/widgets/kernel
The usual:

- delete return values of QLayout::takeAt(), replaceWidget()
- delete styles
- delete top-level widgets
- delete actions

Either by naked delete, QScopedPointer or allocation on the
stack instead of the heap.

This fixes the remaining errors in GCC 6.1 Linux ASan runs of
tests/auto/widgets/kernel.

Change-Id: I8cc217be114b2e0edf34ad8d60dbf722f900bb7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-21 21:48:26 +00:00
Timur Pocheptsov
512934f7e7 HTTP/2 - fix the handling of PUSH_PROMISE
HTTP/2 allows a server to pre-emptively send (or "push") responses (along
with corresponding "promised" requests) to a client in association with a
previous client-initiated request. This can be useful when the server
knows the client will need to have those responses available in order
to fully process the response to the original request.

Server push is semantically equivalent to a server responding to a request;
however, in this case, that request is also sent by the server, as a
PUSH_PROMISE frame.

The PUSH_PROMISE frame includes a header block that contains a complete set
of request header fields that the server attributes to the request.

After sending the PUSH_PROMISE frame, the server can begin delivering the
pushed response as a response on a server-initiated stream that uses the
promised stream identifier.

This patch:
- fixes the HPACK decompression of PUSH_PROMISE frames;
- allows a user to enable PUSH_PROMISE;
- processes and caches pushed data for promised streams;
- updates auto-test - emulates a simple PUSH_PROMISE
  scenario.

Change-Id: Ic4850863a5e3895320baac3871a723fc091b4aca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-10-21 14:27:06 +00:00
Erik Verbruggen
49d3bb0058 Normalize realpath(3) output to composed form
All strings coming out of POSIX API calls are converted to composed form
by QFile::decodeName. Do the same for realpath(3) output. This is
especially important for HFS+, which will store file names in decomposed
form, and APIs will therefore return strings in decomposed form.

Task-number: QTBUG-55896
Change-Id: I5e51f4e5712ff26bf9644cbcf9a9603995748892
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-10-21 07:49:00 +00:00
Kai Koehne
557abfc327 QUrl effective TLDs: update table
There are more than 1000 new entries since the table has been
generated the last time. The autotest needs to be tweaked
because the rules for the .mz domains have changed; use the
.ck domain instead.

Change-Id: Ife692afd46ac41a66604e966e5e8cb57c7aa649c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-21 06:29:53 +00:00
Tor Arne Vestbø
837781db52 Add Qt::ISODateWithMs date format, with support in QTime/Date/DateTime
The Qt::ISODate format strips milliseconds, so a new format is introduced
that keeps the milliseconds. A new format was chosen over fixing the
existing format due to the behavioral change of suddenly having ms
as part of Qt::ISODate.

Change-Id: If8b852daed068cce8eee9b61a7cd4576bc763443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-20 15:15:40 +00:00
Sérgio Martins
6cfdfad7d4 Don't crash while parsing malformed CSS
Task-Id: QTBUG-53919
Change-Id: I31a0e218e4e41ee217f8f87164f115450d69d42c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-10-19 15:38:56 +00:00
Clinton Stimpson
ee22c6505a xcb: fix passing of focus from child to its top level QWindow
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>
2016-10-19 15:24:22 +00:00
Marc Mutz
e80faf3db6 QTimer: don't circumvent <chrono> safety net
By templating on the <chrono> types and unconditionally using
duration_cast to coerce the duration into a milliseconds, we
violate a principal design rule of <chrono>, namely that non-
narrowing conversions are implicit, but narrowing conversions
need duration_cast. By accepting any duration, we allow non-
sensical code such as

   QTimer::singleShot(10us, ...)

to compile, which is misleading, since it's actually a zero-
timeout timer.

Overloading a non-template with a template also has adverse
effects: it breaks qOverload().

Fix by replacing the function templates with functions that
just take std::chrono::milliseconds. This way, benign code
such as

    QTimer::singleShot(10s, ...)
    QTimer::singleShot(10min, ...)
    QTimer::singleShot(1h, ...)

work as expected, but attempts to use sub-millisecond
resolution fails to compile / needs an explicit user-
provided duration_cast.

To allow future extension to more precise timers, forcibly
inline the functions, so they don't partake in the ABI of the
class and we can later support sub-millisecond resolution by
simply taking micro- or nano- instead of milliseconds.

Change-Id: I12c9a98bdabefcd8ec18a9eb09f87ad908d889de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-18 16:06:28 +00:00
Tor Arne Vestbø
4cb614c7ab Apple OS: Handle QSetting strings with embedded zero-bytes
Saving strings with embedded zero-bytes (\0) as CFStrings would
sometimes fail, and only write the part of the string leading
up to the first zero-byte, instead of all the way to the final
zero-terminator. This bug was revealed by the code-path that
falls back to storing e.g. QTime as strings, via the helper
method QSettingsPrivate::variantToString().

We now use the same approach as on platforms such as Windows
and WinRT, where the string produced by variantToString() is
checked for null-bytes, and if so, stored using a binary
representation instead of as a string. For our case that
means we fall back to CFData when detecting the null-byte.

To separate strings from regular byte arrays, new logic has
been added to variantToString() that wraps the null-byte
strings in @String(). That way we can implement a fast-path
when converting back from CFData, that doesn't go via the
slow and lossy conversion via UTF8, and the resulting QVariant
will be of type QVariant::ByteArray. The reason for using
UTF-8 as the binary representation of the string is that
in the case of storing a QByteArray("@foo") we need to
still be able to convert it back to the same byte array,
which doesn't work if the on-disk format is UTF-16.

Task-number: QTBUG-56124
Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8
Cherry-picked: 764f5bf48c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-18 14:35:08 +00:00
Liang Qi
d90b155c60 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	mkspecs/macx-ios-clang/features/resolve_config.prf
	src/testlib/qtestcase.qdoc

Change-Id: Icefa63056ffb37106f35299a8f19165535571799
2016-10-17 11:02:54 +02:00
J-P Nurmi
063997f44f QMenu: don't force platform instance creation on construction
There's a conflict between QGtk3Menu and QDbusPlatformMenuBar. The
problem is that on Unity the type of the platform menu instance must
be different depending on whether the menu is in the global menubar or
a standalone context menu.

Since QMenu creates a platform menu instance at construction time, it
does not yet know whether it will be added into a menubar. QMenuBar
checks that the QMenu already has a platform menu instance, and passes
it to the platform menubar. As a result, a QGtk3Menu instance is passed
to QDbusPlatformMenuBar.

Currently, a standalone QMenu does not use the native platform menu
instance. Only menus that are added to a QMenuBar do. Therefore we
don't need to create the platform instance when QMenu is constructed,
but only after it is added to QMenuBar. The platform menu instance
creation is implemented in QMenuBarPrivate::getPlatformMenu(), and
QMenu::setPlatformMenu() calls syncPlatformMenu() to take care of
syncing the QMenu properties and actions to the new platform menu
instance.

The macOS-specific methods QMenu::toNSMenu() and QMenu::setAsDockMenu()
rely on the platform menu instance, and must therefore create it on
demand.

This is a hot fix for the release blocker, not a long term solution.
In the future, if standalone QMenus are made to use native platform
menu instances, the instance must be created lazily when the menu is
about to be made visible.

Task-number: QTBUG-56526
Change-Id: I044933cabb1639406fe47908dfc4b1903af214d1
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-16 14:10:29 +00:00
Allan Sandfeld Jensen
90fe2c64f5 Make self-contained test of condensed font matching and width
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>
2016-10-16 00:11:13 +00:00
Oswald Buddenhagen
135fcd5992 port to modularized platformsupport libraries
Change-Id: I20eb0e33abfd70b6a5240e7b6b0aa0425f2d2ee7
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-15 18:45:41 +00:00
Oswald Buddenhagen
ea913750b8 create modularized version of qtplatformsupport module
lumping together all kinds of unrelated stuff has caused problems with
spurious dependencies from the beginning. as the modularization infra is
now in a state which supports many small private libraries just fine,
take advantage of it.

Change-Id: Ic40f47ce76a308bbfd32deae281f6f064fe1ef4c
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-15 18:45:33 +00:00
Tor Arne Vestbø
6a35e77ef3 Change confusing Q_DEAD_CODE_FROM_QT4_FOO define
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>
2016-10-14 08:19:29 +00:00
Alexandru Croitor
cd1d114140 Unset qgl_current_fbo when the default FBO is bound
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>
2016-10-13 15:38:08 +00:00
Liang Qi
6370c3aa71 Merge remote-tracking branch 'origin/5.6' into 5.7
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
2016-10-13 15:18:02 +02:00