Commit Graph

7095 Commits

Author SHA1 Message Date
Tor Arne Vestbø
ef43195617 Fix build issues in windowchildgeometry manual test
Change-Id: Ia4cfe88dc30adbff0f00b5f8b846c78958a692d7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2016-10-27 00:19:00 +00:00
Tor Arne Vestbø
7437ede145 macOS: Don't build auto-tests as application bundles unless explicitly requested
Consistent with other Unix platforms, and internally consistent between tests,
as a lot of tests were already applying CONFIG -= app_bundle manually.

Change-Id: Icd2b7e1c08015b26137af60ff82fddbc753f0ff4
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-23 10:39:56 +00:00
Tor Arne Vestbø
be911de259 Remove tests/auto/test.pl
The 'modern' way to run tests is via make check

Change-Id: Idbafa491a1c2e3ba4d9a5ba2bde2350fa0eaf422
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2016-10-20 15:07:38 +00:00
Eskil Abrahamsen Blomfeldt
ae6681673e Add QTextDocument::toRawText() function
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>
2016-10-17 07:29:10 +00:00
Giuseppe D'Angelo
9944a12a0f QMenuBar: do not gain focus when releasing Alt before X in a Alt+X shortcut
It might happen that, when pressing Alt+X to trigger a shortcut for an
action in a menubar, that the user releases Alt first, followed by X. When
that happens, QMenuBar gains focus as if the user just pressed and
released Alt (to focus the menu bar). That's counterintuitive, frustating
and not what native Windows seems to do.

Fix this by resetting the "altPressed" state whenever a shortcut gets
triggered with the Alt key pressed.

(In the above discussion, X stands for any key).

Task-number: QTBUG-46812
Change-Id: If4b7a47842791894a3a32d09db5de229ed33773e
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2016-10-15 16:25:57 +00:00
Liang Qi
dfc177e3a9 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	qmake/library/qmakeevaluator.cpp
	(cherry picked from commit 1af6dc2c8fb4d91400fddc5050166f972ae57c9a in qttools)
	src/corelib/kernel/qcore_mac_objc.mm
	src/gui/painting/qcolor.h
	src/plugins/platforms/cocoa/qcocoawindow.mm

Change-Id: I5b3ec468a5a9a73911b528d3d24ff8e19f339f31
2016-10-13 09:49:38 +02:00
Liang Qi
e166d7d135 Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8 2016-10-11 14:14:31 +00:00
Jan Arve Saether
7a30dda40b Revert "Combine device and point id into 32 bit point id"
The patch is good, but currently breaks touchmouse test in qtdeclarative.
We need to fix the touchmouse test first, then go ahead and reapply this
patch once qtdeclarative is fixed.

This reverts commit cd26e66c2e.

Change-Id: I222e6240f5ff0eff9c8a3544819499847f6b48fa
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2016-10-11 08:05:52 +00:00
Allan Sandfeld Jensen
5d691922d8 Fix crash in QPainter benchmark test
Adds missing image-formats so it doesn't segfault.

Also changes the exclusion of rare formats to lists of included ones

Change-Id: I1d00562cf8e96baa03121a0b996764224911e06a
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2016-10-11 07:38:43 +00:00
Liang Qi
905329200f Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	src/gui/image/qpixmap.cpp
	src/widgets/kernel/qformlayout.cpp

Change-Id: I8a8391a202adf7f18464a22ddf0a6c4974eab692
2016-10-11 07:40:32 +02:00
Tor Arne Vestbø
76f53791a1 tst_QSettings: Don't assume the presence of a key means isWritable
The previous sync() of the specific scope and domain may have failed due
to not having the necessary permissions, but the saved value may still be
cached, so we need to check both.

This was observed on macOS Sierra, where a failed sync() will result in
marking the CFPrefsPlistSource as read-only, eg:

  2016-10-04 13:14:11.713271 tst_qsettings[88537:767733] [User Defaults] attempt to set
  <private> for key in <private> in read-only (due to a previous failed write) preferences
  domain CFPrefsPlistSource<0x6180000e1780> (Domain: org.software.KillerAPP,
  User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null))

Change-Id: I8976c1c4acfe2cb0d5510298d5c585faca9607f6
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2016-10-10 16:06:43 +00:00
Tor Arne Vestbø
f90d6445a0 tst_QSettings: Fix tests on sandboxed platforms such as iOS
WinRT is not the only sandboxed platform. Since it doesn't hurt to keep
the test data in a well known location, we enable the code for all
platforms. We also make sure to mkpath the location, since writableLocation
doesn't guarantee that the location exists.

Change-Id: Ie8d90c5fbdf3b7fbf85ba6be25372b0ef7c4da55
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2016-10-10 16:06:42 +00:00
Liang Qi
3e71810cf3 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/network/access/qhttpnetworkconnection.cpp
	src/network/access/qhttpnetworkconnection_p.h

Change-Id: I11f8641ef482efa8cee1b79977d19cc3182814b4
2016-10-08 17:15:55 +02:00
Frank Reininghaus
5cc0d92c24 QAbstractItemView: use only a 1x1 QRect for selecting on mouse press
Before commit f1e9076809, mousePressEvent
called the virtual method setSelection(const QRect&, SelectionFlags)
with the 1x1 rectangle which contains only the clicked QPoint, unless
the SelectionFlag "Current" was set because Shift was pressed during
the mouse press.

Since that commit, the behavior has been changed such that the
rectangle is the one that is spanned by the center of the clicked item
and the clicked pixel. In theory, the result should be the same (i.e.,
only the clicked item should be selected), but

* the code path in QListView::setSelection for 1x1 QRects is more
  efficient, and
* using a larger QRect can cause problems with custom views, see the
  comments in QTBUG-18009

This commit ensures that the 1x1 QRect is used again, unless the
SelectionFlag "Current" is used.

Change-Id: I70dd70c083c20a3af6cd6095aa89a489756b505f
Task-number: QTBUG-18009
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2016-10-07 10:38:58 +00:00
Jan Arve Saether
cd26e66c2e Combine device and point id into 32 bit point id
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)

Change-Id: I8b9ab0d44224b15175b820d33cbb2d8bd21e99f2
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2016-10-07 04:44:41 +00:00
Liang Qi
ef25620ac1 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/features/mac/default_pre.prf
	mkspecs/features/qpa/genericunixfontdatabase.prf
	mkspecs/features/uikit/default_post.prf
	mkspecs/features/uikit/resolve_config.prf
	mkspecs/macx-ios-clang/features/default_post.prf
	mkspecs/macx-ios-clang/features/resolve_config.prf
	src/corelib/io/qiodevice.cpp

Change-Id: I6f210f71f177a3c3278a4f380542195e14e4b491
2016-10-06 20:12:27 +02:00
Marc Mutz
f9acbaccde QPixmap::load: ensure QBitmap stays a QBitmap even on failure
... 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>
2016-10-06 16:39:13 +00:00
Tor Arne Vestbø
1b567854e4 Use extreme values in QMetaType/QSettings test data
By using _MIN for signed values, and _MAX for unsigned values, we may
detect conversion issues when serializing QVariants using QSettings.

Change-Id: I3ce58ba4b93f791f75c7ae44d1fd5030f07b2f25
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-05 20:31:23 +00:00
Tor Arne Vestbø
89842b97d7 Implement QMacCocoaViewContainer in terms of foreign window
This leaves a clearer separation between the foreign-window and non-foreign
window use-cases, where a single QCococaWindow can only be in one mode,
which is determined in the constructor and doesn't change after that.

There are no source or binary compatibility guarantees for the QPA classes,
meaning the helper function in QPlatformNativeInterface can be removed.

Change-Id: I3232aedca1d98c49a8f54e16750832187f9dc69a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-10-05 19:37:17 +00:00
Tor Arne Vestbø
fd7e00aff5 Don't truncate QDateTime milliseconds when storing QSettings on Apple platforms
The fix is trivial, but the patch adds a new QSettings tests that iterates most
of the QMetaTypes and verifies that storing and retrieving them again gives the
same value. This is a more complete test than the testVariantTypes tests, which
is limited to a subset of the QVariant types. The new tests borrows logic from
the QMetaType test machinery.

QSettings has been Q_ENUM'ified in the process, for improved debug output.

Note that on backends such as the INI backend, the metatype of the QVariant read
from the settings will be a string, so it won't match the input QVariant type,
but the result of converting that to the original value type should still work.

Task-number: QTBUG-56124
Change-Id: Ib03a26abf77c9fb449b94160d28bc4baeb095f25
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-05 18:45:04 +00:00
Marc Mutz
dc737fa0d7 tst_QShortcut: Fix UB (invalid cast) in shortcutDestroyed()
The slot is invoked from QObject::destroyed(), which is emitted
from ~QObject. By that time the object is no longer a QShortcut,
so the static_cast it invalid.

Found by UBSan:

  tst_qshortcut.cpp:1210:53: runtime error: downcast of address 0x6020000289d0 which does not point to an object of type 'QShortcut'
  0x6020000289d0: note: object is of type 'QObject'
   10 00 80 17  c0 ce 63 df 93 2b 00 00  b0 02 00 00 d0 60 00 00  02 00 00 00 ff ff ff 04  04 00 00 00
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QObject'
    #0 0x42b3bb in tst_QShortcut::shortcutDestroyed(QObject*) tst_qshortcut.cpp:1210
    #1 0x446cc9 in tst_QShortcut::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) .moc/tst_qshortcut.moc:186
    #2 0x2b93dba52c86 in QMetaObject::activate(QObject*, int, int, void**) qobject.cpp:3787
    #3 0x2b93dba55400 in QObject::destroyed(QObject*) .moc/moc_qobject.cpp:213
    #4 0x2b93dba8d80d in QObject::~QObject() qobject.cpp:967
    #5 0x2b93c6b6e032 in QShortcut::~QShortcut() qshortcut.cpp:476
    #6 0x2b93c6b6e370 in QShortcut::~QShortcut() qshortcut.cpp:481
    #7 0x42a5de in void qDeleteAll<QList<QShortcut*>::const_iterator>(QList<QShortcut*>::const_iterator, QList<QShortcut*>::const_iterator) qalgorithms.h:317
    #8 0x42a5de in void qDeleteAll<QList<QShortcut*> >(QList<QShortcut*> const&) qalgorithms.h:325
    #9 0x42a5de in tst_QShortcut::clearAllShortcuts() tst_qshortcut.cpp:1136

Fix by replacing QVector::replaceAll() with the erase-remove idiom,
which does not require the cast, because it can perform mixed-type
lookups.

Change-Id: I4251c1895fa4398023f489dbfd7108d90c1a6c94
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-10-05 17:47:09 +00:00
Marc Mutz
59414b7c58 Plug memleak in tst_QStackedWidget
To keep the change minimal, keep 'sw' as a pointer variable,
but back it by a stack-allocated QStackedWidget instead of a
heap-allocated one that's never deleted.

Change-Id: I9e2a8c07979b861eb7e7040c144d8e75c90d0bc9
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-10-05 17:45:49 +00:00
Liang Qi
6feec9da93 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I34b5e290233d0869fbafac094a939aec2bf83fd5
2016-10-05 19:33:26 +02:00
Frederik Schwarzer
c3605980d9 Fix some typos and minor sentence structure issues in docs
Change-Id: Ibede1aeb046e2df6723e3041152bfae22a9fde32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-05 15:00:24 +00:00
Tor Arne Vestbø
764f5bf48c 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
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-05 11:57:41 +00:00
Tor Arne Vestbø
6c8f32388b tst_QSettings: Detect if Apple platforms support writing to SystemScope
A fair amount of tests are skipped if we can't write to the system scope,
eg on iOS. Without this detection they will fail.

Change-Id: I8257f1f24e69dae88925c20d2bff851e81701405
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-04 21:21:20 +00:00
Oswald Buddenhagen
0fcd842cec remove unnecessary references to $$QMAKE_CFLAGS_DBUS
it does not appear that the tests actually use these flags in any way;
they don't include any (actual) d-bus headers and have no ifdefs.

and the qdbus module already pulls in the flags via QMAKE_USE (in the
case where they are defined at all, i.e., dbus-linked).

Change-Id: Ie6bc6da7d1dd96da7b73f2d0fe45576936715874
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-04 20:21:28 +00:00
Eskil Abrahamsen Blomfeldt
4d552815cf Fix plain text QStaticText with line breaks
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>
2016-10-04 14:30:13 +00:00
Oswald Buddenhagen
4a561c6baf remove redundant conditionals regarding ssl
this actually fixes the build when ssl is not enabled, as the openssl
features are in the not included network-private module.

Change-Id: Ibafae9867af493da184a45cf3981628d475d37a6
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-04 08:25:24 +00:00
Tor Arne Vestbø
e8c8c9fea7 Exclude tst_QSettings::rainersSyncBugOnMac() on all Apple OSes
It fails on iOS as well, and likely also tvOS and watchOS.

Change-Id: Idfce98a5aeccb5680f6b4c6e66b526dd7922156d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-03 21:40:33 +00:00
Marc Mutz
3b5107a118 Speed up compilation of tst_qgraphicsview_2.cpp
Turn the list of newRow() calls into a for loop over a constexpr
data structure.

Fixes the GCC note:

   tst_qgraphicsview_2.cpp:47:13: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without

and speeds up compilation of the file from 13s to 2.5s on my
machine.

Task-number: QTBUG-38890
Change-Id: I4f0b3565c7df64b286d1d32eb3f3d6bf4df92609
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-10-03 14:59:56 +00:00
Milla Pohjanheimo
b8a469af64 BIC data files for QtBase for Qt 5.7
Added the binary compatibility test data files for Qt 5.7 for QtBase

Change-Id: I5b19571f5e266c52622027d820062afa5fd4fbf3
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2016-10-03 09:38:59 +00:00
Tor Arne Vestbø
be7f671ac9 Round to nearest millisecond in QDateTime::fromCFDate()
CFAbsoluteTime is measured in seconds, represented by a double,
so when converting milliseconds to CFAbsoluteTime we may get a
slight error due to missing precision in double to represent
the milliseconds exactly. By rounding to the closest millisecond
when converting back, we avoid truncating and being one ms off.

Change-Id: If1e99f97b000fb8cb893ddfc5d7ba81096c0ea88
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-02 13:07:18 +00:00
Marc Mutz
ad1555be7f Plug remaining leaks in tests/auto/widgets/util
In tst_QCompleter, two completers were leaked because they
had no parent and setCompleter() calls don't reparent.

Fixed by giving them parents.

In tst_QUndo*, fix lots of leaked QActions by storing them
in a QScopedPointer. There were some half-hearted attempts
to clean them up with manual deletes, but I ported these to
scoped pointers, too, to make the code more robust in the
face of failures.

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

Change-Id: Icc5248cc9cf4514540915924df1c4d9e09c071fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-10-02 11:28:23 +00:00
Liang Qi
3e949b75fd Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	mkspecs/features/mac/default_pre.prf
	mkspecs/macx-ios-clang/features/resolve_config.prf
	qtbase.pro

Change-Id: I65b5ebca4942a4f295bdd4ac1568e5c347333aea
2016-10-01 22:15:55 +02:00
Milla Pohjanheimo
be13081dd4 Data files for binary compatibility tests updated for Qt 5.6
The generated data files for the binary compatibility test
updated for QtBase.

Change-Id: Idae703c83f55ff17cada4419db742ea12b22bf86
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2016-09-30 10:55:59 +00:00
Marc Mutz
7d47c97360 Plug remaining leaks in tests/auto/widgets/style
The usual:

- delete styles

Either by using QScopedPointer.

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

Change-Id: Ifba59085c057d474bf964cbb93010c408d773a61
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-30 10:45:34 +00:00
Marc Mutz
e0e4269e28 tst_QAbstractSlider: fix strict-aliasing warnings
GCC warned:

  tst_qabstractslider.cpp:858:89: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     Qt::Orientation orientation = *reinterpret_cast<Qt::Orientation*>(&sliderOrientation);
                                                                                         ^
  tst_qabstractslider.cpp:867:72: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     orientation = *reinterpret_cast<Qt::Orientation*>(&wheelOrientation);
                                                                        ^

The solution, of course, would be to use a static_cast here, but
why go via int in the first place? Qt::Orientation can perfectly
well be used in QFETCH, as proven by tst_qmainwindow, among other
things.

Change-Id: I97916a50405e16d114837bc52580ce6666d74b17
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-30 10:09:58 +00:00
J-P Nurmi
897ef8f200 Fix tst_QFiledialog::widgetlessNativeDialog()
Restore Qt::AA_DontUseNativeDialogs that is disabled in the beginning
of the test function.

Change-Id: I4ff8eab4ecc458c478337824e66b5a59fbdd7c65
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-09-30 08:33:39 +00:00
Jake Petroules
28f5d79316 Share the multi-arch infrastructure between UIKit and macOS
There's no reason for this to be separated, regardless of the
support status of i386 macOS builds. Additional architectures may
appear in the future (and currently there's actually 3 - i386,
x86_64, and x86_64h for Haswell CPUs). So this feature could be
used to get combined generic x86_64 and Haswell builds. Some
system libraries appear to have an x86_64h slice in Sierra.

[ChangeLog][Build System] Support for universal binaries on macOS
has been re-introduced.

Change-Id: I1c89904addf024431fdb3ad03ea8ab85da7240ad
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-09-29 21:51:18 +00:00
Marc Mutz
c35eff2ace Add qtest_network.h
... and move toString() implementations there which were repeated in
network tests, or #ifdef'ed in qtest.h.

Since the functions moved from network tests are now in a public header,
had to massage them a bit to pass headersclean:

- replace Q_FOREACH with C++11 range-for
- avoid implicit conversion from QByteArray -> const char* (done by
  re-using toString(QByteArray) instead of calling strdup() manually)

Also made the functions overloads instead of specializations. This
allows to pass the enum by value instead of by const-&.

Like the existing QHostAddress, the newly-added toString() overloads are
marked as \internal. We can decide later whether to turn them into
public API.

Change-Id: I8c23db7a0a6575273567017d42d7b2a957acece8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-09-29 21:46:19 +00:00
Eskil Abrahamsen Blomfeldt
462f6029ed Fix crash when doing many text layouts with superscript/subscript
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>
2016-09-29 12:43:19 +00:00
Liang Qi
e66d181e65 Merge remote-tracking branch 'origin/5.8' into dev
Change-Id: I3b51bb706e401edfda09a433c67aa58e44f33e83
2016-09-29 12:58:41 +02:00
Liang Qi
cdb56c42fc Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/features/uikit/xcodebuild.mk
	tests/auto/other/lancelot/tst_lancelot.cpp
	tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
	tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp

Change-Id: Ia0ae2de86094120281abd445138877c2cc3e882c
2016-09-29 00:38:01 +02:00
BogDan Vatra
87583738f9 moc: support nested q_namespaces
Nested namespaces are quite common, therefore moc should support them.

Task-number: QTBUG-55415
Change-Id: I756cab36d498eb4342b402d255836d5d30f07b30
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-28 16:44:19 +00:00
Liang Qi
e918334045 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/widgets/dialogs/qcolordialog.cpp
	src/widgets/dialogs/qfiledialog.cpp
	tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp

Change-Id: I34bc8a990f8f526889a95a5c7099ef557b9681ad
2016-09-28 11:51:35 +02:00
Marc Mutz
da2c73ad2b Plug memleaks in tst_QWidget
We need to delete the style returned from QStyleFactory::create()
ourselves, so put them into a QScopedPointer.

The alternative would have been to create this once, as a member
of tst_QWidget, but this is the minimal approach that ensures
behavior just as the old code, but without the leak.

Change-Id: I527f1031c57be6f05942f4acc057e7dae1af2571
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-28 04:56:48 +00:00
Marc Mutz
5571d2bf62 tst_QApplication: Fix UBs (invalid cast) in focusMouseClick()
Found by UBSan:

  tst_qapplication.cpp:1754:48: runtime error: member access within address 0x7ffda11f2220 which does not point to an object of type 'SpontaneousEvent'
  0x7ffda11f2220: note: object is of type 'QMouseEvent'

The code attempted to model the layout of a QEvent with another class
that allows public access to the memory location that (hopefully)
corresponds to QEvent::spont, gaining access by casting a QEvent
object to that specifically-crafted class.

Fix by the using the existing QSpontaneKeyEvent::setSpontaneous()
call, which, despite its name, works for all QEvent subclasses, and
which has already been fixed to not invoke UB (in bc087db).

Change-Id: I7db8b8a8a823f7d61ab17375142d19dc3874fea5
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-28 04:56:34 +00:00
Palo Kisa
4758555f3e QSettings: Add proper support for XDG_CONFIG_DIRS
Update fallback mechanism for Q_XDG_PLATFORM based systems to follow the
Xdg specification.

[ChangeLog][QtCore][QSettings] Added proper support for system-wide
configuration file lookup based on Xdg spec (XDG_CONFIG_DIRS) on Unix
based systems

Task-number: QTBUG-34919
Change-Id: Ieddee1c0b3b1506bf19aa865bdab87fc81d58cfd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-27 22:03:11 +00:00
Allan Sandfeld Jensen
bf76405afc Extend tested formats in lancelot
Adds two formats that does not have optimized code-paths in qdrawhelper
to ensure the generic path has coverage.

This has already uncovered one bug fixed before this patch could go in.

Change-Id: I0e0a1a873555b27f6438f69a76982b8e06263dcf
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-09-27 17:26:03 +00:00