Commit Graph

4632 Commits

Author SHA1 Message Date
John Layt
9e29fab38d QPdfWriter - Use QPageSize and QPageLayout
Add support to QPdfWriter for QPageSize, QPageLayout, and resolution.

[ChangeLog][QtGui][QPdfWriter] The QPdfWriter now supports setting
the PDF orientation, layout and resolution by using QPageSize and
QPageLayout.

Change-Id: I9c269f997ec540dac1989f355c6a2e7488947966
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-03-17 13:45:52 +01:00
John Layt
b0428926ce QPrinterInfo - Switch to QPlatformPrintDevice
Change the QPrinterInfo implementation to use QPlatformPrintDevice as
the backend.  Remove all the old QPrinterInfo related code from the
QPA plugin.  Add public api to QPrinterInfo to support some features
from QPlatformPrintDevice.

[ChangeLog][QtPrintSupport][QPrinterInfo] Added new public api for
isRemote(), state(), defaultPageSize(), supportedPageSizes(),
supportsCustomPageSizes(), minimumPhysicalPageSize(),
maximumPhysicalPageSize(), supportedResolutions(),
availablePrinterNames(), and defaultPrinterName(). The use of
availablePrinters() is discouraged due to performance concerns.

Task-number: QTBUG-35248

Change-Id: Ic38323a930549ad67bf04a1a6bb43d623dfe6a33
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-03-17 13:45:44 +01:00
John Layt
f50d46e5eb QPlatformPrintDevice - New QPA base class
Add a new QPA class to abstract Print Devices.  Each platform instance
will encapsulate all required details about a print device instead of
the code being distributed throughout the print engine and print
plugin.

Change-Id: I7f6a537ad55a6e7f599d83f461b1e2ee62b15094
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-03-17 13:45:31 +01:00
John Layt
5eeed00f4d QPageLayout - Add new QPageLayout class
New QPageLayout to encapsulate page layout details including page size,
orientation and margins.  Scale may be added later.

Subsequent changes will use this class in the paged paint devices,
paint engines, print engines, and print plugins to replace multiple
inconsistent local implementations.

[ChangeLog][QtGui] Added class QPageLayout to support handling page
layouts including the page size, orientation and margins.

Change-Id: Ife1ddd6c2a8d1516542be2eb37425111f41cd5c7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
2014-03-17 13:45:27 +01:00
John Layt
87d802465b QPageSize - Add new QPageSize class
New QPageSize class to encapsulate paper sizes and names to ensure all
sizes and conversions are consistent and match the Postscript standard
sizes.

Subsequent changes will use this class in the paged paint devices,
paint engines, print engines, and print plugins to replace multiple
inconsistent local implementations.

[ChangeLog][QtGui][QPageSize] Added new QPageSize class to implement
Adobe Postscript PPD standard page sizes. This class supports the
standard page sizes, names and keys from the PPD standard, and provides
convenient size and rect conversion methods.

Change-Id: Ie2c8be0c3df0d29ac5da4cd9877ad41d0982633c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-03-17 13:45:19 +01:00
John Layt
ad0163d088 QPrinter - Add page metric tests
Add more page metrics tests to expose the many bugs and inconsistencies
in the page layout handling.  No platform or pdf backend passes all
these tests so they are skipped for now, but following commits will use
the tests to ensure the re-write of the page layout handling fixes the
many problems in a consistent way for all backends.

Change-Id: Ic5b16aa08dfe2bd9a9191662fd2bbe6b913e15c9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
2014-03-17 13:45:14 +01:00
Jędrzej Nowacki
ac178eae4e Fix Q_DECLARE_METATYPE macro
The macro should stringify value of the given token not the token
itself.

Task-number: QTBUG-37547
Change-Id: I90f4fa613bd13d5a581828ab13f620b40dfd3593
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-03-17 13:05:07 +01:00
Frederik Gladhorn
a2850e54d5 Merge remote-tracking branch 'origin/release' into stable
Conflicts:
	src/gui/painting/qdrawhelper.cpp
	src/gui/painting/qdrawhelper_avx.cpp
	src/gui/painting/qdrawhelper_x86_p.h

Change-Id: I09352d05119f6fd000319074a2705b38361b2c90
2014-03-17 12:29:11 +01:00
Friedemann Kleint
037bc9b638 Add verbose messages to tst_qnetworkreply.
Task-number: QTBUG-37449

Change-Id: Ib3802ddd51b908a68d8c893ce49010aeeb117db8
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
2014-03-15 10:45:17 +01:00
J-P Nurmi
49b14f7a8b Remove the _qt_filedialog_xxx hooks
These internal and obsolete hooks are no longer used. The correct way
to provide platform dialogs in Qt 5.x is to implement a platform theme
plugin, as was done for GTK+ 2.x.

Change-Id: I3f1474fbf760130106b3c47173eaedd2f1a919bf
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2014-03-15 10:44:47 +01:00
Andrew Knight
42afaa992a d3dcompiler_qt: Remove control file semantics
This simplifies the compiler control semantics by always using the
packaged compiler if it is available. With no packaged compiler, the
service is assumed to be running if the directory structure is present.
Use of a packaged library can be overridden by setting the environment
variable QT_D3DCOMPILER_DISABLE_DLL to 1.

When the runtime compiler is used, the source will no longer be
logged, and the compilation output will no longer be cached.

Change-Id: Ib07f517e7043d7785bdfa9da55abd34df518eeed
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
2014-03-14 22:40:24 +01:00
Janne Anttila
391c2c12ab Introduce GENERATED_TESTDATA variable and fix qresourceengine test.
testcase.prf cannot be loaded from pro file for various reasons,
see qtbase commit history for details.

Moved runtime testdata logic from pro file to testdata.prf, and
thus made is reusable in other test cases as well.

Change-Id: I500d08dc4951e4eda862071e4ddd3e0f6de8c3d2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-03-14 22:39:58 +01:00
Friedemann Kleint
f83ce63fe3 Add GL information to qpainfo.
Task-number: QTBUG-31611
Change-Id: Ibf9bcb74ed8dbf8625e77ef0870d758a77ea65cb
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-03-14 22:39:27 +01:00
Friedemann Kleint
08f0dbd13c Fix spurious XPASS in tst_QGraphicsAnchorLayout.
Seen on Windows:

XPASS  : tst_QGraphicsAnchorLayout::stability() QCOMPARE(sameAsPreviousArrangement, true) returned TRUE unexpectedly.
tst_qgraphicsanchorlayout.cpp(1399) : failure location

Move check into loop with descriptive message on fail, do not error
out if it actually passes. This now typically prints:

XFAIL  : tst_QGraphicsAnchorLayout::stability() The layout has several solutions, but which solution it picks is not stable ( QRectF(30,0 0x10) != QRectF(30,0 10x10) , iteration 3 , item 4 )

Change-Id: Iae8553dbbcedeb70d5d672e3cefbd1f06a63d27d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
2014-03-14 22:39:19 +01:00
David Faure
c4650779c4 Fix tst_qthreadpool under high load.
The tasks might not have run yet at the time of the QCOMPARE, so we need
to acquire on the semaphore in order to ensure that this is the case,
just like in the previous testcase.

Change-Id: I1da72bb07c2f53760b3bf912fc26aaf10ed18d48
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-03-14 22:38:49 +01:00
Janne Anttila
4b8aee7ca0 Fix qchar testdata installation.
NormalizationTest.txt does not exist in the project root, but under 'data'
directory. TESTDATA is converted to INSTALLS rules in testcase.prf.
INSTALLS rules generated in testcase.prf does not set 'no_check_exist'
CONFIG variable. Thus qmake will not install NormalizationTest.txt since
it cannot find it from defined location.

Even TESTDATA has been incorrectly defined, NormalizationTest.txt
has been found in majority of the platforms thanks to QFINDTESTDATA
flexibility. However it causes problems on sand-boxed platforms such
as WinRT.

Fixed by defining the relative path to NormalizationTest.txt in TESTDATA
so that qmake can find the file when processing INSTALLS variable.

Change-Id: Id9a28db2a00b17d2c0136e6ff32f421b21137898
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Liang Qi <liang.qi@digia.com>
2014-03-14 18:19:00 +01:00
David Fries
e6cb06a835 correct send vs sent grammar
Correct the tense of send vs sent in comments and documentation.

Change-Id: I1c5ce9a7b1e49b8b0e8dcfde7d732e4c69acf73a
Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-03-14 15:27:03 +01:00
Janne Anttila
f79202805e Disable UNC tests on WinRT.
Based on file system implementation for WinRT, the UNC paths are not
supported on WinRT, so lets disable corresponding tests as well.

Change-Id: Ib45ae618f39d5da39a822160096599b30204cf71
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
2014-03-14 15:26:49 +01:00
Morten Johan Sørvig
7bd7699e17 Add sizeLessWindow test case.
Verify that QOpenGLContext works with QWindows that
do not have an explicit size set.

Task-number: QTBUG-35342

Change-Id: I91be7beb0062c5825fc58273c701c396b6423256
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-03-14 15:26:41 +01:00
Janne Anttila
71b5aa1a2a Removed unnecessary TESTDATA statement from qmessageauthenticationcode.
QMessageAuthenticationCode autotest does not have data folder for
TESTDATA. It seems that pro file is copy/pasted from another one which
actually have data. Removed the unnecessary statement since it caused
problems for https://codereview.qt-project.org/77981.

Change-Id: Ide753e5692bd2f469217760173a9b60f2f646770
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Liang Qi <liang.qi@digia.com>
2014-03-14 15:26:21 +01:00
Shawn Rutledge
2258d8f9d0 Disable splashScreenModality test: dialog is going under splash screen
That's a bug, but this test causes CI problems until it's fixed.

Task-number: QTBUG-35169
Change-Id: I27b3a61437312d2217743670fa14510d9340d8c1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Simo Fält <simo.falt@digia.com>
2014-03-14 15:26:10 +01:00
Kai Koehne
ef43967fcd Logging: Let user configure rules via QT_LOGGING_RULES
Check also for rules set in an environment variable QT_LOGGING_RULES.
This makes it even more convenient to set rules e.g. for just one run of an
application, without having to create a logging configuration file. It
is also more in place with the current way we enable/disable debugging
of parts of Qt via environment variables.

Change-Id: I4d05976f2b6c12bca472552ffa22345475cd01de
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com>
2014-03-13 13:26:51 +01:00
Kai Koehne
19693362e7 Use QStringRef for parsing of logging rules
Use QStringRef to speed up the parsing of the left side of logging rules.

Change-Id: Idd4d75496e3865d092f2802c45928a414c14c615
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-03-13 13:26:36 +01:00
Kai Koehne
2350c7e35c Make parsing of categories in logging rules more strict
Do not accept rules with wildcards in the middle.

Change-Id: If6fa71629c46bc4127aa8bd475643bc0e8a9f57c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-03-13 13:26:26 +01:00
Kai Koehne
b3871dc804 Make parsing of categories in logging rules consistent.
The documentation says that the left side of a logging rule has the syntax

<category>[.<type>]

with optional wildcard '*' as the first or the last character (or at
both positions.

However, so far we didn't allow

qt.*.debug

But what we did allow is implicit dropping of trailing '.', e.g.

qt.* matched also 'qt'

Fix these by splitting up the '.type' in advance, and then do string
matching only on the 'real' category names.

Change-Id: Iab50ad0fc673464e870f5ab8dfb3245d829b3107
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-03-13 13:26:14 +01:00
Kai Koehne
f6d0c67d30 QDebug: Allow text stream formatting for 64 bit numbers
Use the QTextStream stream operator for formatting 64 bit numbers,
just like we do for other numbers, too. This ensures all numbers in
a QDebug stream e.g. respect the hex and showbase modifiers.

The original reason for formatting qin64, quint64 with QString::number
is unclear (pre-dates the original qt4 git import). Maybe QTextStream
did lack proper support for 64 bit numbers back then.

Task-number: QTBUG-36841
Change-Id: I049516c2a8394c9c1a708f86c3d950418a20a957
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-03-13 13:26:02 +01:00
Sergio Ahumada
9f87c3663d tests: Mark tst_qdbus* tests as insignificant on OS X
D-Bus libraries were recently added to OS X 10.7 making these
tests to be executed for first time.

Task-number: QTBUG-37469
Change-Id: Ia7a74a45b18d4a645307f7fb7666236c5e009e5f
Reviewed-by: Simo Fält <simo.falt@digia.com>
2014-03-13 13:25:49 +01:00
Friedemann Kleint
eb0032687f Stabilize tst_qnetworkreply on Windows.
Do not close connection in slot bytesWritten() since that can
cause clients to fail with "Connection Closed". Instead, use
deleteLater() to close properly and prevent leaking the sockets.

FAIL!  : tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() 'waitForFinish(reply) == Success' returned FALSE. ( QUrl( "http://localhost:58240" )  failed: # 2 "Connection closed" )
..\tst_qnetworkreply.cpp(7067) : failure location

Task-number: QTBUG-37449

Change-Id: Ib92cb62fae523370b2fb45e1ccfa217559732bc8
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2014-03-13 13:25:35 +01:00
Simo Fält
e5785d6322 Fix network tests relying on troll.no
Replacing old troll.no domain with qt-project.org domain. Using troll.no
doesn't work anymore.

Change-Id: Ic6fa71b044d1adbdc66c875b47bfdc256a2afc8e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-03-13 13:25:26 +01:00
Friedemann Kleint
9c5e441394 Skip the test 'abort' of tst_qftp.
The test takes too long and fails:

FAIL!  : tst_QFtp::abort(WithoutProxy:get_fluke01) '(int)newData_ba.size() == bytesDone' returned FALSE. ()
tst_qftp.cpp(1886) : failure location
FAIL!  : tst_QFtp::abort(WithoutProxy:get_fluke01) Network operation timed out
tst_qftp.cpp(1392) : failure location
FAIL!  : tst_QFtp::abort(WithoutProxy:put_fluke01) 'bytesDone != bytesTotal' returned FALSE. ()
tst_qftp.cpp(1406) : failure location
FAIL!  : tst_QFtp::abort(WithSocks5Proxy:get_fluke01) '(int)newData_ba.size() == bytesDone' returned FALSE. ()
tst_qftp.cpp(1886) : failure location
FAIL!  : tst_QFtp::abort(WithSocks5Proxy:get_fluke01) Network operation timed out
tst_qftp.cpp(1392) : failure location
FAIL!  : tst_QFtp::abort(WithoutProxyWithSession:get_fluke01) '(int)newData_ba.size() == bytesDone' returned FALSE. ()
tst_qftp.cpp(1886) : failure location
FAIL!  : tst_QFtp::abort(WithoutProxyWithSession:get_fluke01) Network operation timed out
tst_qftp.cpp(1392) : failure location
FAIL!  : tst_QFtp::abort(WithoutProxyWithSession:put_fluke01) 'bytesDone != bytesTotal' returned FALSE. ()
tst_qftp.cpp(1406) : failure location
FAIL!  : tst_QFtp::abort(WithSocks5ProxyAndSession:get_fluke01) '(int)newData_ba.size() == bytesDone' returned FALSE. ()
tst_qftp.cpp(1886) : failure location
FAIL!  : tst_QFtp::abort(WithSocks5ProxyAndSession:get_fluke01) Network operation timed out
tst_qftp.cpp(1392) : failure location
Totals: 327 passed, 10 failed, 4 skipped
QtQA::App::TestRunner: warning: test duration (398 seconds) is dangerously close to maximum permitted time (450 seconds)
QtQA::App::TestRunner: warning: Either modify the test to reduce its runtime, or use a higher timeout.
QtQA::App::TestRunner: test failed, running again to see if it is flaky...

Change-Id: I122641f174927c6b3668df05c79f88e38b88042f
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
2014-03-10 20:41:43 +01:00
Friedemann Kleint
e9a93e888d Increase timeout in tst_NetworkSelfTest.
Try to fix frequently failing test:

FAIL!  : tst_NetworkSelfTest::ftpProxyServer() Failed to receive data in step 32: timeout
tst_networkselftest.cpp(230) : failure location

on Windows. Introduce timeout constant, add message.

Change-Id: I709f0b34cd1cfe5d3c64cf61ccb7907bd616bc54
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2014-03-10 20:41:35 +01:00
Thiago Macieira
d1e2235553 Revert the QByteArrayList addition to Qt 5.3
This reverts commits f12b0f9a38
("QByteArrayList: optimize op+"),
f96f2fe367 ("Enable QByteArrayList
tests"), and 4f23f0530a ("new
QByteArrayList class").

This class is coming back in Qt 5.4.

[ChangeLog][CHANGELOG FIX] Remove the line about QByteArrayList being
added.

Change-Id: I890ab2b34a9b3e575512eb306d0f241143a867cf
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-03-08 00:21:53 +01:00
Samuel Gaist
be81c58845 Add Objective-C specific type converters to QByteArray
This patch adds the Objective-C NSData/CDataRef converters to
QByteArray

This will replace the current converters offered in QMacExtras

[ChangeLog][QtCore][Objective-C] Added NSData/CDataRef converters for
QByteArray

Change-Id: I7a0f14bee4271798db345f3c5efd26ac671a3ea4
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-03-08 00:21:53 +01:00
Friedemann Kleint
898f7ea1ec Sanitize tst_qftp.
- Replace SRCDIR define by QFINDTESTDATA
- Replace QVERIFY by QCOMPARE where applicable
- Introduce QVERIFY2 with message for comparisons

Change-Id: Ib5a6b0f09428587281e1b9521e4d8a8117c1afdb
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
2014-03-06 17:22:55 +01:00
Jędrzej Nowacki
9a08483d76 Try to speedup tst_qmetatype.cpp compilation with clang.
The test instantiates enormous amounts of templates in one compilation
unit. All clang versions, that I tested, suffers from performance issues
while compiling the test, the cost depends on the version. The most
affected are shipped by Apple.

Task-number: QTBUG-37237

Change-Id: I0959c1a4a6faee448ae1dae5c1e70ee06cefbd9c
Reviewed-by: Simo Fält <simo.falt@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2014-03-06 17:22:55 +01:00
Jędrzej Nowacki
564297d7c4 Reduce clang compilation time of tst_qmetatype by ~50%
We do not need to check all possible basic type combinations in
the autoregistration test.

Change-Id: Ibfb97a93d9d1862e669d843988976690bbc83c74
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-03-06 17:22:55 +01:00
Jędrzej Nowacki
b0d8beb858 Simplify tst_QMetaType::automaticTemplateRegistration
Redundant and unused variadic macro arguments were removed. For macros
with known count of arguments, named arguments are preferred.
Common code was moved out from macros so it is not generated over and
over.

Change-Id: Ib5106555d0d3c6cadfbdbdbd614831240b6d762f
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2014-03-06 17:22:55 +01:00
Friedemann Kleint
37f5935a89 tst_QGLThreads: Fix errors about makeCurrent() in different thread.
QFATAL : tst_QGLThreads::textureUploadInThread() Cannot make QOpenGLContext current in a different thread
QFATAL : tst_QGLThreads::painterOnPboInThread() Cannot make QOpenGLContext current in a different thread

Task-number: QTBUG-28264

Change-Id: I281cf0593e01b43456410a9a53746bbb15f34f24
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-03-06 17:22:55 +01:00
Friedemann Kleint
3d73e11ccc Increase CI timeout for cmake tests.
Change-Id: I1711f99f9e46f1d195684e3c3a714b00618dca2e
Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2014-03-06 17:22:55 +01:00
Oliver Wolff
7aa1a7f1c1 spdy autotest: Fixed build with QT_NO_NETWORKPROXY
Task-number: QTBUG-37171
Change-Id: I835764978cf75592d46a20fa5f644f6accec43f5
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
2014-03-06 12:21:14 +01:00
Oliver Wolff
62742d037f spdy autotest: Fix build with QT_NO_OPENSSL
Task-number: QTBUG-37171
Change-Id: I76df40d53e1310c16f559f91c244c6162e35475e
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
2014-03-06 12:21:14 +01:00
Laszlo Agocs
efbea58665 Make QOpenGLFunctions able to resolve everything
At least if the platform plugin's QPlatformOpenGLContext implementation
supports it.

This completes the QOpenGLFunction changes necessary for dynamic loading
of the OpenGL implementation. Everything else is up to the platform plugin.

Change-Id: I710e6fbee3005360ecf02bc6ef976e1beb513819
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-03-06 12:21:14 +01:00
Sze Howe Koh
b83dc929ec Complete QJsonValue::fromVariant()
- QVariant can store (U)Int, (U)LongLong, Float and Double numbers.
  Previously, QJsonValue::fromVariant() converted Floats into Strings
  while converting the others to Doubles.
- Add unit tests for QJsonValue::fromVariant()

[ChangeLog][QtCore][JSON] QJsonValue::fromVariant() will now convert
single-precision Floats into Doubles instead of Strings

Change-Id: I457adbe29c37ada611d1c6d711c42866d63d4024
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-03-06 12:21:14 +01:00
Tor Arne Vestbø
9d79c3458c Disable the qmetatype test on Clang + ARM, it's causing OOM during build
And takes a very long time to build if it doesn't run out of memory.

Task-number: QTBUG-37237
Change-Id: I8c7fae4d2d99ad59c6d6306da2df554a05955446
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-03-04 15:59:05 +01:00
Andy Shaw
f07841bc7c Revert path() behavior to not expand a current path on a drive
In the original change - cfb44c6528 - when
querying for the path of a file that did not contain a slash after the
drive indicator it would get the current path and return that as the path
that the file resided on.

However this meant that it would take the current path at that time which
may not be the actual path that was expected. So it was decided that
it should revert back to the original behavior which was to just return
the drive letter followed by the colon which would thus indicate still
that it represented whatever the current path was on that drive.

Change-Id: Ic57ae9227882a66e9a4c4d6537d7f2cae829165a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-03-04 15:59:05 +01:00
Laszlo Agocs
4b2f35d04c Dynamic GL: remove exporting symbols
Remove the opengl proxy for now. Later it will either be moved into
a separate library or replaced by a QOpenGLFunctions-based approach.

This means that the -opengl dynamic configuration is not usable
for the time being. The rest of the enablers remain in place.

The convenience function QOpenGLFunctions::isES() is now moved to
QOpenGLContext and is changed to check the renderable type. This is
extremely useful since besides supporting dynamic GL it solves also
the problem of GL_ARB_ES2_compatibility (i.e. it triggers the real ES
path when creating an ES-compatible context with a desktop OpenGL
implementation).

Task-number: QTBUG-36483
Task-number: QTBUG-37172
Change-Id: I045be3fc16e9043e1528cf48e6bf0903da4fa7ca
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-03-04 15:59:05 +01:00
Sze Howe Koh
fe2ce05d23 Remove duplicated tests
tst_QtJson::testValueSimple() tested bool and double values twice

Change-Id: Ie6e58aab729c6ee20cb53d3b85746a05f7571f5e
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-03-04 15:59:05 +01:00
Chris Colbert
6060dab13a Fix issue where revealed widget children do not receive paint event.
When a child of a widget is spontaneously revealed due to a call to
the parent 'resize' method, the child will not receive a paint event
if it has the WA_StaticContents and WA_OpaquePaintEvent flags set.

This is caused by the backing store being pre-emptively resized by the
call to setGeometry_sys, which causes QWidgetBackingStore::sync to skip
the block which handles the static contents.

There doesn't appear to be any reason to preemptively resize the backing
store, since it is always resized as-needed during the the 'sync' method.
This change-set removes the code which preemptively resizes the backing
store.

Task-number: QTBUG-35282
Change-Id: Ie9942854ca5322dfe0f98ed8100810161576be80
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-03-04 15:59:05 +01:00
Friedemann Kleint
b22ef59663 Remove use of templates in tst_qatomicinteger.
MSVC 2008 is confused by TypeInStruct being a template, resulting in

\tst_qatomicinteger.cpp(189) : error C2027: use of undefined type 'QStaticAssertFailure<Test>'
        with
        [
            Test=false
        ]

for int (and thus for all unsupported types). This appears to be a real
Heisenbug-nature compiler bug as it can also be fixed by adding
qDebug() << Q_ALIGNOF(TypeInStruct<T>)
before the static assert.

Task-number: QTBUG-37195

Change-Id: Ib2b60f3c1ffeb0b8bdeb1fb0c659655ce4ab10d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-03-04 15:59:05 +01:00
Friedemann Kleint
e531b46bed Turn off compiler optimization in tst_qtendian for MSVC2008.
This causes frequent compiler errors on Windows CE.

tests\auto\corelib\global\qtendian\tst_qtendian.cpp(140) : fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'd:\orcas\compiler\utc\src\P2\main.c[0xCCCCCCCC:0xCCCCCCCC]', line 243)

Task-number: QTBUG-37194

Change-Id: I2adbc1e3b1896fbe86780aa26a15e918333a09f2
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-03-04 11:29:30 +01:00
Sergio Ahumada
7e872de76e Fix some typos
Change-Id: I7dbe938bff5ac3ab50a0197f94bdb2f6c22fbd16
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
2014-03-03 18:24:29 +01:00
Sergio Ahumada
e8ed514e35 tests: Remove superfluous gui additions to QT
by default QT contains both core and gui already

Change-Id: I6f5b551104e40a024468e7cb62e302134e9472ec
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2014-02-28 17:59:29 +01:00
Sergio Ahumada
e5870b61c6 tst_qnumeric: Mark some tests as XFAIL on BlackBerry 10
These tests seem to fail because denormalized numbers are not
supported on QNX yet, so marking them as expected failures.

 - floatDistance(denormal)
 - floatDistance_double(denormal)

Task-number: QTBUG-37094
Change-Id: I79dbc78da6e9bef8466264fd2cab4af0ee8b868f
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
2014-02-28 07:46:31 +01:00
Sergio Ahumada
82e699cab0 tst_qtjson: Mark some test as XFAIL on BlackBerry 10
These tests seem to fail because denormalized numbers are not
supported on QNX yet, so marking them as expected failures.

 - testNumbers_2()
 - toJsonLargeNumericValues()
 - parseNumbers()

Task-number: QTBUG-37066
Change-Id: Ifec95b936fb70253395dee4d1ca18e85870486a3
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
2014-02-28 07:46:31 +01:00
Giuseppe D'Angelo
c453571d75 CSS parser: fix the pseudo-classes array length
The pseudoclass array is declared with length "NumPseudos - 1",
but the declaration has actually 44 elements, not 45.

This caused a zero-initialized last element to be silently appended
to the array. The zero-initialized element broke the sorting
of the array, which in turn broke std::lower_bound usage
(although of course the problem was there from before switching
to the standard library algorithms).

Task-number: QTBUG-36933
Change-Id: I8a02891fc36761b6ae72d15a0a8d6c6a96813947
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-02-26 14:18:48 +01:00
Allan Sandfeld Jensen
b1a882f178 Fix drawCachedGlyphs on RGBA8888
drawCachedGlyphs draws with the wrong color on RGBA8888. The issue
is that the draw routines bitmapblit_quint32 and alphamapblit_quint32
while safe to use on rgba formats, needs to have the input color
converted.

This patch adds small wrapper functions for bitmapblit and alphamapblit
that converts the formats. Two tests are extended to ensure we have
test coverage.

Change-Id: I5f99f3795eba46a69d4df5b167e6099024e9a060
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-02-26 14:18:21 +01:00
Kai Koehne
f3ed93e486 Logging: Change 'rules' section name to 'Rules'
This is more consistent with e.g. qt.conf, where section names also
start with an upper case character.

Change-Id: I9ddaf72baeb9334d081807412512242d5d46cbbf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-02-26 12:58:00 +01:00
John Layt
aab29d546c QPrinter - Add more tests
Add more missing tests.

Change-Id: I801c5c67731075ccb3e62377c0eccc420e708365
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
2014-02-26 12:58:00 +01:00
Eskil Abrahamsen Blomfeldt
e1fd82981c Revert "Fix application font removal when using FontConfig"
This reverts commit a4ff400e25.
The patch caused a regression for bold fonts which is currently
blocking the alpha of Qt 5.3, so lets revert it and try
resubmitting a fixed version later to avoid delaying any release.

Task-number: QTBUG-36929
Change-Id: I8d474b09b2270eb2f861853e60605429be08e2d9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2014-02-25 21:51:07 +01:00
Sergio Ahumada
5e39b7ad1e tst_spdy: Check network test server
There is no need to even try to run the tests if the network test
server is not present.

Add a validation in initTestCase() since all test functions depend
on the network test server.

Change-Id: I8eca376a718ab5b6e1cc2c57f2e045dd0b58f52b
Reviewed-by: Richard J. Moore <rich@kde.org>
2014-02-25 16:47:22 +01:00
Sergio Ahumada
699ba50744 QtNetwork tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
Change-Id: If1cc5fafddc41ed19dd818caf294c69cd4969216
Reviewed-by: Richard J. Moore <rich@kde.org>
2014-02-25 16:47:13 +01:00
Sergio Ahumada
70ca6f5bba Remove qSort usages from core tests
QtAlgorithms is getting deprecated,
see http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: I355558fe6a51d00e9aa1f8b1221c6ec0c1e6bb77
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2014-02-22 09:51:14 +01:00
Thiago Macieira
1c63909ad8 Make sure all containers compile in strict-iterator mode
Unit-test this by making the QList, QVector, QHash and QMap unit tests
be duplicated under strict-iterator mode. There's no test for
QLinkedList.

The tst_Collections test does not compile under strict-iterator
mode. It generated over 15000 errors when I tried.

The strict iterators required a small change: the difference_type
typedef needs to match the operators that get distances
(operator-(iterator)) and move the iterator around (+, -, +=, -=, etc.).

Task-number: QTBUG-29608
Change-Id: I834873934c51d0f139a994cd395818da4ec997e2
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2014-02-22 04:38:01 +01:00
John Layt
3aae3e81ef QMarginsF - Add new QMarginsF class
Add a new QMarginsF class to complement QMargins in the style of
QSize/QSizeF and QRect/QRectF.

[ChangeLog][QtCore] Added class QMarginsF to support handling margins
with floating-point values.

Change-Id: Iaaa95ec85f5d126d9d864fc4b607241a8c8a8f3a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-02-21 20:33:10 +01:00
John Layt
c7aa3a6925 QRect - Add missing QMargins subtraction operator
[ChangeLog][QtCore][QRect] Added QMargins subtraction operator.

Change-Id: I64d449e2bae81a34df2cd019cff3fb186f8aaaae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-02-21 20:33:10 +01:00
John Layt
9c6447e081 QMargins - Add missing operators
Add missing standard operators.

[ChangeLog][QtCore][QMargins] Added missing addition and subtraction
operators.

Change-Id: I6aeed39531a736c12d378a817a9431279da79bc4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-02-21 20:33:10 +01:00
Andy Shaw
ecd3027d38 Strip any trailing spaces from the filename before trying to open it
On Windows, trailing spaces in a filename are silently ignored, so we
need to strip it before trying to open a file with it. Otherwise it ends
up being stripped later and in a case like " ." it will end up causing
Qt to think that a folder exists when it does not.

[ChangeLog][Platform Specific Changes][Windows][QtWidgets][QFileDialog]
Handled the case of having trailing spaces in a filename correctly so if
the filename ends up being empty that the parent path is used instead.

Change-Id: I6500cc3a44746bf4a65e73bcfb63265a0a97c8a3
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2014-02-21 15:58:51 +01:00
Kai Koehne
22f0dc4f89 Loosen checks for Q_COMPILER_VARIADIC_MACROS
So far we did bind the definition of Q_COMPILER_VARIADIC_MACROS to
C++11 (so gcc, clang will not define it in default gnu++98 standard).
However, variadic macros are a feature of the gcc preprocessor since
version 2.97, and are enabled in the default configurations on gcc, clang,
icc.

This might cause warnings and errors though if one enables additional
warnings in gcc, clang (e.g. by -pedantic). Anyhow, as a precedent
qglobal.h already relies on  'long long' ... The warning can be disabled
by adding '-Wno-variadic-macros'.

[ChangeLog][Compiler Specific Changes] Variadic macros are now enabled
more liberally for gcc, clang, icc. If you have warnings (because you e.g.
compile with -pedantic), disable them by -Wno-variadic-macros.

Change-Id: Ie979b85809508ad70cab75e6981f20496429f463
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-20 20:17:56 +01:00
Bernd Weimer
d641792ff2 Fix QFontMetrics width
Commit f4dd534 introduced a regression, so that QFontMetrics reported
a wrong size (to be more specific width) for FreeType fonts.
The calculation of glyph advances has to to reflect (rounded)
integral number of pixels. This was only done when the glyph was cached.
So in some cases the first call to QFontMetrics::size gave a different
result than the second.
This patch reverts f4dd5344fb.

The tst_QFontMetrics::same auto test only happened to work on some
platforms, on BlackBerry for instance it did not. Extended the test
case to make sure it works for different font sizes.

Change-Id: Ia5bb9abd3ff98193c9bba048b85207672ed8d9c3
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2014-02-20 20:13:27 +01:00
Sergio Ahumada
170df5addb Remove qSort usages from gui tests
QtAlgorithms is getting deprecated,
see http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: Idf0fc471f8ab7b30a097d8faf93c93d5ebbb03ef
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-02-20 08:10:19 +01:00
Sergio Ahumada
a01b7dad50 Remove qSort usages from tests
QtAlgorithms is getting deprecated,
see http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: I4c48db80533802e37771d3967fa10bfb7000cb9a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-02-20 08:10:06 +01:00
Peter Hartmann
1de244ea65 network: add support for the SPDY protocol
Currently the only supported SPDY version is 3.0.

The feature needs to be enabled explicitly via
QNetworkRequest::SpdyAllowedAttribute. Whether SPDY actually was used
can be determined via QNetworkRequest::SpdyWasUsedAttribute from a
QNetworkReply once it has been started (i.e. after the encrypted()
signal has been received). Whether SPDY can be used will be
determined during the SSL handshake through the TLS NPN extension
(see separate commit).

The following things from SPDY have not been enabled currently:
* server push is not implemented, it has never been seen in the wild;
  in that case we just reject a stream pushed by the server, which is
  legit.
* settings are not persisted across SPDY sessions. In practice this
  means that the server sends a small message upon session start
  telling us e.g. the number of concurrent connections.
* SSL client certificates are not supported.

Task-number: QTBUG-18714

[ChangeLog][QtNetwork] Added support for the SPDY protocol (version
3.0).

Change-Id: I81bbe0495c24ed84e9cf8af3a9dbd63ca1e93d0d
Reviewed-by: Richard J. Moore <rich@kde.org>
2014-02-19 21:44:15 +01:00
Oswald Buddenhagen
30fd22b957 Merge remote-tracking branch 'origin/dev' into stable
Change-Id: Ice524edcc51373509f0023ae7f7c2963f4602f88
2014-02-19 10:06:25 +01:00
Frederik Gladhorn
6aa09bbce5 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	src/plugins/platforms/android/qandroidplatformtheme.h

Change-Id: I541bd3069df3ab54c7942d5f4a9e155e3b6566a0
2014-02-18 14:19:36 +01:00
Sergio Ahumada
8102b75ee8 Remove qSort usages from widgets tests
QtAlgorithms is getting deprecated,
see http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: Ica7639d16f52b4ffcd2c00cc806fed1378a7948b
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2014-02-18 11:59:55 +01:00
Sergio Ahumada
817c4be91f Remove qSort usages from network tests
QtAlgorithms is getting deprecated,
see http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: I31a701d8e17673edcb9bb7c32e6e6a87812a7fbc
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2014-02-17 19:31:01 +01:00
Thiago Macieira
83b1eaad44 Make a URL with absent authority be different from one with an empty one
This partially reverts 5764f5e6ea and
fixes the problem differently.

After this commit, "file:///foo" is still equal to "file:/foo", but
"foo:///foo" becomes different from "foo:/foo", as it should be.

Task-number: QTBUG-36151
Change-Id: Ia38638b0f30a7dcf110aa89aa427254c007fc107
Reviewed-by: David Faure <david.faure@kdab.com>
2014-02-17 18:13:42 +01:00
Frederik Gladhorn
dbafabb019 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	src/corelib/global/qglobal.h

Change-Id: I03d8b6e07135056baaa1d97c3c63fbe8b25583d9
2014-02-17 11:39:16 +01:00
Sergio Ahumada
f5f00e69a0 tst_qfont: Fix small typo
Change-Id: I7e007202b0cc80a1808831ebcf46ae7ec0866828
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2014-02-17 10:40:33 +01:00
Lars Knoll
6de515aea2 Remove a not required whitespace when writing JSON in compact format
Task-number: QTBUG-36682

Change-Id: I0c1c0de850504c8dff20a5ae724cc868d9f983f8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-16 16:56:10 +01:00
Jørgen Lind
44ee7984fc QOpenGLTextureBlitter: fix source rect when origin is top left
This fixes the issue that the blitter required sometimes the
texture wrapping to be repeat

Change-Id: I86150d008422facf9040873b0983b0e44be9ad24
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-02-16 11:06:40 +01:00
Jørgen Lind
937a4f5443 QOpenGLTextureBlitter: Remove Origin location for the Target rect
The Origin for Target rect was deemed a confusing concept. The current
implementation would translate the target rect to the coordinate system
specified. However, the order and "direction" of the vertices would
always be the same. So drawing a texture in for one target rect defined in
one coordinate system would paint the texture the same way as it would
when a texture was drawn for a target rect drawn in the "opposite"
coordinate system. The point with this was that if you wanted to "flip"
the texture you would specify that with the source coordinate system.

However, this approach breaks on different levels, such as QRect has functions
which expects a top left coordinate system (ie. top() and bottom()).

In the end Qt uses a top left coordinate system, hence QWindow specifies
a top left coordinate system, and hence the api becomes easier if it is
not possible to define the coordinate system of the target viewport.

Change-Id: I7dd59b3718380876e87a4bff88381d7a1c7d58c1
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-02-16 11:06:19 +01:00
Jørgen Lind
6fbef080a0 QOpenGLTextureBlitter: add some autotests
Change-Id: I07a4847a19908c1a6d7fb02649b306dfa0148f49
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-02-16 11:06:00 +01:00
Thiago Macieira
579526cfec Make the printing of complex Unicode in a QString prettier
This also has the advantage of not requiring the use of the locale
codec. Quite an advantage if you're debugging the locale codec. But it's
mostly so that we don't get question marks that hide the difference we
were trying to locate.

[ChangeLog][QtTest] QtTest now prints an escaped version of QStrings
that failed to compare with QCOMPARE. That is, instead of converting
non-printable characters to question marks, QtTest will print the
Unicode representation of the character in question.

Change-Id: I44c1ef3246b188c913dacd3ca4df02581356ea41
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-02-16 06:54:18 +01:00
Thiago Macieira
634f82f1f1 Add a testAndSet overload to the atomics that returns the current value
This is extremely useful, since the most common action after a failed
compare-and-swap is to loop around, trying again with the current
value as found in memory.

Code currently written as:
    do {
        Type value = atomic.load();
        ...
    } while (!atomic.testAndSetRelaxed(value, desired));

Becomes:
    Type value = atomic.load();
    do {
        ...
    } while (!atomic.testAndSetRelaxed(value, desired, value));

In most CPU architectures, the value that was found in memory is known
to the compare-and-swap code, so this is more efficient than the
previous code. In architectures where the value is not known, the new
code is no worse than before.

The implementation sometimes modified an existing function, sometimes
it added a new one, depending on whether more registers were needed in
the assembly (like ARMv6-7), the code became more complex (ARMv5), the
optimizer failed (C++11), or it was just plain equivalent (MIPS).

Change-Id: I7d6d200ea9746ec8978a0c1e1969dbc3580b9285
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-16 05:12:26 +01:00
Marc Mutz
c0791ac76e Add qHash() overloads for floating-point types
This implementation is based on GCC's implementation of std::hash<FP>, but only
to the extent of checking for zero before hashing the bits. The bit hasher is
the Qt one; I didn't even look what GCC uses.

The check against 0.0 is mandated by the requirement to have
  \forall x,y: x == y => qHash(x) == qHash(y)
which would be violated for x = 0.0 and y = -0.0 if we only hashed the bits.

Implemented out-of-line to avoid potential FP-comparison warnings, as well
as to be able to use the file-static hash() functions, which gets inlined
unlike qHashBits(), which cannot be.

[ChangeLog][QtCore][QHash/QSet] Allowed to use float, double and long double
as QHash/QSet keys.

Change-Id: I38cec4afb860f17e9f8be7b67544e58b330f8fff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-02-16 00:18:32 +01:00
Marc Mutz
6afc34a72f tst_qsignalblocker: simplify test
This test can assume that the QObject::signalsBlocked property works as
advertized, so just check signalsBlocked() in repsonse to QSignalBlocker
manipulations.

Change-Id: I99e4ef9c4ed05c3840233d92a587636d2d78f59a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-02-16 00:18:32 +01:00
Kai Koehne
c9cdbcb12f Add const overload for QLoggingCategory::operator()()
Change 85e57653 caused a compile error for code that does

  Q_DECLARE_LOGGING_CATEGORY(cat);
  //..
  qCDebug(cat()) << // ...

error: C3848: expression having type 'const QLoggingCategory' would lose
some const-volatile qualifiers in order to call 'QLoggingCategory
&QLoggingCategory::operator ()(void)'

This is a regression from Qt 5.2. Fix the error by adding a const version
of operator()().

Change-Id: I2fb04f2e155962adee0f98089fc5a159000bef56
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-15 21:57:43 +01:00
Oliver Wolff
553c6416bb WinRT: Added socket engine implementation
Added basic functionality to socket for WinRT. Even though not
all auto tests pass yet, this patch can be seen as a foundation
for upcoming work in this area. Reading from and writing to TCP
socket works and one can listen for tcp connections.

Change-Id: Id4c25ba1c7187ed92b6368c785c4f62837faded7
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
2014-02-15 10:50:12 +01:00
Jędrzej Nowacki
f96f2fe367 Enable QByteArrayList tests
Change-Id: Id7e0550e857bf4221f49d08539a0b5c70d8386d3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-02-14 15:16:09 +01:00
Olivier Goffart
2b0f02aa5c moc: Fix parsing of operator<
moc would skip the 'operator' keyword as unknown and try to parse a type again
but as it sees the '<' it looks for the corresponding '>' which does not exist
types can't start with '<' anyway, so return an invalid type and continue
parsing as usual

Task-number: QTBUG-36834

Change-Id: If3d27076ef9947abf8c57c594713eece9334d0b0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-02-14 14:33:17 +01:00
Laszlo Agocs
97c187da3c Dynamic GL switch on Windows
The patch introduces a new build configuration on Windows which
can be requested by passing -opengl dynamic to configure.

Platforms other than Windows (including WinRT) are not affected.
The existing Angle and desktop configurations are not affected.
These continue to function as before and Angle remains the default.

In the future, when all modules have added support for the dynamic
path, as described below, the default configuration could be changed
to be the dynamic one. This would allow providing a single set of
binaries in the official builds instead of the current two.

When requesting dynamic GL, Angle is built but QT_OPENGL_ES[_2] are
never defined. Instead, the code path that has traditionally been
desktop GL only becomes the dynamic path that has to do runtime
checks. Qt modules and applications are not linked to opengl32.dll or
libegl/glesv2.dll in this case. Instead, QtGui exports all necessary
egl/egl/gl functions which will, under the hood, forward all requests
to a dynamically loaded EGL/WGL/GL implementation.

Porting guide (better said, changes needed to prepare your code to
work with dynamic GL builds when the fallback to Angle is utilized):

1. In !QT_OPENGL_ES[_2] code branches use QOpenGLFunctions::isES() to
differentiate between desktop and ES where needed. Keep in mind that
it is the desktop GL header (plus qopenglext.h) that is included,
not the GLES one.

QtGui's proxy will handle some differences, for example calling
glClearDepth will route to glClearDepthf when needed. The built-in
eglGetProcAddress is able to retrieve pointers for standard GLES2
functions too so code resolving OpenGL 2 functions will function
in any case.

2. QT_CONFIG will contain "opengl" and "dynamicgl" in dynamic builds,
but never "angle" or "opengles2".

3. The preprocessor define QT_OPENGL_DYNAMIC is also available in
dynamic builds. The usage of this is strongly discouraged and should
not be needed anywhere except for QtGui and the platform plugin.

4. Code in need of the library handle can use
QOpenGLFunctions::platformGLHandle().

The decision on which library to load is currently based on a simple
test that creates a dummy window/context and tries to resolve an
OpenGL 2 function. If this fails, it goes for Angle. This seems to work
well on Win7 PCs for example that do not have proper graphics drivers
providing OpenGL installed but are D3D9 capable using the default drivers.

Setting QT_OPENGL to desktop or angle skips the test and forces
usage of the given GL. There are also two new application attributes
that could be used for the same purpose.

If Angle is requested but the libraries are not present, desktop is
tried. If desktop is requested, or if angle is requested but nothing
works, the EGL/WGL functions will still be callable but will return 0.
This conveniently means that eglInitialize() and such will report a failure.

Debug messages can be enabled by setting QT_OPENGLPROXY_DEBUG. This will
tell which implementation is chosen.

The textures example application is ported to OpenGL 2, the GL 1
code path is removed.

[ChangeLog][QtGui] Qt builds on Windows can now be configured for
dynamic loading of the OpenGL implementation. This can be requested
by passing -opengl dynamic to configure. In this mode no modules will
link to opengl32.dll or Angle's libegl/libglesv2. Instead, QtGui will
dynamically choose between desktop and Angle during the first GL/EGL/WGL
call. This allows deploying applications with a single set of Qt libraries
with the ability of transparently falling back to Angle in case the
opengl32.dll is not suitable, due to missing graphics drivers for example.

Task-number: QTBUG-36483
Change-Id: I716fdebbf60b355b7d9ef57d1e069eef366b4ab9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-02-14 10:51:44 +01:00
Bernd Weimer
3cdd0358b3 Fix QDateTime auto test
Conversion from UTC to local time will result in same datetime value,
if local time is in UTC.

Change-Id: Icd4ea57cb46cc97bcc8fce4f4e579bf64a4d4b10
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
2014-02-14 10:51:44 +01:00
Olivier Goffart
2b26f801b5 Make parsing of template arguments more robust.
At first, my goal was just to fix Moc::until() to parse properly
template arguments containing expressions containing > or >>
such as Foo<(8>>2)>

But with the test, I realized that normalizeType also requires change
not to split the > > too much.

And QMetaObjectPrivate::decodeMethodSignature should not interpret
the ) within the template parameter as the end of the function.

Change-Id: Ia9d3a2a786368aeda1edcf66280d70f64cf05070
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-02-14 09:42:53 +01:00
Christian Strømme
2223cc8a2d Add function to get the actual PID from QProcess
It was not possible to get the actual process ID (in a cross-platform
manner) from QProcess, as the user would need to handle the returned
typedef (Q_PID) differently on Unix and Windows.

On Unix Q_PID is the actual process ID, but on Windows it's a pointer
to a PROCESS_INFORMATION structure, which among other fields contains
the process ID. Instead of returning a pointer on Windows,
QProcess::processId() will return the actual process ID on both Windows
and Unix.

[ChangeLog][QtCore][QProcess] Added processId() to QProcess. This
function will, unlike pid(), return the actual process identifier on
both Window and Unix.

Task-number: QTBUG-26136
Change-Id: I853ab721297e2dd9cda006666144179a9e25b73d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-14 00:34:25 +01:00
Thiago Macieira
8dcb72fd1e Add a CSV logging feature to the benchlib
This is only useful for logging benchmarks, since it won't print test
passes, failures, etc. It's useful for importing to spreadsheets to do
number-crunching.

[ChangeLog][QtTest]Added a CSV logging mode that is suitable for
importing benchmark results into spreadsheets. This can be enabled by
the -csv option on the command-line. The CSV logging mode will not print
test failures, debug messages, warnings, etc.

Change-Id: I245d6f86bb380645c9bc0d748cf474b3ed42cab8
Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2014-02-14 00:34:25 +01:00
Laszlo Agocs
ff11af4fbc QOpenGLWidget and new-style compositing on eglfs
Integrate with QOpenGLTextureBlitter, QOpenGLWidget and friends.

Change-Id: Ic2867b713a21a3d2820d546174fc9164b3dd220c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
2014-02-13 20:54:01 +01:00
Konstantin Ritt
7ac97d7efb Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev 2014-02-13 09:35:08 +01:00
Glen Mabey
4f23f0530a new QByteArrayList class
Initial submission of a new class QByteArrayList with the
purpose of aggregating and then joining QByteArray instances.

[ChangeLog][QtCore] Added new QByteArrayList class.

Change-Id: I2a9dc71ff7aadb19ebc129a0d47ac8cd33895924
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-12 20:12:17 +01:00
David Faure
f42bd772f8 Move setWindowIcon() up to QGuiApplication.
[ChangeLog][QtGui][QWindow]QWindow::icon() now defaults to the application
icon, which can be set with QGuiApplication::setWindowIcon().

Change-Id: Id1974e5cda81775e515c14b294f67fb99351c6c9
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2014-02-12 20:12:17 +01:00
David Faure
bf82245baf Restore support for -title command line argument on X11, add -qwindowtitle.
-title disappeared between Qt4 and Qt5, due to all the refactorings around QPA.
Making the caption of the mainwindow configurable allows custom setups
for specific users or use cases.

[ChangeLog][QtGui][QGuiApplication] Restore support for -title command line
argument on X11, add -qwindowtitle on all platforms.

Change-Id: I73e6bf21248f3419178eba583b257172a175e74e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2014-02-12 20:12:17 +01:00
Paul Olav Tvete
eacd58d4e7 Enabling QQuickWidget and QOpenGLWidget
Enable child widgets (without a native window) that render to an FBO
and are composed with the raster backingstore by the platform plugin.
A preliminary version of QOpenGLWidget is included as private API.

Change-Id: I8f984a4d7db285069ce3d6564707942c823d890d
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-02-12 20:12:17 +01:00
Friedemann Kleint
5ae5bebb93 Added function returning build information to QLibraryInfo.
Useful for bug reports and test logs.

[ChangeLog][QtCore] QLibraryInfo provides information on how
Qt was built.

Change-Id: I867197fd7d2e10bcdf01a8eb47c9c1e03647e2c1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-12 17:24:33 +01:00
Frederik Gladhorn
a9c88c1f39 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	src/gui/image/qimage.cpp
	src/gui/text/qtextengine.cpp
	src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
	src/printsupport/kernel/qprintengine_win.cpp

Change-Id: I09ce991a57f39bc7b1ad6978d0e0d858df0cd444
2014-02-12 16:28:07 +01:00
J-P Nurmi
4d6cb199b8 Make QToolButtonPrivate::popupTimerDone() more robust
Avoid dereferencing the q-pointer if the button has been
destructed meanwhile popup was open.

Task-number: QTBUG-26956
Change-Id: I68190e9fe84c669229ae0ce4d573ee7a02a8a141
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2014-02-12 01:41:15 +01:00
Kai Koehne
a2bfd11493 Allow configuration of logging rules from file system
Allow configuration of logging rules from outside of the application,
either through a configuration file (.config/QtProject/qtlogging.ini),
or through a file specified by a QT_LOGGING_CONF environment
variable.

The logging rules from the different sources are concatenated: First
the rules from QtProject/qtlogging.ini are applied, then
QLoggingCategory::setLoggingRules(), finally from the environment.
This allows an application to overwrite/augment the system wide rules,
and in turn that can be tailored for a specific run by setting a
configuration in the environment variable.

[ChangeLog][QtCore][Logging] The logging framework can now be configured
with an .ini file.

Change-Id: I442efde1b7e0a2ebe135c6f6e0a4b656483fe4b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-11 20:59:15 +01:00
Peter Hartmann
c5042d68ea network tests: do not rely on external servers
They cause test failures from time to time.

Change-Id: I917bef340401d25bf54e133be9d9562b3b133c9f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Niels Weber <niels.weber@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2014-02-11 16:03:02 +01:00
Peter Hartmann
42cfb5fe4d SSL: add support for the Next Protocol Negotiation extension
... which is needed to negotiate the SPDY protocol.

[ChangeLog][QtNetwork][QSslConfiguration] Added support for the Next
Protocol Negotiation (NPN) TLS extension.

Task-number: QTBUG-33208

Change-Id: I3c945f9b7e2d2ffb0814bfdd3e87de1dae6c20ef
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
2014-02-11 15:37:10 +01:00
Frederik Gladhorn
df62c31807 Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev 2014-02-11 15:12:00 +01:00
Joerg Bornemann
cbc6387a28 support c'tor as second parameter in foreach macro
Passing a constructor as second argument to foreach didn't work when
building with gcc.
For MSVC this already worked as a different foreach implementation is
used.

Change-Id: Id98444c699b4cebc14ea62076c5f7cba33ffb824
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-02-11 13:28:35 +01:00
Allan Sandfeld Jensen
15f3191981 Fix drawing vertical gradients in RGBA8888 formats
The RGBA8888 formats was incorrectly using the qt_gradient_quint32
which is argb specific. This caused vertical gradients but only
vertical gradients to be drawn incorrectly.

This changes the RGBA8888 formats formats to use the generic gradient
method and renames qt_gradient_quint32 to qt_gradient_argb32 to
indicate its limitation.

Change-Id: Ia1cd48ca7f4f78b64f31d6263e81cd8ac3b0954e
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-02-10 23:02:47 +01:00
Giorgos Tsiapaliokas
d61e774307 Print qCDebugs in arbitrary categories by default
The debug output of all categories will be visible by default,
except from the "qt.*" categories. "qt.*" categories are private
and their default debug output will be hidden.

[ChangeLog][QtCore][Logging] Enable qCDebug's for all categories except qt one's

Change-Id: Ibe147c8bbe0835a63b3de782288b9c3251321d8f
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-02-10 16:28:30 +01:00
Jorgen Lind
a80253ae4c QOpenGLTextureBlitter
private api, but useful for 2d gui code that suddenly finds itself
needing to get a set of textures onto some fbo

I didn't want to include ARB_copy_image since it looks like its from
texture/renderbuffer -> texture/renderbuffer while this class implies
texture -> write fbo. We could wrap ARB_copy_image in QOpenGLTexture or
some other class or we can add it later.

I have not added any QOpenGLTexture functions since this class opperates
on the GLuint identifier. We can add overloads later.

Change-Id: I3e565b33466c1c183a249a33c3e82c6786debd55
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
2014-02-10 12:49:06 +01:00
David Faure
5c9d671bfb QStandardPaths: fix empty path in XDG_DATA_DIRS being treated as '/'.
The basedir xdg spec says:
"All paths set in these environment variables must be absolute.
If an implementation encounters a relative path in any of these variables it
should consider the path invalid and ignore it."
Therefore we ignore relative paths including the empty string.

Change-Id: I8f779b78981018051b16de23b2514f2e62b7ab39
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-10 11:00:41 +01:00
Thomas McGuire
6f5db32abe Don't deadlock when deleting slot objects in QMetaObject::activate()
The slot object was deleted after the mutex was relocked, which caused
a deadlock in case the functor destructor locked the same mutex again.

Change-Id: I5b4fb22fdb4483f91c89915872bfd548c31b0eea
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-02-08 14:32:53 +01:00
David Faure
3e8af132df QStandardPaths: ensure that paths use '/' on all platforms, as the comment said
Change-Id: Id70b5e92c07f63e71e7a1a8fb229f927d352ebdd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-08 10:50:25 +01:00
Morten Johan Sørvig
c8848a5e98 Compile.
Change-Id: Ib0e7e7aa2964835afda4055a5fe76abbd5db84e3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2014-02-08 10:43:58 +01:00
Jan Arve Saether
de1b98e9c1 Fallback to QWidget::grab() if QScreen::grabWindow() fails.
QScreen::grabWindow() is not always reliable because it grabs from the
framebuffer. (The window might then be covered by other windows, e.g.
"Stays on top"-Windows, popups etc).
If QScreen::grabWindow() fails we therefore fallback to
QWidget::grab(). This will not grab from the frame buffer, but it will
ask the widget to render itself (with its current state) to a pixmap
and return it.
QWidget::grab() should usually return the expected pixmap, and the
pixmap it gives is not subject to the state of the window manager.

This means that both QScreen::grabWindow() *and* QWidget::grab()
must produce an unexpected pixmap in order for the test to fail.

Change-Id: I276554155bb1e5b510d2a2d43628d91669464fe2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2014-02-07 23:52:49 +01:00
Giuseppe D'Angelo
bcd1b7fe8e Fix QString::toUcs4 returning invalid data when encountering stray surrogates
Code units 0xD800 .. 0xDFFF are not UCS-4, so we can't happily return them.
Instead, if we encounter a stray surrogate, replace it with 0xFFFD, which
is what Unicode recommends anyhow.

References:

§3.9 Unicode Encoding Forms

    D76: Unicode scalar value: Any Unicode code point except high-surrogate
    and low surrogate code points.

    As a result of this definition, the set of Unicode scalar values consists
    of the ranges 0 to D7FF_16 and E000_16 to 10FFFF_16, inclusive.

    [...]

    UTF-32 encoding form: The Unicode encoding form that assigns each Unicode
    scalar value to a single unsigned 32-bit code unit with the same numeric
    value as the Unicode scalar value.

§ C.2 Encoding Forms in ISO/IEC 10646

    UCS-4. UCS-4 stands for “Universal Character Set coded in 4 octets.” It is
    now treated simply as a synonym for UTF-32, and is considered the canonical
    form for representation of characters in 10646.

§ 3.9 Unicode Encoding Forms (Best Practices for Using U+FFFD)
and
§ 5.22 Best Practice for U+FFFD Substitution

    Whenever an unconvertible offset is reached during conversion of a code
    unit sequence:

    1. The maximal subpart at that offset should be replaced by a single
    U+FFFD.

    2. The conversion should proceed at the offset immediately after the
    maximal subpart.

    [...]

    Whenever an unconvertible offset is reached during conversion of a code
    unit sequence to Unicode:

    1. Find the longest code unit sequence that is the initial subsequence of
    some sequence that could be converted. If there is such a sequence, replace
    it with a single U+FFFD; otherwise replace a single code unit with a single
    U+FFFD.

    2. The conversion should proceed at the offset immediately after the
    subsequence which has been replaced.

[ChangeLog][QtCore][QString] QString::toUcs4 now does not return invalid
UCS-4 code units belonging to the surrogate range (U+D800 to U+DFFF)
when the QString contains malformed UTF-16 data. Instead, U+FFFD
is returned in place of the malformed subsequence.

Change-Id: I19d7af03e749fea680fd5d9635439bc9d56558a9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-07 15:00:36 +01:00
Frederik Gladhorn
a1fe728fa5 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	src/gui/kernel/qguiapplication.cpp
	src/plugins/platforms/android/androidjnimain.cpp
	src/plugins/platforms/android/qandroidplatformintegration.cpp
	src/plugins/platforms/android/qandroidplatformintegration.h
	src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/sql/doc/src/sql-driver.qdoc
	src/widgets/widgets/qtoolbararealayout.cpp

Change-Id: Ifd7e58760c3cb6bd8a7d1dd32ef83b7ec190d41e
2014-02-07 13:07:25 +01:00
Thiago Macieira
125bb81bef Fix compilation after b0afad8f0b
That commit made QString::toXxx (8-bit) functions use C++11 ref
qualifiers, so we need to match it here.

Change-Id: I45b50464d36f858d012b12e0cb511aae347ddb6f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2014-02-07 04:47:12 +01:00
Giuseppe D'Angelo
8cbe52d581 Long live QStringIterator!
UCS-4 iterator over a QString.
Kept private for now so we can still work on the API.

Done-with: Thiago
Change-Id: I377f8bb1921e591ee3292c08c3e097fb6bc7f0c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-07 04:47:04 +01:00
Thiago Macieira
b2d5e7805a Add QString::fromUtf16 with char16_t and fromUcs4 with char32_t
Because they make sense. I'm even thinking that the char16_t version
should get a QString implicit constructor. Maybe both encodings.

Change-Id: Ifffc61dd890795fbbbd5f7cb5efb3e6287d1270e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-02-07 04:47:04 +01:00
Gabriel de Dietrich
b1714aec51 Cocoa: Allow frameless NSWindow child QWindows
Showing, moving and resizing

Contrarily to what an NSWindow does to its NSViews, child NSWindows need
to be explicitly shown and hidden, and clipped if the parent NSWindow
changes geometry. Also, hiding an NSWindow will not hide its child
windows. This needed to be managed manually, adding 2 additional states
to QCocoaWindow to reflect whether a child window has been clipped out by
any ancestor geometry change, or hidden by any ancestor being hid. Also,
ordering out an NSWindow will remove it fromm its parent's child windows
array, making necessary to maintain a parallel list of child windows in
QCocoaWindow.

Stack order

Although child NSWindows can be ordered relatively to each other, they
need to be added again to be moved lower in the window stack. This also
means the windows above it need to be added on top.

Key (focus) status

One of the remaining issues, is to make sure the top level window keeps
the "key status" while still forwarding key events to the child window.

Keeping same event propagation

This use case is best illustrated with undocking QDockWidgets (if these
are child NSWindows). The main issue is to make sure the QDockArea will
get the mouse events right after undocking a dock widget. We used a similar
workaround as the "key status" problem, and manually forward the mouse
events to the dock area's QWindow.

Manual test, by Morten Johan Sørvig, included.

Task-number: QTBUG-33082
Task-number: QTBUG-22815
Change-Id: I50e34936fb82bff013e99f4bcb3bd0db0704c6ae
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2014-02-05 23:12:50 +01:00
J-P Nurmi
65bd80ebfc QTabWidget: fix moving of the current tab
Task-number: QTBUG-36455
Change-Id: I38687283d60fe38a4b586b064d5ddd4ed3be06b6
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Ivan Komissarov <ABBAPOH@me.com>
2014-02-05 23:04:04 +01:00
John Layt
75aef26c27 QPageSetupDialog - Add manual dialog test
Add QPageSetupDialog to the manual dialog test.

Change-Id: I5a7a4fedf1fe3ba074891eaed84efaa1c173e620
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-02-05 19:34:10 +01:00
John Layt
5af95d077b QPrinter - Fix Printer Selection option on Windows
Make the printer selection option api public on Windows to be
consistent with Mac, and with the print program api which is already
public.

Change-Id: I3da9684288348eaa43276ca8534a1d5809f7027b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-02-05 19:34:03 +01:00
John Layt
27c33a8f7a QPrintEngne - Fix PPK_Creator
Add support to the Mac and Windows print engines to preserve the
creator name when switching between native and pdf format.

Change-Id: Ie036af3140f24d8e34aa886f091384f93aa0157b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-02-05 19:33:59 +01:00
John Layt
0ee72b09fd QPrintEngine - Fix PPK_CollateCopies
Mac supports Collate Copies using native api, so add support.  Note
this is mostly only useful for setting the print dialog default, as
Mac supports server-side multiple copies so the app will never need to
collate the copies itself.

Change PDF and Windows to default to collate true to match Mac as this
is the behavior users expect.

Task-number: QTBUG-27724
Task-number: QTBUG-35251
Task-number: QTBUG-22144

Change-Id: Ia43dbc260b3a71aa5b267cca54c168ffbea794fc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-02-05 19:33:54 +01:00
John Layt
27473f19bb QPrintEngine - Fix PPK_DocumentName
Add support to the Mac print engine for set/get the Document Name using
the Job Name setting. Our documentation states this is one use that the
document name will be put to so is appropriate to be used.

Change the Windows print engine to default to a blank Docuemnt Name
consistent with the other print engines. If still blank when printing
then use a default value.

Task-number: QTBUG-27724
Task-number: QTBUG-22144

Change-Id: If590811b5720e6f759eabc290b578b94e221f9f4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-02-05 19:33:50 +01:00
John Layt
053bee8b80 QPrinter - Clean up Print Engine Key defaults and tests
The PrintEngine keys are not consistently treated across the platforms
and are not properly tested.  Start the process of making the print
engines behave consistently by documenting and testing the current
behavior. Ensure all unsupported features return a consistent
default value.

The auto test for valuePreservation() has been flaky depending on the
platform and installed printers so remove it and replace it with more
complete testing.  If no native printers available then don't test
the native engines.

Fixes for the individual inconsistent keys will follow.

Task-number: QTBUG-26430

Change-Id: Iab914d7e0a5ae4a2cdc24c8645751f0910cf440c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-02-05 19:33:42 +01:00
Eskil Abrahamsen Blomfeldt
35579f6fe7 Support empty inline elements in block tags in QTextDocument
This fixes the following case:

<blockquote>
<span />Foobar
</blockquote>

Qt would see the end of <span>, and consider the current block
tag as closed, thus resetting the block format, thus losing the
margin set for the current block (due to blockquote).

If you do

<blockquote>
<span>Foo</span>Foobar
</blockquote>

instead, then the same would not happen, since hasBlock is set
to false when we append text to the current inline node.

[ChangeLog][QTextDocument] Add support for empty inline elements
in block tags.

Task-number: QTBUG-33336
Change-Id: Ic566edfec96cb8d44d1c02932bb195bc921d1580
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-02-05 09:10:25 +01:00
Andy Shaw
060b853a2f Actually print when the tester pushes the print button
Change-Id: I5c995938a74f720be5beb33160488ec1ec73c0ff
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-02-05 08:51:55 +01:00
Jake Petroules
fdef360bad QFileSelector: correct the macros for Apple platforms.
This fixes a serious regression from
7d72516b52.

[ChangeLog] QFileSelector: the identifier for OS X has been changed back
to 'osx' from 'mac', and 'mac' and 'darwin' have now been added as
selectors for Darwin OS (which is the base of both OS X and iOS).

Task-number: QTBUG-35073
Change-Id: I83183e34c5a697338cc1ddcac33a41bd379ded12
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2014-02-04 19:36:58 +01:00
Nils Jeisecke
6894bc0f3f Fix sorted QSortFilterProxyModel filter update
When changing a filter so that a previously empty proxy model becomes
populated sorting was not applied correctly.

This was caused by using mapToSource for getting source_sort_column
from proxy_sort_column. For an empty proxy model this won't work because
no valid proxy index can be created in this case.

We now directly use the root index column mapping instead by doing
essentially the same as QSortFilterProxyModelPrivate::proxy_to_source
but without the sanity checks needed for external use.

The sorting feature of QSortFilterProxyModel has always assumed that
the number of columns is specified by columnCount(QModelIndex()) so
the behavior doesn't change.

[ChangeLog][QtCore][QSortFilterProxyModel] Fixed sorting when a
previously empty proxy model becomes populated because of a change in
the filter.

Task-number: QTBUG-30662
Change-Id: I21322122e127889dfadc02f838f0119ed322dcab
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2014-02-03 22:12:20 +01:00
Bastiaan Veelo
5e99b07a07 Fix setWindowFlags() for QMdiSubWindow.
It was impossible to hide/show the close button after a QMdiSubWindow
was created.

Task-number: QTBUG-9933
Task-number: QTBUG-27274

[ChangeLog][QtWidgets][QMdiSubWindow] Fixed setWindowFlags() for QMdiSubWindow.

Change-Id: I7db9a1bef5ba8a8ace729acb85682c8b3de9c33c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2014-02-01 15:50:26 +01:00
Christian Loose
f40c28f915 Q(Plain)TextEdit: Add find() overload with QRegExp
Add overloads to the find() methods in QPlainTextEdit and QTextEdit
that find the next occurrence matching the passed regular expression.

These are convenience methods that eliminate the need to use the
document() method and the need to handle the QTextCursor return value.

[ChangeLog][QtWidgets][QPlainTextEdit] Added find method overload using QRegExp

[ChangeLog][QtWidgets][QTextEdit] Added find method overload using QRegExp

Change-Id: Ia6139b771e3ae4ca02e4b8ea7fde19e5dc71b9d8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2014-01-31 21:51:35 +01:00
Friedemann Kleint
62a3aaf3f1 Fix MSVC-warning about unused variable eventdispatcher.
Change-Id: Ic7c12f16c310cc681bba39a7969de235afcf0f44
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2014-01-31 10:21:50 +01:00
Allan Sandfeld Jensen
5f59207bd3 Optimize drawing to and from generic formats
When drawing to and from the less common formats most of the cpu time
is spend in conversion. The conversion method is rather slow due to
using variable shifts and masks that the compiler does not have a chance
to optimize.

This patch changes the conversion methods to being templates fed by
constexpr methods. This allows the compiler to fully optimize the methods
yielding 2x->5x speedups.

The reliance on constexpr however means the optimized methods are only
used under C++11.

Change-Id: I2ec77c4c1c03f12ee463a694a2b59db0f0b52db1
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-01-31 00:24:48 +01:00
Konstantin Ritt
f26928cccf Allow QTextCharFormat::setFont() to skip unresolved font props
This makes the font merging possible and solves an issue
with the default font properties inheritance when used
in conjunction with QTextFormatCollection.

Change-Id: If8b543c011122dde9f086f5d696df3b042f7b90c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-01-31 00:24:48 +01:00
Friedemann Kleint
f6723cf0d4 tst_qpauseanimation: Fix condition in QEXPECT_FAIL.
introduced by  b0b22e8d49 .

Change-Id: Ia57331ce9373a414f2bc56962412f20ef83bd7ca
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2014-01-30 22:10:22 +01:00
Thiago Macieira
aba30f0234 Replace the type-based QAtomicIntegerTraits with a size-based one
This simplifies the code a lot and avoids silly mistakes where a
specific integer type is missing (such as char16_t).

Change-Id: Id91dfd1919e783e0a9af7bfa093ca560a01b22d1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-01-30 18:06:27 +01:00
Friedemann Kleint
1cc0a18d79 Revert "test: marked tst_qlocale as insignificant on Windows"
This reverts commit b7486591cd.

Conflicts:

	tests/auto/corelib/tools/qlocale/test/test.pro

Task-number: QTBUG-25284
Task-number: QTBUG-36306
Change-Id: If4a335c114302f7af999d7a254e1aa55b2df7176
Reviewed-by: Simo Fält <simo.falt@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-01-30 18:04:59 +01:00
Konstantin Ritt
a5614264d5 Get rid of QGlyphLayout::advances_y
...and thus consume 4 bytes less per glyph and increase the performance a bit.
It seems, the only CTFontGetAdvancesForGlyphs() returns both x and y
advances, though y advances are always equal to 0 for horizontal
orientation and x advances are always equal to 0 for vertical orientation.

Also, rename `advances_x` to `advances` for consistency
and declare QGlyphLayout's data size in a single place.

Change-Id: I56b20f893f8a6feb7aa870e3edbca99dd93ba2e2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-30 12:43:33 +01:00
Mandeep Sandhu
fd5dd27126 Add more specific HTTP error codes to QNetworkReply::NetworkError
A few more HTTP status codes from the 4xx and 5xx series have been
added to QNetworkReply::NetworkError.

For content errors, the following codes have been added:
1. 409 - Resource Conflict
2. 410 - Resource Gone

For server related errors, the following codes have been added:
1. 500 - Internal Server Error
2. 501 - Operation Not Implemented
3. 503 - Service Unavailable

Few of the above codes are quite possible when communicating with REST
based services.

NOTE:
=====
* HTTP error status 400 is interpreted as
QNetworkReply::ProtocolInvalidOperationError.
* QNetworkReply::UnknownServerError is returned for all server related
errors (5xx) not listed above.

[ChangeLog][QtNetwork][QNetworkReply] Added more (specific) HTTP status
codes to NetworkError enum.

Task-number: QTBUG-30880
Change-Id: I9d2a133f6b3869f26710c6eb930dd8b08df31108
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
2014-01-30 07:56:47 +01:00
Konstantin Ritt
b80fcbdba6 Introduce QChar::JoiningType enum and QChar::joiningType() method
This aimed to disctinct joining types "L", "T", and "U" from just "U".
Unicode 6.3.0 has introduced a character with joining type "L" and
Unicode 7.0 will add a few more characters of joining type "L", so
we'll have to deal with it anyways.

[ChangeLog][QtCore][QChar] Added JoiningType enum and joiningType()
 method that deprecates the old QChar::Joining enum and joining() method.

Change-Id: I4be3a3f745d944e689feb9b62d4ca86d1cf371b0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-01-29 23:19:47 +01:00
Allan Sandfeld Jensen
ff70c39ebc Ensure QImage::pixel() on RGB32 images returns valid QRgb values
Currently QImage::pixel() returns the raw underlying pixel values for
RGB32. For all other pixel formats the returned value is either valid
ARGB32 or ARGB32PM.

This patch masks the undefined alpha field in RGB32 so that the return
value is well defined QRgb. It also fixes one test that relied on the
previous behavior.

Change-Id: If37463528268b7419733499d1f7bfd0d1097d21e
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-01-29 19:41:57 +01:00
Allan Sandfeld Jensen
0226795cf3 Round evenly in INV_PREMUL
Currently INV_PREMUL rounds strictly down. While PREMUL rounds evenly.

This patch adds 0x8000 to the intermediate results in INV_PREMUL before
right shifting, thereby achieving even rounding.

The rounding also makes PREMUL(INV_PREMUL()) into an identify operation,
which means we can safely convert ARGB32PM to ARGB32 and back without
ever losing color details. A test is added to verify this.

Change-Id: I1267e109caddcff0c01d726cb5c1c1e9fa5f7996
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-01-29 08:54:55 +01:00
Frederik Gladhorn
85a2653737 Enable running sql model tests in parallel
Each model test gets its own temporary directory, thus there is no problem parallelizing them.

This should reduce the time spent for a testrun of qtbase by around 3 minutes.
When running only the sql tests it saves less since there are no other tests to run in parallel.

=== Timing: =================== TEST RUN COMPLETED! ============================
  Total:                                       4 minutes 43 seconds
  Serial tests:                                4 minutes 42 seconds
  Parallel tests:                              1 second
  Estimated time spent on insignificant tests: (no time)
  Estimated time saved by -j4:                 1 second
=== Totals: 12 tests, 12 passes ================================================

After:

=== Timing: =================== TEST RUN COMPLETED! ============================
  Total:                                       4 minutes 7 seconds
  Serial tests:                                50 seconds
  Parallel tests:                              3 minutes 17 seconds
  Estimated time spent on insignificant tests: (no time)
  Estimated time saved by -j4:                 1 minute 23 seconds
=== Totals: 12 tests, 12 passes ================================================

Change-Id: I355ceed62fae852ad8cd442848e263438afb738e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2014-01-29 06:40:49 +01:00
Olivier Goffart
e13b0cc4a0 Fix usage of QObjectPrivate::connect when q_func() is private.
q_func() which is declared in Q_DECLARE_PUBLIC is usually private.
We should use q_ptr directly in QObjectPrivate::connect, otherwise
it does not compile when trying to access the private q_func

Change-Id: I235165a0994327102dbb31c390c2cafdffe806dc
Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2014-01-29 00:18:15 +01:00