The goal of this commit to make the code in the test work:
QCommandLineParser parser;
parser.addOptions({
{ "a", "The A option." },
{ { "v", "verbose" }, "The verbose option." },
{ { "i", "infile" }, "The input file.", "value" },
});
For this, QCommandLineParser needs a version of addOption that can
take a list of options. That's what addOptions() is for.
More importantly, the QCommandLineOption ctors mustn't be explicit.
OTOH, any implicit conversion from QString or QStringList to
QCommandLineOption is also undesirable.
To solve this dilemma, add new QCommandLineOption ctors that just
take one argument and are explicit, and make the existing ctors
implicit. In order to avoid ambiguities, remove the default values
of their resp. 2nd arguments. The new ctors are by intention not
\since 5.4, as they are completely transparent to the user.
Et voila, even better than getopt_long(3).
[ChangeLog][QtCore][QCommandLineParser] Added addOptions() method.
Change-Id: I5e779f3406cd0f6c8ec6ecbf6c8074af226de300
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The "adoption" code is taken from setLabel().
Task-number: QTBUG-40503
Change-Id: Id512b28eb756b4a80e5701e599e2cbdf5346ff62
Reviewed-by: David Faure <david.faure@kdab.com>
It isn't a thorough check of all the mutable methods for detaching, but a start.
Change-Id: I523fd30d3459186654e12fd25c384ed990ab7a00
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
As with many other implicitly shared classes, efficient move semantics
requires setting the d-pointer to nullptr, which then needs to be checked
for in the dtor and the copy assignment operator.
Change-Id: I654d181a1dfdd9a16e2f9fb96b57475cdd0b4561
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Read data into local variables and apply only after a check.
Task-number: QTBUG-40462
Change-Id: Id06060d0d5b0eafc2d303526a86d552ff5747a72
Reviewed-by: David Faure <david.faure@kdab.com>
This is the second and last part of the forward-port of
https://qt.gitorious.org/qt/qt/merge_requests/1281
[ChangeLog][QtConcurrent] run() now optionally takes as its first argument
the QThreadPool to run the task on.
Task-number: QTBUG-17220
Change-Id: I4b46eca6ef7de9cd34dac07e6d4b8ad830426b97
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Background:
It is often necessary/advisable to schedule tasks on thread pools !=
globalInstance(). As Herb Sutter writes in
http://www.drdobbs.com/parallel/use-thread-pools-correctly-keep-tasks-sh/216500409
and the Qt Training Material stresses, tasks you schedule on a (global)
thread pool should be non-blocking, which currently rules out using any of
the QtConcurrent functions for, say, file I/O.
Nonetheless it's often convenient to have thread pools also for file I/O, as
the thumbnail viewer exercise in the Qt Training Material shows. In this
case, you'd use a dedicated thead pool, leaving the global thread pool for
CPU-bound tasks.
Yet, none of the QtConcurrent functions allow to pick the QThreadPool
instance on which to schedule the work created with them.
This patch prepares for them to do so.
This is the first part of the forward-port of
https://qt.gitorious.org/qt/qt/merge_requests/1281.
Implement by using a new QThreadPool* member that defaults to nullptr,
and adding setThreadPool to set this member, then using it in lieu of
QThreadPool::globalInstance() everywhere.
I chose to leave m_pool == nullptr to mean globalInstance() to avoid
creating the global instance whenever a QFuture is created, even if the
future represents the result of a calculation not run on the global thread
pool.
[ChangeLog][QtCore][QFuture] Can now be used with any QThreadPool, not
just globalInstance().
Task-number: QTBUG-17220
Change-Id: I4e1dc18d55cf60141b2fa3d14e2d44a3e9e74858
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
A simple convenience class providing a QWindow that has a
paintEvent and supports opening a painter on itself. It
behaves exactly like QOpenGLWindow in this respect, which is not
surprising since they share the same base class (QPaintDeviceWindow).
QRasterWindow does not however have any OpenGL dependencies and will
be present in -no-opengl builds too.
[ChangeLog] Added QRasterWindow, a thin convenience wrapper for a
QWindow on which a QPainter can be opened.
Done-with: Jorgen Lind <jorgen.lind@digia.com>
Change-Id: I37e82720492945d7b85d5f713eea8d5f7556e511
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
[ChangeLog] Added QOpenGLWindow. This serves as a convenience class for
creating windows showing OpenGL content via an API similar to QGLWidget
and without any widget dependencies.
Done-with: Jorgen Lind <jorgen.lind@digia.com>
Task-number: QTBUG-36899
Change-Id: I52e9bc61acb129dbfd3841b3adeffab2dbcf7f05
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This library was created as a work around for limitations on Windows
Phone 8.0, which will not be supported going forward (Qt 5.4). Therefore,
we no longer need (or want to maintain) this experimental feature and
should remove it from the repository.
Change-Id: Ia417833f9de43e2d3e0940df93625e7d87a555ea
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
QOpenGLWidget is now public.
In addition Qt::WA_AlwaysStackOnTop is introduced to support the
special case of semi-transparent QOpenGLWidget or QQuickWidget on
top of regular widgets.
hellogl_es2 becomes the qopenglwidget example. This example performs
painting both via QPainter and native GL commands and has the OpenGL
widget combined with other, normal widgets.
The widget stack receives some changes when it comes to renderToTexture
widgets like QQuickWidget and QOpenGLWidget. Calling update() will now
result in a paint event, which is essential for QOpenGLWidget since we
want it to behave like a regular widget. The dirty region handling is
extended specially for such widgets due to performance reasons.
(an OpenGL content update must not result in any backingstore painting,
and is thus handled as a different kind of dirtiness)
[ChangeLog] Added QOpenGLWidget. This widget serves as a replacement for QGLWidget.
Task-number: QTBUG-36899
Task-number: QTBUG-40086
Change-Id: Ibf7f82fea99b39edfffd2fc088e7e0eadbca25cf
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
This is in preparation of rewriting the function for efficiency.
Change-Id: Id5c16b984b95d76e1f26d862e3813f75980f44fb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QImage::invertPixels may produce invalid data after inversions of
images with premultiplied alpha, because the inverted colors will be
larger than the alpha.
This patch converts any image with a premultiplied alpha channel to
ARGB32 before inverting the pixels, and then back to the original
format after the inversion.
Support is added for correct inversion of RGBA8888 and RGB30 formats.
Task-number: QTBUG-39901
Change-Id: Ief24c55f495e67ef2ad6429b5b418d02963a64dd
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Use sizes relative to the test widget size; move windows relative
to the top left point of the available screen geometry. Set a window
title on widgets to be able to identify them. The test now
passes on Windows using a 4K monitor.
Task-number: QTBUG-38858
Change-Id: I5df9198e390befeb3ca18796e24180135a084aad
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Use sizes relative to the test window size; move windows relative
to the top left point of the available screen geometry.
The test now passes on Windows using a 4K monitor.
Task-number: QTBUG-38858
Change-Id: Ia8d992f2a9bfa1cb1deacaf918ed0cfff7616959
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
- Show which button was pressed or released
- Render an ellipse proportional to pressure for each point drawn
- Different color for the eraser
- More complete output for each event
- Don't show mouse events by default, just as most tablet applications
can now ignore mouse events on the drawing canvas. But for the
purpose of testing interleaving of tablet and mouse events,
one can give the argument --mouse when starting this program
to show them too, as before.
Task-number: QTBUG-39458
Change-Id: I5e03f1aa748be39d524bd6984ff5d66579787cf9
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
The functions can be used to optimize code that do not need to use
the split results as QString directly.
[ChangeLog][QtCore] QString can now split a string to a list of
QStringRef.
Change-Id: Ic2dc929e1fba82f9a060e37c51068a301cb5b866
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
It is documented to be, and the LanguageChange event is caught and processed.
However, retranslateStrings() uses QProgressDialog::setCancelButtonText(),
which unconditionally sets useDefaultCancelText=true, blocking any further
changes to the button text by subsequent LanguageChange events.
The fix is to use extracted QProgressDialogPrivate::setCancelButtonText()
which - quite intentionally - doesn't set useDefaultCancelText.
Task-number: QTBUG-40504
Change-Id: I6e701deda10c454cb088c0b0778ac2d6adff574a
Reviewed-by: David Faure <david.faure@kdab.com>
The associated test has unearthed that setBar() fails to make the new bar a child
of the progress dialog. This will be fixed in a separate commit.
Task-number: QTBUG-40502
Change-Id: I2d09ebb07ae6395449a4efe38a638df831eebdd7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: David Faure <david.faure@kdab.com>
On Linux for example Orca gets confused when showing a dialog that is a
child of another widget since it would show up twice in the hierarchy.
Task-number: QTBUG-39444
Change-Id: I84773ecc3d6774a652dbeb29ad201779f5b3191c
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
This patch adds support for binding RGB30 images as textures, and as
internal format of framebuffer objects. Together with the
QOpenGLPaintDevice
this provides support for rendering to and from RGB30 in full precision.
[ChangeLog][QtGui][QOpenGLFramebufferObject] Support 10-bit per color
channels formats as the internal framebuffer format, making it possible
to render in that precision.
Change-Id: I06de2d12dfe1c1adc466d574fdffbc77f88f4f16
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
[ChangeLog][QtCore][QByteArray] Fixed a bug that would cause QByteArray
to stop converting toUpper or toLower at the first embedded null
character.
Change-Id: Ia369037206617813d86a8f1489589243c82aa51b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Use the built-in hex, showbase manipulator to format the number in
hex. Also, apply nospace() only once.
Change-Id: Id4b3d5f082ad13f52c8711408d7ec609bec3a621
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Export the former qMessageFormatString() as qFormatLogMessage(). This
allows custom message handlers to format their messages just like the
default message handler, taking qSetMessagePattern() /
QT_MESSAGE_PATTERN into account.
The method should arguably not add the '\n' at the end, which a follow
up commit will fix.
Change-Id: Ib2a9cfda91473df079daf03bf3197e6ac63e013e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
all else being equal, items with a higher numerical priority will appear
first in the result.
Change-Id: I4ee37ff404a53c4152a1e4fc2fc3c23ef525234d
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
It allows to create a QJsonObject instance in C++ by using
initializer list of pairs QString QJsonValue, for example:
QJsonObject o = {{"property1", 1}, {"property2", 2}};
[ChangeLog][QtCore][QtJson] QJsonObject now supports
C++11 initializer lists.
Task-number: QTBUG-26606
Change-Id: I67af881e175f427e563e685336c48a5f8466b476
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Introduce function QMdiSubWindowPrivate::storeFocusWidget()
to store focus widget and call this when de-activating a
sub window. Change restoreFocus() to return a bool and call
it from QMdiSubWindowPrivate::setActive().
Task-number: QTBUG-38378
Change-Id: I18dbe66ce85213ca5b4907b5a09126544415351a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This function has been inlined in commit 4f50be8d,
but wasn't removed.
Change-Id: I1a4eb7399ab2dd87a9fb15c4c886004d777487a8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
On supported platform, allow to show a backtrace by using
%{backtrace} or %{backtrace depth=N separator="|"}
[ChangeLog][QtCore][Logging] QT_MESSAGE_PATTERN can include a
backtrace using %{backtrace}
Change-Id: Ib00418c070d3bd6fe846dc04bf69fa91ba64f9cd
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
If the test fails here, output the values actually used in comparison.
Change-Id: Ie4ed5ebdf1951c02b89a9648aee50a99d0bb0628
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Cost of a type lookup for core built-in types is really small, just few
cpu instructions, but the benchmark was testing create() and destroy()
functions (in a different fashion) which by definition allocate and
de-allocate memory. These memory operations are significantly more
expensive which obfuscate the results.
Change-Id: I33c679f57e6c2b57e98328f076dfe249ab7bcde8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Stephen Kelly <steveire@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is much more useful than the URL "file:", it allows to use
"empty path" and "empty URL" for the same meaning (e.g. not set).
QFileDialog actually uses "file:" though, as the URL for the
"My Computer" item in the sidebar. This patch preserves that.
[ChangeLog][QtCore][QUrl] QUrl::fromLocalFile now returns an empty URL
if the input string is empty.
Change-Id: Ib5ce1a3cdf5f229368e5bcd83c62c1d1ac9f8a17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The "rbit" instruction requires ARMv6T2 or higher. This was found in the
CI when building the imx6 target:
Compiler: arm-poky-linux-gnueabi-g++
Flags: -mfloat-abi=hard -mfpu=neon
Errors from the assembler:
{standard input}:3078: Error: selected processor does not support ARM mode `rbit r3,r3'
{standard input}:7341: Error: selected processor does not support ARM mode `rbit ip,ip'
That compiler defaults to ARMv5T. That's obviously wrong for an i.MX 6,
which is a Cortex-A9 (ARMv7), but the correction applies for older
processors.
Change-Id: I56c276fa411977dd7cd867d62adf021e4909302c
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>