Modern websites use around 15 hosts on average so the limit of 5 DNS
looks meant that most non-trivial sites have to wait for at least one
unneeded round trip.
Task-number: QTBUG-30866
Change-Id: I584dd46c247e0413b2ed88dd66f111cff08ff987
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Implemented the use of the new QDnsLookup property "nameserver".
On the Linux platform, we can specify both IPv4 and IPv6 addresses
for the nameserver.
On Windows since we are using DnsQuery_W(), which does not have a
way of accepting IPv6 addresses, passing IPv6 nameserver address
is not supported.
On OSX/BSD platforms, specifying IPv6 addresses for nameserver
require access to the __res_state_ext structure which is in a
private header of libresolv (this header is different for BSDs and
OSX). If this feature has to be enabled in the future, we have to
figure out a way to access this struct by either accessing the
private header or by specifying one of our own. Currently, I'm
disabling it till such a solution is arrived at.
Nameserver support on different platforms:
Platform | IPv4 | IPv6
-------------+---------------+---------------
Linux/X11 | supported | supported
-------------+---------------+---------------
Windows | supported | not supported
-------------+---------------+---------------
OSX | supported | not supported
-------------+---------------+---------------
WinRT | not supported | not supported
-------------+---------------+---------------
Others | supported | not supported
| (not tested) |
-------------+---------------+---------------
Task-number: QTBUG-30166
Change-Id: Iedbddf15b9a62738ce4c2cfa0fce051514d64766
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
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>
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>
[ChangeLog][QtCore][Atomic support]Added more operations to the atomic
classes, including operator T(), operator=(T), operator++,
operator--. For the QAtomicInteger, bit-manipulation operations are
also provided, both in operator and in fetchAndXxxYyyyyy modes.
Change-Id: I39c07be74e15e0a48f9e931f4342b182004dee1a
Reviewed-by: David Faure <david.faure@kdab.com>
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>
ICC 8 and 9 are positively ancient. I doubt anyone is using them for
Qt, let alone Qt 5. ICC 11 through 13 haven't supported OS X.
ICC now masquerades as Clang, so we need to let qmake and
qcompilerdetection.h know about it.
Change-Id: If0d2bd8b6a4a45250c15c9472c062effc76f17de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Apparently it doesn't like the text.
Change-Id: If8e14df84f0d9915018eac94df16bf1b679155e0
Reviewed-by: Keith Gardner <kreios4004@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The QByteArray version was missing the overflow check that the other
versions had.
Change-Id: I03cd92e5e5a84c038bee1f1ee217e93e9d9a675a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
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>
The properties that make up the hash value are chosen to be the same as those
that make up QFontDef's op<() and op==(). Indeed, the implementation for QFont
simply delegates to the one of QFontDef, which has been added for this purpose,
but may prove useful in its own right down the line.
The code would greatly benefit from a qHash(qreal) implementation. Lacking
this, the patch uses multiplication with 10000 and qRound64() to convert
the one floating-point property used in the hash to an integer. This is
probably the right thing to do anyway, to avoid epsilon problems.
[ChangeLog][QtGui][QFont] Added qHash overload for this class.
[ChangeLog][QtCore][QHash] Allowed QFont to be used as a key in QHash/QSet.
Change-Id: I2c1cb5d9da53e26cb2c0f1a7c357731e73eea78e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
When you launch an activity through an intent,
data can be provided back from the activity when it has finished
using onActivityResult() in the activity which launched it.
This is okay for applications, since they can easily create their
own activities, but does not work for libraries that need to
use intents. There is no listener API for activity results which
allow external classes to eavesdrop.
In order to support launching intents from third-party or add-on
libraries, we provide a low-level way to hook into the activity
result event. The corresponding public API will be added to
QtAndroidExtras.
Change-Id: I89417f485e2c0e69028dcccc7c155788346a7417
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
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>
The use of if {} else {} in the macro causes compiler warnings
about "ambiguous 'else'" if qCDebug is used in an if / else without brackets.
Revert to the for loop, but make the variable name less likely
to clash.
This reverts commit bab5f5873680aa3c5a22d94da112aafd2b0b53d3.
Task-number: QTBUG-36605
Change-Id: Ie4b075b63b83b7f8a2ad61437b7bf3e6a6c0177a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
Moving them into QPlatformDialogHelper for the convenience of both
widgets and QtQuick.Dialogs. The main reason is to ensure that
QtQuick.Dialogs does not need to depend on the widgets module, in
order to re-implement the button box concept in a generic dialog.
Change-Id: If400d215338d7cb6dade39d9de60e50b5e7515ef
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Currently, inputMethodQuery() only provides information about the
current paragraph. On some platforms, such as Android, the input method
needs information about the global cursor position, and more of the
surrounding text. Some queries need to pass parameters.
The current inputmethodQuery() implementation does not allow parameters to
be passed. Changing this would require new or modified virtual functions, which
is not possible until Qt 6. Therefore, a completely new mechanism is needed.
Change-Id: Ic64fd90198ade70aa0fa6fa5ad3867dfa7ed763c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
category() returns a const QLoggingCategory so our code does not
compile anymore. Do it differently.
Fix also the Windows error string formatting a bit.
Change-Id: Ie0b6b02947d94b7ccf4a4a57da487dfa8a15709d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
I find the current description of primaryOrientation and orientation
a bit confusing.
Change-Id: I25d77cff2c27c481607903bc1aeb54eacf616718
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
The Qt documentation says that PortraitOrientation is rotated 90 degrees
clockwise relative to LandscapeOrientation. This means that the home
button should be on the right when held in LandscapeOrientation,
therefore, Qt::LandscapeOrientation == UIDeviceOrientationLandscapeLeft.
Without this patch, all QScreen mapping functions are broken.
Change-Id: I2c570cd0307b7fbd59c749d6574dcb258790cfbc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
The code was not creating all of the storage necessary for cubemaps
as well as attempting to bind to the cubemap face targets which is
invalid when using mutable storage - typically on OS X where
EXT_direct_state_access is not available and immutable storage is only
available at all if using an OpenGL 4.1 context.
Change-Id: I4cf84f1b88c90e8359366392b3ccda65669ebfa7
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Pasi Keränen <pasi.keranen@digia.com>
Use FSEvents to monitor changes in the filesystem instead of the kqueue
implementation. This removes the limit of wathed files: kqueue uses a
file descriptor for each file monitored, for which the ulimit was set by
default to 256. Now the OSX implementation on par with the other major
desktop platforms.
Change-Id: I2d46cca811978621989fd35201138df88a37c0fb
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
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>
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>
Added configure test, whether lgmon (liquid graphics performance monitor)
is available. The test is supposed to be positive only for internal
BlackBerry NDKs currently.
Added calls to initialize lgmon and to indicate when an app is ready for
user input.
Change-Id: I5cbc29fb38a86585dcebd14d462436deaa1998aa
Reviewed-by: Wolfgang Bremer <wbremer@blackberry.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
In general QLoggingCategory should be treated as a const object that's
configured by the backend. The only legitimate place where user code
should call setEnabled is in a CategoryFilter ...
[ChangeLog][QtCore][Logging] Make Q_LOGGING_CATEGORY
and Q_DECLARE_LOGGING_CATEGORY return a const object.
Change-Id: I6140442ab48286e05cd3b55064a502bbe6dfb16a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Enums should be named LikeThis, not likeThis, even in private API.
Change-Id: I197f9f888204a7c495364bd09357bfca24146560
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The arguments are all strings, so multi-arg is available without
other changes to the code. Even though insertion of a format placeholder
can be ruled out in the present case, multi-arg should be faster than
a 3-chain of arg() calls.
Change-Id: I8d030227e1bd30c56f1062a0c9dbbaae0143885f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of using Q_STRINGTABLE, use a switch/if construct
to be able to share the string data for "write" and "readwrite".
Change-Id: Ia1c7b8a0f13a809372de2e5a956978dc2d569e92
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
The docs said it supports the feature, but now that we've tried to use
it, we can't. It might have been referring to the non-C++11 extension
from GCC (__thread).
qlogging.cpp(1253): error #303: explicit type is missing ("int" assumed)
static thread_local bool msgHandlerGrabbed = false;
^
Change-Id: I9343cf61bd3b2eacac686e602cc0ffea2d4a7a22
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Mehdi Fekari <mfekari@blackberry.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
By way of templates. This makes the code a lot cleaner.
Change-Id: Ie369561c7631b0d34d76a6852883716cc0aa89d4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This version will parse the string only once and will not do any
memmove. This is more efficient.
Change-Id: I59026ad0fa61cc3f16146bdcd622fc54cbd8a321
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Along with some more helper functions.
There are two more functions used in QIntValidator
Change-Id: I469ef40426cbb73ab515454bd5ecb12d944f5c0a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Those functions do not need any of extra QLocale settings in
QLocalePrivate, so we can move them easily, along with their flags.
It's also very convenient that we can now bypass completely QLocale
when formatting numbers to strings.
Change-Id: I8cae64e8e2056a6b2d716758e4be79f746644732
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
The difference between them was simply whether they operated on QString
or QStringRef. So drop down to what's common between them: a pointer and
a length (or two pointers, but numberToCLocale already operates on a
pointer and a length).
Change-Id: Ie7c8955ac13d6023761e6d3bafe7ab04bd6984e1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
No need to do it in QLocalePrivate::xxxToDouble() because
numberToCLocale() already does it for us. Centralized code = better
code.
Change-Id: Ifecf9119556d4465582212b5be773c18edd13563
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
From before we would activate all QWindows that the user
tapped on, or setVisible were called on. This is wrong
since a QWindow does not have to be a top-level window.
For a non-alien widget application this would mean that
we would send activation events for all widgets that the
user tapped on all the time.
With this patch we do some extra checking before we
tell a QWindow to activate.
Change-Id: I1afe97e5384c36c67fee0bbd070d880bba7528a1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
We need to activate a window on touchesBegan instead of
touchesEnded. The reason we used to do this on touchesEnded was
to delay activating a window in case the user started e.g a
flick. But delaying the activation can cause problems if the app
activates a different window on press. We will then cancel
this out on release since we then raise the pressed window instead.
This is e.g typical when opening popups, and will cause focus to
not be restored properly when later closing the popup again.
Change-Id: I709b2f2e2633c9dc85c2761b0b176cd23c2f6b36
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Sometimes focus object is updated after we get a
callback that the cursor rectangle has changed. And
there is no reason to keep a local reference to it.
Since we also send events to the qApp->focusObject from
UIView_textInput, we now end up more consistent.
Change-Id: I3976175aae4e3f346be9bc5b771ac0fdefc03ae6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>