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>
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>
Introduce new virtual QGuiApplicationPrivate::tryCloseAllWindows()
which allows overriding the behavior in QApplication to properly close
the widgets first.
Without this, QGuiApplication closes the widget windows leaving a stale
window handle behind in the associated QWidget which then causes the
application not to terminate since QApplication::shouldQuit() stills
finds the affected widgets to be visible.
Task-number: QTBUG-35986
Change-Id: I19ac4b5a19250ee68d09e461c03dbace458c98e4
Reviewed-by: David Faure <david.faure@kdab.com>
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>
This can be quite useful on some embedded systems to free up
graphics memory when windows are not used. QEglFSWindow already
implements the function.
Change-Id: I79b08efbd3c67d7be34df6a0e12dd184a92d48c5
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Silences warnings in tests that instantiate QGuiApplication multiple
times.
QSYSTEM: tst_QGuiApplication::removePostedEvents() QApplication::regClass: Registering window class 'TabletDummyWindow' failed. (Class already exists.)
QSYSTEM: tst_QGuiApplication::removePostedEvents() UnregisterClass failed for 'TabletDummyWindow' (Class still has open windows.)
Change-Id: I6af2d38a2debd35f4dc0d48c09244dff022bd6b8
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
84be1bd4d3 has changed the stored data type
from QFontEngine to QFontEngine::FaceData. Update the implementation
and revert changing the y_scale sign on non-Mac
(aka fix-up 2d576f79f7).
Change-Id: I4180257bc8f610fb014fd2a2ad6f8fdceece2f13
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Make sure that stacks are properly aligned by replacing CALLBACK with
QT_WIN_CALLBACK so that we don't crash in SSE2 code.
Task-number: QTBUG-36807
Change-Id: I6952d0f252c7b8e481c48521ed1377b7d7510e15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... to defer the decision which protocol will be used on a specific
channel. This is to allow using the SPDY protocol instead of HTTP (to
be implemented in a later commit); which protocol will be used can
only be decided after the SSL handshake.
Change-Id: I6b538320668fe4994438f0095ecdc445677cf0a6
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
... from the private to the public class, because we need to access
these methods from other classes.
Change-Id: I2c5ea84e0f5d3641c1dc02342348f1022d886249
Reviewed-by: Richard J. Moore <rich@kde.org>