qmake: fix const correctness

Partial cherry-pick of
https://qt.gitorious.org/qt/jpnurmi-qt/commit/8c4ef19

Task-number: QTBUG-21910
Change-Id: Ieb833a977fc00d2637f8419278698c82b6086e2f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
qmake: remove bogus comment

the respective code was removed in 375edf7

Change-Id: Ie31ef4bc8970b5396f50f1c4963f378df816242a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Allow the platform to specify a press and hold delay.

Press and hold is an interaction available on many platforms,
particularly when touch is involved. In Qt Quick this is exposed to the
user via MouseArea::onPressAndHold. This value should not be hard-coded,
but rather use a platform-specified default. This commit adds the
low-level hooks necessary for that to happen.

Task-number: QTBUG-24793
Change-Id: I621a8ac9de66b881e34336228056bffbb6306a70
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Add Asset Locations to QStandardPaths::DataLocation

The locations of UI assets are deployed to is being added as a read-only
location under DataLocation.

As such a path is located differently on certain mobile platforms, such
as Android and BlackBerry, having an entry in StandardPaths will make it
easier to write cross-platform code.

Change-Id: I4533c90ed7157725a8604591595b350c7f616723
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Remove all "old atomic" code from Qt

The new atomic code was introduced in Qt 5.0. The platforms that did not
get ported were announced as deprecated in Qt 5.2. The code is now
removed in Qt 5.3.

The status for the platform/compiler/OS combinations affected is:
 * Linux with GCC or Clang: still compiles on all platforms
   (via qatomic_cxx11.h or qatomic_gcc.h)
 * INTEGRITY with Green Hills compiler: no longer compiles
 * Solaris on UltraSPARC, with Sun Studio: no longer compiles
 * AIX on POWER5 or 6, with IBM Visual Age: no longer compiles
   (probably did not compile Qt 5.0 either)
 * VxWorks in kernel mode: no longer compiles

[ChangeLog][General] Support for the following platforms has been
removed, due to lack of interest in updating support: INTEGRITY,
VxWorks, Solaris on UltraSPARC (with the Sun Studio compiler suite), AIX
on POWER processors (with IBM Visual Age compiler suite).

Change-Id: I8a961385fd95011c016b2b1eec52034794dae3e1
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Remove the files building AVX code

This feature was never completely implemented. Sure, it's nice to
build the SSE2 + SSSE3 code with the VEX prefix, which results in
better code. But the leap isn't that big anyway.

This is the first step to removing the runtime detection for the
drawhelpers. They create timebombs when we use inline functions.

Task-number: QTBUG-30440
Change-Id: Ic53b2cf5261106a1c940d4a36eb6111b7d998be1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Move-enable QSignalBlocker

When QSignalBlocker was reviewed, move semantics were asked for.
This patch add them.

This makes QSignalBlocker usable as a by-value argument (to transfer
control of signal blocking into a function) as well as as a return
value (to transfer control of signal blocking out of a function).

Change-Id: I714aa2a283bb33dba76e860649e88ed202e913c5
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
tst_QObject: separate QSignalBlocker tests

tst_QObject is getting big, so make a separate test for QSignalBlocker,
but leave parts of signalsBlocked() in tst_QObject as that seemed to
have been the only check for blockSignals(true) actually blocking signal
emission.

Change-Id: I1cfac035e0e39203eea8626d43f316cc6244ee86
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
qmake vcxproj: Provide saner defaults for certain WinRT options

The default values for PCH, the -ZW switch, and CharacterSet aren't
ideal for WinRT projects, so adjust these accordingly.

Task-number: QTBUG-35328
Change-Id: I78021d0785fa84e15b1f17264daa599a9418f92e
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
QLineEdit: hide placeholder text when h-centered & focused

[ChangeLog][QtWidgets][QLineEdit] A blinking cursor in the middle
over horizontally centered placeholder text looks bad. Thus,
horizontally centered content is now considered as an exception
and the placeholder text is hidden when the line edit is focused.

Task-number: QTBUG-31669
Change-Id: I17aa1e6656673f81545a8437f90814b188ad484a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Moved d3dcompiler from src/angle to src/angle/src

Even though it is not really part of the angle implementation, having it
in source is more consistent with the rest of Qt and makes browsing the
code easier.

There was also an issue, that only a debug build was done when calling
nmake or jom. While moving the implementation this issue was fixed by
including config.pri to d3dcompiler's .pro file.

Change-Id: I3e3630865c94adbe1a1f1af2ccfc2bcb046002a8
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Automatically create QPainterPathStroke based on QPen

Based a recent problem where one property of QPen was not properly copied
to QPainterPathStroke, I believe we should add a method to automatically
create a QPainterPathStroke based on all the relevant information in a QPen.

This patch adds a constructor that automatically does so.

Change-Id: Id2849b36426f2e3b06b4b508292063a0917ca61c
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
QNX: Fix focus handling for secondary screen

This patch removes the activaton aand deactivation of a window when we get the window group
activated event from the navigator. This event is sent to both the primary and secondary screen
and does not state if a window should be active from a Qt perspective.
A window should only be active if it has screen keyboard focus.

Change-Id: Ibbed0dd76a21d86f4b580265f996357a8eef5192
Reviewed-by: Roger Maclean <rmaclean@qnx.com>
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Fix erroneous exclusion of classes from related meta objects in moc

Assume an unrelated class that declares an enum and uses Q_ENUMS. Consider
then a class that uses UnrelatedClass::Enum as a Q_PROPERTY. We used to
include UnrelatedClass in the primary class's related meta objects, in order
to support use-cases like
    obj->setProperty("enumProperty", "ValueOfEnumAsString");

If however moc happens to see Q_DECLARE_METATYPE(UnrelatedClass::Enum), then it
would exclude it from the related meta objects, which would silently break the
string based enum value conversion. This was meant as an optimization, but it
isn't apparent to the developer why sometimes the string conversion would
work and sometimes not (depending on whether somebody declares that macro).
This also becomes visible in QML, which relies on the same embedded type
information for enum assignments.

This patch removes that check in moc's code generator and cleans up the code a
little. However always including the prefix of Q_PROPERTY(SomePrefix::Enum ...)
is not correct either, because it may be that SomePrefix is a namespace, which
would cause compilation issues. Therefore we limit the inclusion of related
meta objects only to Q_OBJECT decorated classes the moc has seen, and for these
we save the fully qualified name in the related meta objects array (for QTBUG-2151).

While this patch makes the previous workaround for namespace issues by using a
Q_DECLARE_METATYPE not workable anymore, by saving the fully qualified name we
are making a hopefully sufficient effort to not require a workaround in the
first place. There's always the new workaround of fully qualifying the type in
Q_PROPERTY.

One side-effect of this change is that in the autoPropertyMetaTypeRegistration
test of tst_moc, the CustomQObject for Q_PROPERTY(CustomQObject::Number
enumValue ...) is now a related meta object, and therefore when querying for
the type of this property via QMetaProperty::userType(), we are now aware of
this being an enum and try to resolve CustomQObject::Number via
QMetaType::type(qualfiedName). As there is no guarantee for this to succeed, we
must now also do what is done in the non-enum code path in ::userType(), which
is to call the moc generated type registration function.

Task-number: QTBUG-33577
Task-number: QTBUG-2151
Change-Id: Ibf20e7421cba464c558a25c76a7e1eef002c6cff
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
tst_qlinedit: Create a new test widget on demand for each test.

The test used a member testWidget that was cleared and reset after each
test, which caused focus fights and side effects. The widget is now
created and shown only when necessary.

Change-Id: I0dc635e9d4cdf4f899994b88206bb0125526f6df
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Implement support for ref-qualified QString::toLatin1 & friends

This is the first step in implementing an in-place conversion of QString
to QByteArray. This requires ref-qualifiers in member functions so we
know that we have an rvalue QString.

Converting from UTF-16 to Latin1 always requires half the memory.

For conversion from UTF-16 to UTF-8, the typical string will also need
the same memory or less: characters from U+0000 to U+007F consume one
fewer byte; characters from U+0080 to U+07FF and from U+10000 to
U+1FFFFF occupy the same space in UTF-8 and UTF-16; it's only the ones
from U+0800 to U+FFFF that consume more space in the UTF-8 string.

For the locale's 8-bit codec, we can't be sure and the code (currently)
needs to go through QTextCodec anyway.

This requires a #define set before #include'ing "qstring.h". However,
since qstring.h is included by the QtCore PCH, we need an extra qmake
compiler without the PCH flags to compile this .cpp.

After this change, the distribution of calls in QtCore, Network, Gui,
and Widgets is as follows:

                  const &               &&
 toUtf8           31 (74%)              11 (26%)
 toLatin1         79 (77%)              24 (23%)
 toLocal8Bit      26 (16%)              138 (84%)

Change-Id: Idd96f9ddb51b989bc59f6da50054dd10c953dd4f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Improve the Latin1 conversion in QString a little

First, use Qt::Uninitialized, since we're about to overwrite the memory
anyway with the new Latin 1 string.

Second, move the actual body of the conversion to a static void
function, which seems to improve code generation a little and, of
course, paves the way for the in-place conversion.

Change-Id: Iaed99ba1e52facad676510aa98443223e188d70a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Add the UTF16-to-Latin1 in-place converter

This is only possible for two important reasons:

1) QString and QByteArray d pointers are both done with QArrayData and
   that class does not care that the alignof(T) changes from 2 to 1,
   so we can give the pointer from QString to QByteArray
   (after adapting the allocated size, which is now double)

2) conversion from UTF16 to Latin1 always has fewer bytes (exactly half)

Change-Id: I17b2690c910f3de8db55156c6d6b5f55be06d827
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
PCH stands for "precompiled header", not "prefix"

Change-Id: Ied8148be931992247e446719a0eaeec0dc868330
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
QNetworkCookie: allow cookies for IPv4 domains

If the domain is an IP address, we should not do any magic regarding
leading dots etc.

Task-number: QTBUG-35022

Change-Id: I7722de4e6027666dde27e9e37b6353e3da775d94
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Richard J. Moore <rich@kde.org>