Merge remote-tracking branch 'origin/5.5' into dev
Change-Id: Idd21ab419588ee8b893649e3227d41c46a32e519
This commit is contained in:
commit
38b5e9f8ba
0
doc/global/template/style/icomoon.eot
Executable file → Normal file
0
doc/global/template/style/icomoon.eot
Executable file → Normal file
0
doc/global/template/style/icomoon.svg
Executable file → Normal file
0
doc/global/template/style/icomoon.svg
Executable file → Normal file
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
0
doc/global/template/style/icomoon.ttf
Executable file → Normal file
0
doc/global/template/style/icomoon.ttf
Executable file → Normal file
0
doc/global/template/style/icomoon.woff
Executable file → Normal file
0
doc/global/template/style/icomoon.woff
Executable file → Normal file
@ -83,18 +83,50 @@
|
|||||||
QGesture subclass.
|
QGesture subclass.
|
||||||
|
|
||||||
To illustrate how a standard gesture can be interpreted by an application, we
|
To illustrate how a standard gesture can be interpreted by an application, we
|
||||||
show the implementation of the \c swipeTriggered() function, which handles the
|
show the implementation of the \c pinchTriggered() function, which handles the
|
||||||
gesture associated with a brushing or swiping motion on the user's display or
|
pinch gesture when the user moves two fingers around on the display or
|
||||||
input device:
|
input device:
|
||||||
|
|
||||||
\snippet gestures/imagegestures/imagewidget.cpp swipe function
|
\snippet gestures/imagegestures/imagewidget.cpp pinch function
|
||||||
|
|
||||||
The QSwipeGesture class provides specialized functions and defines a enum
|
The QPinchGesture class provides properties to interpret the changing
|
||||||
to make it more convenient for developers to discover which direction, if
|
distance between the two touch points as a zoom factor, and the angle delta
|
||||||
any, the user swiped the display. Here, we simply navigate to the previous
|
as a rotation to be applied to the image. The center point between the
|
||||||
image in the collection if the user swiped upwards or to the left; otherwise
|
touch points could be used to drag the image, but in this example we use
|
||||||
we navigate to the next image in the collection.
|
the pan gesture for that purpose.
|
||||||
|
|
||||||
The other gestures are also handled by special purpose functions, but use
|
The \c scaleFactor() is a relative value representing how much the zoom
|
||||||
the values of properties held by the QGesture object passed to them.
|
should change from one event to the next, whereas \c totalScaleFactor()
|
||||||
|
provides the amount of zoom that has been expressed since the gesture
|
||||||
|
began. When the touch points are released and another gesture begins,
|
||||||
|
\c totalScaleFactor() will begin again at 1.0. In this case we store
|
||||||
|
\c totalScaleFactor() into the \c currentStepScaleFactor variable so that
|
||||||
|
it can be used in \c paintEvent() to scale the image. Alternatively it would
|
||||||
|
be possible to simply multiply the stored total scale factor by
|
||||||
|
\c scaleFactor() here in the pinch handler.
|
||||||
|
|
||||||
|
In contrast, \c rotationAngle() represents the amount of rotation since the
|
||||||
|
pinch gesture began, while \c lastRotationAngle() provides the previous
|
||||||
|
value. So it is necessary to subtract in order to get an incremental delta.
|
||||||
|
When the user begins a new pinch gesture, \c rotationAngle() will start
|
||||||
|
from zero, and we want the image to begin to rotate from its current angle.
|
||||||
|
This is achieved by adding the delta to the stored \c rotationAngle (which
|
||||||
|
will be applied in \c paintEvent()). If we simply assigned
|
||||||
|
\c totalRotationAngle() to the stored \c rotationAngle, a new gesture would
|
||||||
|
cause the image to reset to a right-side-up orientation before beginning to
|
||||||
|
rotate again. But it would be possible to store the rotation angle since the
|
||||||
|
gesture began and add it to \c rotationAngle in \c paintEvent(), just as
|
||||||
|
we store the amount of zoom since the gesture began.
|
||||||
|
|
||||||
|
The pan and swipe gestures in this example are also handled in separate
|
||||||
|
functions, and use the values of properties from the QGesture objects
|
||||||
|
passed to them.
|
||||||
|
|
||||||
|
\snippet gestures/imagegestures/imagewidget.cpp paint method
|
||||||
|
|
||||||
|
In \c paintEvent(), scaleFactor represents the zoom level before the pinch
|
||||||
|
gesture began, while currentStepScaleFactor represents the additional zoom
|
||||||
|
factor while a pinch gesture is in progress. But for rotation, only the
|
||||||
|
current rotationAngle is stored. The horizontal and vertical offsets
|
||||||
|
represent the distance that the image has been dragged by the pan gesture.
|
||||||
*/
|
*/
|
||||||
|
@ -77,6 +77,7 @@ bool ImageWidget::event(QEvent *event)
|
|||||||
}
|
}
|
||||||
//! [event handler]
|
//! [event handler]
|
||||||
|
|
||||||
|
//! [paint method]
|
||||||
void ImageWidget::paintEvent(QPaintEvent*)
|
void ImageWidget::paintEvent(QPaintEvent*)
|
||||||
{
|
{
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
@ -93,6 +94,7 @@ void ImageWidget::paintEvent(QPaintEvent*)
|
|||||||
p.translate(-iw/2, -ih/2);
|
p.translate(-iw/2, -ih/2);
|
||||||
p.drawImage(0, 0, currentImage);
|
p.drawImage(0, 0, currentImage);
|
||||||
}
|
}
|
||||||
|
//! [paint method]
|
||||||
|
|
||||||
void ImageWidget::mouseDoubleClickEvent(QMouseEvent *)
|
void ImageWidget::mouseDoubleClickEvent(QMouseEvent *)
|
||||||
{
|
{
|
||||||
@ -138,16 +140,20 @@ void ImageWidget::panTriggered(QPanGesture *gesture)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! [pinch function]
|
||||||
void ImageWidget::pinchTriggered(QPinchGesture *gesture)
|
void ImageWidget::pinchTriggered(QPinchGesture *gesture)
|
||||||
{
|
{
|
||||||
QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags();
|
QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags();
|
||||||
if (changeFlags & QPinchGesture::RotationAngleChanged) {
|
if (changeFlags & QPinchGesture::RotationAngleChanged) {
|
||||||
rotationAngle += gesture->rotationAngle() - gesture->lastRotationAngle();
|
qreal rotationDelta = gesture->rotationAngle() - gesture->lastRotationAngle();
|
||||||
qCDebug(lcExample) << "pinchTriggered(): rotate to" << rotationAngle;
|
rotationAngle += rotationDelta;
|
||||||
|
qCDebug(lcExample) << "pinchTriggered(): rotate by" <<
|
||||||
|
rotationDelta << "->" << rotationAngle;
|
||||||
}
|
}
|
||||||
if (changeFlags & QPinchGesture::ScaleFactorChanged) {
|
if (changeFlags & QPinchGesture::ScaleFactorChanged) {
|
||||||
currentStepScaleFactor = gesture->totalScaleFactor();
|
currentStepScaleFactor = gesture->totalScaleFactor();
|
||||||
qCDebug(lcExample) << "pinchTriggered(): zoom by" << gesture->scaleFactor() << "->" << currentStepScaleFactor;
|
qCDebug(lcExample) << "pinchTriggered(): zoom by" <<
|
||||||
|
gesture->scaleFactor() << "->" << currentStepScaleFactor;
|
||||||
}
|
}
|
||||||
if (gesture->state() == Qt::GestureFinished) {
|
if (gesture->state() == Qt::GestureFinished) {
|
||||||
scaleFactor *= currentStepScaleFactor;
|
scaleFactor *= currentStepScaleFactor;
|
||||||
@ -155,6 +161,7 @@ void ImageWidget::pinchTriggered(QPinchGesture *gesture)
|
|||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
//! [pinch function]
|
||||||
|
|
||||||
//! [swipe function]
|
//! [swipe function]
|
||||||
void ImageWidget::swipeTriggered(QSwipeGesture *gesture)
|
void ImageWidget::swipeTriggered(QSwipeGesture *gesture)
|
||||||
|
@ -93,13 +93,13 @@ class MyClass : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
|
Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
|
||||||
Q_ENUMS(Priority)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyClass(QObject *parent = 0);
|
MyClass(QObject *parent = 0);
|
||||||
~MyClass();
|
~MyClass();
|
||||||
|
|
||||||
enum Priority { High, Low, VeryHigh, VeryLow };
|
enum Priority { High, Low, VeryHigh, VeryLow };
|
||||||
|
Q_ENUM(Priority)
|
||||||
|
|
||||||
void setPriority(Priority priority)
|
void setPriority(Priority priority)
|
||||||
{
|
{
|
||||||
|
@ -376,38 +376,37 @@ Q_PROPERTY(QString title READ title WRITE setTitle USER true)
|
|||||||
class MyClass : public QObject
|
class MyClass : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(Priority)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyClass(QObject *parent = 0);
|
MyClass(QObject *parent = 0);
|
||||||
~MyClass();
|
~MyClass();
|
||||||
|
|
||||||
enum Priority { High, Low, VeryHigh, VeryLow };
|
enum Priority { High, Low, VeryHigh, VeryLow };
|
||||||
|
Q_ENUM(Priority)
|
||||||
void setPriority(Priority priority);
|
void setPriority(Priority priority);
|
||||||
Priority priority() const;
|
Priority priority() const;
|
||||||
};
|
};
|
||||||
//! [38]
|
//! [38]
|
||||||
|
|
||||||
|
|
||||||
//! [39a]
|
//! [39]
|
||||||
class QLibrary : public QObject
|
class QLibrary : public QObject
|
||||||
{
|
{
|
||||||
...
|
Q_OBJECT
|
||||||
Q_FLAGS(LoadHint LoadHints)
|
|
||||||
...
|
|
||||||
//! [39a]
|
|
||||||
|
|
||||||
//! [39b]
|
|
||||||
...
|
|
||||||
public:
|
public:
|
||||||
|
...
|
||||||
|
|
||||||
enum LoadHint {
|
enum LoadHint {
|
||||||
ResolveAllSymbolsHint = 0x01,
|
ResolveAllSymbolsHint = 0x01,
|
||||||
ExportExternalSymbolsHint = 0x02,
|
ExportExternalSymbolsHint = 0x02,
|
||||||
LoadArchiveMemberHint = 0x04
|
LoadArchiveMemberHint = 0x04
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(LoadHints, LoadHint)
|
Q_DECLARE_FLAGS(LoadHints, LoadHint)
|
||||||
|
Q_FLAG(LoadHints)
|
||||||
...
|
...
|
||||||
//! [39b]
|
}
|
||||||
|
//! [39]
|
||||||
|
|
||||||
|
|
||||||
//! [40]
|
//! [40]
|
||||||
|
@ -207,7 +207,7 @@
|
|||||||
section of the class. The required \c READ function is named \c
|
section of the class. The required \c READ function is named \c
|
||||||
priority, and we include a \c WRITE function named \c setPriority.
|
priority, and we include a \c WRITE function named \c setPriority.
|
||||||
The enumeration type must be registered with the \l {Meta-Object
|
The enumeration type must be registered with the \l {Meta-Object
|
||||||
System} using the Q_ENUMS() macro. Registering an enumeration type
|
System} using the Q_ENUM() macro. Registering an enumeration type
|
||||||
makes the enumerator names available for use in calls to
|
makes the enumerator names available for use in calls to
|
||||||
QObject::setProperty(). We must also provide our own declarations
|
QObject::setProperty(). We must also provide our own declarations
|
||||||
for the \c READ and \c WRITE functions. The declaration of MyClass
|
for the \c READ and \c WRITE functions. The declaration of MyClass
|
||||||
@ -228,18 +228,18 @@
|
|||||||
|
|
||||||
In the example, the enumeration type that is the property type is
|
In the example, the enumeration type that is the property type is
|
||||||
declared in MyClass and registered with the \l{Meta-Object System}
|
declared in MyClass and registered with the \l{Meta-Object System}
|
||||||
using the Q_ENUMS() macro. This makes the enumeration values
|
using the Q_ENUM() macro. This makes the enumeration values
|
||||||
available as strings for use as in the call to \l{QObject::}{setProperty()}. Had
|
available as strings for use as in the call to \l{QObject::}{setProperty()}. Had
|
||||||
the enumeration type been declared in another class, its fully
|
the enumeration type been declared in another class, its fully
|
||||||
qualified name (i.e., OtherClass::Priority) would be required, and
|
qualified name (i.e., OtherClass::Priority) would be required, and
|
||||||
that other class would also have to inherit QObject and register
|
that other class would also have to inherit QObject and register
|
||||||
the enumeration type there using the Q_ENUMS() macro.
|
the enumeration type there using the Q_ENUM() macro.
|
||||||
|
|
||||||
A similar macro, Q_FLAGS(), is also available. Like Q_ENUMS(), it
|
A similar macro, Q_FLAG(), is also available. Like Q_ENUM(), it
|
||||||
registers an enumeration type, but it marks the type as being a
|
registers an enumeration type, but it marks the type as being a
|
||||||
set of \e flags, i.e. values that can be OR'd together. An I/O
|
set of \e flags, i.e. values that can be OR'd together. An I/O
|
||||||
class might have enumeration values \c Read and \c Write and then
|
class might have enumeration values \c Read and \c Write and then
|
||||||
QObject::setProperty() could accept \c{Read | Write}. Q_FLAGS()
|
QObject::setProperty() could accept \c{Read | Write}. Q_FLAG()
|
||||||
should be used to register this enumeration type.
|
should be used to register this enumeration type.
|
||||||
|
|
||||||
\section1 Dynamic Properties
|
\section1 Dynamic Properties
|
||||||
|
@ -1680,6 +1680,7 @@ public:
|
|||||||
QT_Q_ENUM(InputMethodQuery)
|
QT_Q_ENUM(InputMethodQuery)
|
||||||
QT_Q_FLAG(InputMethodHints)
|
QT_Q_FLAG(InputMethodHints)
|
||||||
QT_Q_FLAG(InputMethodQueries)
|
QT_Q_FLAG(InputMethodQueries)
|
||||||
|
QT_Q_FLAG(TouchPointStates)
|
||||||
QT_Q_ENUM(ScreenOrientation)
|
QT_Q_ENUM(ScreenOrientation)
|
||||||
QT_Q_FLAG(ScreenOrientations)
|
QT_Q_FLAG(ScreenOrientations)
|
||||||
QT_Q_ENUM(ConnectionType)
|
QT_Q_ENUM(ConnectionType)
|
||||||
|
@ -4178,6 +4178,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
|
|||||||
/*!
|
/*!
|
||||||
\macro Q_ENUMS(...)
|
\macro Q_ENUMS(...)
|
||||||
\relates QObject
|
\relates QObject
|
||||||
|
\obsolete
|
||||||
|
|
||||||
This macro registers one or several enum types to the meta-object
|
This macro registers one or several enum types to the meta-object
|
||||||
system.
|
system.
|
||||||
@ -4191,35 +4192,87 @@ QDebug operator<<(QDebug dbg, const QObject *o)
|
|||||||
defining it. In addition, the class \e defining the enum has to
|
defining it. In addition, the class \e defining the enum has to
|
||||||
inherit QObject as well as declare the enum using Q_ENUMS().
|
inherit QObject as well as declare the enum using Q_ENUMS().
|
||||||
|
|
||||||
|
In new code, you should prefer the use of the Q_ENUM() macro, which makes the
|
||||||
|
type available also to the meta type system.
|
||||||
|
For instance, QMetaEnum::fromType() will not work with types declared with Q_ENUMS().
|
||||||
|
|
||||||
\sa {Qt's Property System}
|
\sa {Qt's Property System}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\macro Q_FLAGS(...)
|
\macro Q_FLAGS(...)
|
||||||
\relates QObject
|
\relates QObject
|
||||||
|
\obsolete
|
||||||
|
|
||||||
This macro registers one or several \l{QFlags}{flags types} to the
|
This macro registers one or several \l{QFlags}{flags types} with the
|
||||||
meta-object system. It is typically used in a class definition to declare
|
meta-object system. It is typically used in a class definition to declare
|
||||||
that values of a given enum can be used as flags and combined using the
|
that values of a given enum can be used as flags and combined using the
|
||||||
bitwise OR operator.
|
bitwise OR operator.
|
||||||
|
|
||||||
For example, in QLibrary, the \l{QLibrary::LoadHints}{LoadHints} flag is
|
|
||||||
declared in the following way:
|
|
||||||
|
|
||||||
\snippet code/src_corelib_kernel_qobject.cpp 39a
|
|
||||||
|
|
||||||
The declaration of the flags themselves is performed in the public section
|
|
||||||
of the QLibrary class itself, using the \l Q_DECLARE_FLAGS() macro:
|
|
||||||
|
|
||||||
\snippet code/src_corelib_kernel_qobject.cpp 39b
|
|
||||||
|
|
||||||
\note This macro takes care of registering individual flag values
|
\note This macro takes care of registering individual flag values
|
||||||
with the meta-object system, so it is unnecessary to use Q_ENUMS()
|
with the meta-object system, so it is unnecessary to use Q_ENUMS()
|
||||||
in addition to this macro.
|
in addition to this macro.
|
||||||
|
|
||||||
|
In new code, you should prefer the use of the Q_FLAG() macro, which makes the
|
||||||
|
type available also to the meta type system.
|
||||||
|
|
||||||
\sa {Qt's Property System}
|
\sa {Qt's Property System}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\macro Q_ENUM(...)
|
||||||
|
\relates QObject
|
||||||
|
\since 5.5
|
||||||
|
|
||||||
|
This macro registers an enum type with the meta-object system.
|
||||||
|
It must be placed after the enum declaration in a class that has the Q_OBJECT or the
|
||||||
|
Q_GADGET macro.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
\snippet code/src_corelib_kernel_qobject.cpp 38
|
||||||
|
|
||||||
|
Enumerations that are declared with Q_ENUM have their QMetaEnum registered in the
|
||||||
|
enclosing QMetaObject. You can also use QMetaEnum::fromType() to get the QMetaEnum.
|
||||||
|
|
||||||
|
Registered enumerations are automatically registered also to the Qt meta
|
||||||
|
type system, making them known to QMetaType without the need to use
|
||||||
|
Q_DECLARE_METATYPE(). This will enable useful features; for example, if used
|
||||||
|
in a QVariant, you can convert them to strings. Likewise, passing them to
|
||||||
|
QDebug will print out their names.
|
||||||
|
|
||||||
|
\sa {Qt's Property System}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\macro Q_FLAG(...)
|
||||||
|
\relates QObject
|
||||||
|
\since 5.5
|
||||||
|
|
||||||
|
This macro registers a single \l{QFlags}{flags types} with the
|
||||||
|
meta-object system. It is typically used in a class definition to declare
|
||||||
|
that values of a given enum can be used as flags and combined using the
|
||||||
|
bitwise OR operator.
|
||||||
|
|
||||||
|
The macro must be placed after the enum declaration.
|
||||||
|
|
||||||
|
For example, in QLibrary, the \l{QLibrary::LoadHints}{LoadHints} flag is
|
||||||
|
declared in the following way:
|
||||||
|
|
||||||
|
\snippet code/src_corelib_kernel_qobject.cpp 39
|
||||||
|
|
||||||
|
The declaration of the flags themselves is performed in the public section
|
||||||
|
of the QLibrary class itself, using the \l Q_DECLARE_FLAGS() macro.
|
||||||
|
|
||||||
|
\note The Q_FLAG macro takes care of registering individual flag values
|
||||||
|
with the meta-object system, so it is unnecessary to use Q_ENUM()
|
||||||
|
in addition to this macro.
|
||||||
|
|
||||||
|
\sa {Qt's Property System}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\macro Q_OBJECT
|
\macro Q_OBJECT
|
||||||
\relates QObject
|
\relates QObject
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
#include <private/qdrawingprimitive_sse2_p.h>
|
#include <private/qdrawingprimitive_sse2_p.h>
|
||||||
#include <private/qguiapplication_p.h>
|
#include <private/qguiapplication_p.h>
|
||||||
#include <private/qsimd_p.h>
|
#include <private/qsimd_p.h>
|
||||||
|
|
||||||
#include <private/qimage_p.h>
|
#include <private/qimage_p.h>
|
||||||
|
#include <qendian.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -290,6 +290,108 @@ static void convert_ARGB_to_ARGB_PM_sse4(QImageData *dest, const QImageData *src
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32(quint32 *dest_data, const uchar *src_data, int len)
|
||||||
|
{
|
||||||
|
int pixel = 0;
|
||||||
|
// prolog: align input to 32bit
|
||||||
|
while ((quintptr(src_data) & 0x3) && pixel < len) {
|
||||||
|
*dest_data = 0xff000000 | (src_data[0] << 16) | (src_data[1] << 8) | (src_data[2]);
|
||||||
|
src_data += 3;
|
||||||
|
++dest_data;
|
||||||
|
++pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle 4 pixels at a time 12 bytes input to 16 bytes output.
|
||||||
|
for (; pixel + 3 < len; pixel += 4) {
|
||||||
|
const quint32 *src_packed = (quint32 *) src_data;
|
||||||
|
const quint32 src1 = qFromBigEndian(src_packed[0]);
|
||||||
|
const quint32 src2 = qFromBigEndian(src_packed[1]);
|
||||||
|
const quint32 src3 = qFromBigEndian(src_packed[2]);
|
||||||
|
|
||||||
|
dest_data[0] = 0xff000000 | (src1 >> 8);
|
||||||
|
dest_data[1] = 0xff000000 | (src1 << 16) | (src2 >> 16);
|
||||||
|
dest_data[2] = 0xff000000 | (src2 << 8) | (src3 >> 24);
|
||||||
|
dest_data[3] = 0xff000000 | src3;
|
||||||
|
|
||||||
|
src_data += 12;
|
||||||
|
dest_data += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// epilog: handle left over pixels
|
||||||
|
for (; pixel < len; ++pixel) {
|
||||||
|
*dest_data = 0xff000000 | (src_data[0] << 16) | (src_data[1] << 8) | (src_data[2]);
|
||||||
|
src_data += 3;
|
||||||
|
++dest_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgbx8888(quint32 *dest_data, const uchar *src_data, int len)
|
||||||
|
{
|
||||||
|
int pixel = 0;
|
||||||
|
// prolog: align input to 32bit
|
||||||
|
while ((quintptr(src_data) & 0x3) && pixel < len) {
|
||||||
|
*dest_data = ARGB2RGBA(0xff000000 | (src_data[0] << 16) | (src_data[1] << 8) | (src_data[2]));
|
||||||
|
src_data += 3;
|
||||||
|
++dest_data;
|
||||||
|
++pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle 4 pixels at a time 12 bytes input to 16 bytes output.
|
||||||
|
for (; pixel + 3 < len; pixel += 4) {
|
||||||
|
const quint32 *src_packed = (quint32 *) src_data;
|
||||||
|
const quint32 src1 = src_packed[0];
|
||||||
|
const quint32 src2 = src_packed[1];
|
||||||
|
const quint32 src3 = src_packed[2];
|
||||||
|
|
||||||
|
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
|
||||||
|
dest_data[0] = 0xff000000 | src1;
|
||||||
|
dest_data[1] = 0xff000000 | (src1 >> 24) | (src2 << 8);
|
||||||
|
dest_data[2] = 0xff000000 | (src2 >> 16) | (src3 << 16);
|
||||||
|
dest_data[3] = 0xff000000 | (src3 >> 8);
|
||||||
|
#else
|
||||||
|
dest_data[0] = 0xff | src1;
|
||||||
|
dest_data[1] = 0xff | (src1 << 24) | (src2 >> 8);
|
||||||
|
dest_data[2] = 0xff | (src2 << 16) | (src3 >> 16);
|
||||||
|
dest_data[3] = 0xff | (src3 << 8);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
src_data += 12;
|
||||||
|
dest_data += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// epilog: handle left over pixels
|
||||||
|
for (; pixel < len; ++pixel) {
|
||||||
|
*dest_data = ARGB2RGBA(0xff000000 | (src_data[0] << 16) | (src_data[1] << 8) | (src_data[2]));
|
||||||
|
src_data += 3;
|
||||||
|
++dest_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef void (QT_FASTCALL *Rgb888ToRgbConverter)(quint32 *dst, const uchar *src, int len);
|
||||||
|
|
||||||
|
template <bool rgbx>
|
||||||
|
static void convert_RGB888_to_RGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
|
||||||
|
{
|
||||||
|
Q_ASSERT(src->format == QImage::Format_RGB888);
|
||||||
|
if (rgbx)
|
||||||
|
Q_ASSERT(dest->format == QImage::Format_RGBX8888 || dest->format == QImage::Format_RGBA8888 || dest->format == QImage::Format_RGBA8888_Premultiplied);
|
||||||
|
else
|
||||||
|
Q_ASSERT(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied);
|
||||||
|
Q_ASSERT(src->width == dest->width);
|
||||||
|
Q_ASSERT(src->height == dest->height);
|
||||||
|
|
||||||
|
const uchar *src_data = (uchar *) src->data;
|
||||||
|
quint32 *dest_data = (quint32 *) dest->data;
|
||||||
|
|
||||||
|
Rgb888ToRgbConverter line_converter= rgbx ? qt_convert_rgb888_to_rgbx8888 : qt_convert_rgb888_to_rgb32;
|
||||||
|
|
||||||
|
for (int i = 0; i < src->height; ++i) {
|
||||||
|
line_converter(dest_data, src_data, src->width);
|
||||||
|
src_data += src->bytes_per_line;
|
||||||
|
dest_data = (quint32 *)((uchar*)dest_data + dest->bytes_per_line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extern bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionFlags);
|
extern bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionFlags);
|
||||||
|
|
||||||
static void convert_ARGB_to_RGBx(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
|
static void convert_ARGB_to_RGBx(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
|
||||||
@ -2052,6 +2154,9 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
convert_RGB888_to_RGB<false>,
|
||||||
|
convert_RGB888_to_RGB<false>,
|
||||||
|
convert_RGB888_to_RGB<false>,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -2061,12 +2166,10 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
convert_RGB888_to_RGB<true>,
|
||||||
0,
|
convert_RGB888_to_RGB<true>,
|
||||||
0,
|
convert_RGB888_to_RGB<true>,
|
||||||
0,
|
0, 0, 0, 0, 0, 0
|
||||||
0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0
|
|
||||||
}, // Format_RGB888
|
}, // Format_RGB888
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -69,18 +69,10 @@ extern "C" {
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
void QT_FASTCALL convert_rgb888_to_rgb32_C(quint32 *dst, const uchar *src, int len)
|
Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32(quint32 *dst, const uchar *src, int len);
|
||||||
{
|
|
||||||
// Expand 24->32 bpp.
|
|
||||||
for (int i = 0; i < len; ++i) {
|
|
||||||
*dst++ = qRgb(src[0], src[1], src[2]);
|
|
||||||
src += 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef void (QT_FASTCALL *Rgb888ToRgb32Converter)(quint32 *dst, const uchar *src, int len);
|
typedef void (QT_FASTCALL *Rgb888ToRgb32Converter)(quint32 *dst, const uchar *src, int len);
|
||||||
|
|
||||||
static Rgb888ToRgb32Converter rgb888ToRgb32ConverterPtr = convert_rgb888_to_rgb32_C;
|
static Rgb888ToRgb32Converter rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32;
|
||||||
|
|
||||||
struct my_error_mgr : public jpeg_error_mgr {
|
struct my_error_mgr : public jpeg_error_mgr {
|
||||||
jmp_buf setjmp_buffer;
|
jmp_buf setjmp_buffer;
|
||||||
@ -1008,10 +1000,8 @@ QJpegHandler::QJpegHandler()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(QT_COMPILER_SUPPORTS_SSSE3)
|
#if defined(QT_COMPILER_SUPPORTS_SSSE3)
|
||||||
// from qimage_ssse3.cpp
|
// from qimage_ssse3.cpps
|
||||||
|
if (qCpuHasFeature(SSSE3)) {
|
||||||
if (false) {
|
|
||||||
} else if (qCpuHasFeature(SSSE3)) {
|
|
||||||
rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_ssse3;
|
rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_ssse3;
|
||||||
}
|
}
|
||||||
#endif // QT_COMPILER_SUPPORTS_SSSE3
|
#endif // QT_COMPILER_SUPPORTS_SSSE3
|
||||||
|
@ -3461,29 +3461,9 @@ QShortcutEvent::~QShortcutEvent()
|
|||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
|
|
||||||
static inline void formatTouchPoint(QDebug d, const QTouchEvent::TouchPoint &tp)
|
static inline void formatTouchEvent(QDebug d, const QTouchEvent &t)
|
||||||
{
|
{
|
||||||
d << "TouchPoint(" << tp.id() << ' ' << tp.rect();
|
d << "QTouchEvent(" << t.type() << " states: " << t.touchPointStates();
|
||||||
switch (tp.state()) {
|
|
||||||
case Qt::TouchPointPressed:
|
|
||||||
d << " pressed";
|
|
||||||
break;
|
|
||||||
case Qt::TouchPointReleased:
|
|
||||||
d << " released";
|
|
||||||
break;
|
|
||||||
case Qt::TouchPointMoved:
|
|
||||||
d << " moved";
|
|
||||||
break;
|
|
||||||
case Qt::TouchPointStationary:
|
|
||||||
d << " stationary";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
d << ')';
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void formatTouchEvent(QDebug d, const char *name, const QTouchEvent &t)
|
|
||||||
{
|
|
||||||
d << "QTouchEvent(" << name << " states: " << t.touchPointStates();
|
|
||||||
d << ", " << t.touchPoints().size() << " points: " << t.touchPoints() << ')';
|
d << ", " << t.touchPoints().size() << " points: " << t.touchPoints() << ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3542,14 +3522,6 @@ static inline void formatInputMethodQueryEvent(QDebug d, const QInputMethodQuery
|
|||||||
d << "})";
|
d << "})";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *eventTypeName(QEvent::Type t)
|
|
||||||
{
|
|
||||||
static const int enumIdx = QEvent::staticMetaObject.indexOfEnumerator("Type");
|
|
||||||
return t <= QEvent::User
|
|
||||||
? QEvent::staticMetaObject.enumerator(enumIdx).valueToKey(t)
|
|
||||||
: "User";
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *eventClassName(QEvent::Type t)
|
static const char *eventClassName(QEvent::Type t)
|
||||||
{
|
{
|
||||||
switch (t) {
|
switch (t) {
|
||||||
@ -3667,54 +3639,6 @@ static const char *eventClassName(QEvent::Type t)
|
|||||||
return "QEvent";
|
return "QEvent";
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
|
||||||
// Make protected QObject::staticQtMetaObject accessible for formatting enums.
|
|
||||||
class DebugHelper : public QObject {
|
|
||||||
public:
|
|
||||||
static const char *mouseButtonToString(Qt::MouseButton button)
|
|
||||||
{
|
|
||||||
static const int enumIdx = QObject::staticQtMetaObject.indexOfEnumerator("MouseButtons");
|
|
||||||
return QObject::staticQtMetaObject.enumerator(enumIdx).valueToKey(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QByteArray mouseButtonsToString(Qt::MouseButtons buttons)
|
|
||||||
{
|
|
||||||
QByteArray result;
|
|
||||||
for (int i = 0; (uint)(1 << i) <= Qt::MaxMouseButton; ++i) {
|
|
||||||
const Qt::MouseButton button = static_cast<Qt::MouseButton>(1 << i);
|
|
||||||
if (buttons.testFlag(button)) {
|
|
||||||
if (!result.isEmpty())
|
|
||||||
result.append('|');
|
|
||||||
result.append(mouseButtonToString(button));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (result.isEmpty())
|
|
||||||
result.append("NoButton");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *mouseEventSourceToString(Qt::MouseEventSource source)
|
|
||||||
{
|
|
||||||
static const int enumIdx = QObject::staticQtMetaObject.indexOfEnumerator("MouseEventSource");
|
|
||||||
return QObject::staticQtMetaObject.enumerator(enumIdx).valueToKey(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *focusReasonToString(Qt::FocusReason reason)
|
|
||||||
{
|
|
||||||
static const int enumIdx = QObject::staticQtMetaObject.indexOfEnumerator("FocusReason");
|
|
||||||
return QObject::staticQtMetaObject.enumerator(enumIdx).valueToKey(reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
# ifndef QT_NO_GESTURES
|
|
||||||
static const char *nativeGestureTypeToString(Qt::NativeGestureType type)
|
|
||||||
{
|
|
||||||
static const int enumIdx = QObject::staticQtMetaObject.indexOfEnumerator("NativeGestureType");
|
|
||||||
return QObject::staticQtMetaObject.enumerator(enumIdx).valueToKey(type);
|
|
||||||
}
|
|
||||||
# endif // !QT_NO_GESTURES
|
|
||||||
};
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
# ifndef QT_NO_DRAGANDDROP
|
# ifndef QT_NO_DRAGANDDROP
|
||||||
|
|
||||||
static void formatDropEvent(QDebug d, const QDropEvent *e)
|
static void formatDropEvent(QDebug d, const QDropEvent *e)
|
||||||
@ -3728,7 +3652,7 @@ static void formatDropEvent(QDebug d, const QDropEvent *e)
|
|||||||
d << ", formats=" << e->mimeData()->formats();
|
d << ", formats=" << e->mimeData()->formats();
|
||||||
if (const Qt::KeyboardModifiers mods = e->keyboardModifiers())
|
if (const Qt::KeyboardModifiers mods = e->keyboardModifiers())
|
||||||
d << ", keyboardModifiers=" << mods;
|
d << ", keyboardModifiers=" << mods;
|
||||||
d << ", " << DebugHelper::mouseButtonsToString(e->mouseButtons()).constData();
|
d << ", " << e->mouseButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
# endif // !QT_NO_DRAGANDDROP
|
# endif // !QT_NO_DRAGANDDROP
|
||||||
@ -3739,20 +3663,15 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e)
|
|||||||
{
|
{
|
||||||
const QEvent::Type type = e->type();
|
const QEvent::Type type = e->type();
|
||||||
|
|
||||||
static const int deviceEnumIdx = QTabletEvent::staticMetaObject.indexOfEnumerator("TabletDevice");
|
d << eventClassName(type) << '(' << type
|
||||||
static const int pointerTypeEnumIdx = QTabletEvent::staticMetaObject.indexOfEnumerator("PointerType");
|
<< ", device=" << e->device()
|
||||||
const char* device = QTabletEvent::staticMetaObject.enumerator(deviceEnumIdx).valueToKey(e->device());
|
<< ", pointerType=" << e->pointerType()
|
||||||
const char* pointerType = QTabletEvent::staticMetaObject.enumerator(pointerTypeEnumIdx).valueToKey(e->pointerType());
|
|
||||||
|
|
||||||
d << eventClassName(type) << '(' << eventTypeName(type)
|
|
||||||
<< ", device=" << device
|
|
||||||
<< ", pointerType=" << pointerType
|
|
||||||
<< ", uniqueId=" << e->uniqueId()
|
<< ", uniqueId=" << e->uniqueId()
|
||||||
<< ", pos=" << e->posF()
|
<< ", pos=" << e->posF()
|
||||||
<< ", z=" << e->z()
|
<< ", z=" << e->z()
|
||||||
<< ", xTilt=" << e->xTilt()
|
<< ", xTilt=" << e->xTilt()
|
||||||
<< ", yTilt=" << e->yTilt()
|
<< ", yTilt=" << e->yTilt()
|
||||||
<< ", " << DebugHelper::mouseButtonsToString(e->buttons()).constData();
|
<< ", " << e->buttons();
|
||||||
if (type == QEvent::TabletPress || type == QEvent::TabletMove)
|
if (type == QEvent::TabletPress || type == QEvent::TabletMove)
|
||||||
d << ", pressure=" << e->pressure();
|
d << ", pressure=" << e->pressure();
|
||||||
if (e->device() == QTabletEvent::RotationStylus || e->device() == QTabletEvent::FourDMouse)
|
if (e->device() == QTabletEvent::RotationStylus || e->device() == QTabletEvent::FourDMouse)
|
||||||
@ -3766,8 +3685,7 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e)
|
|||||||
QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp)
|
QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp)
|
||||||
{
|
{
|
||||||
QDebugStateSaver saver(dbg);
|
QDebugStateSaver saver(dbg);
|
||||||
dbg.nospace();
|
dbg.nospace() << "TouchPoint(" << tp.id() << ' ' << tp.rect() << ' ' << tp.state() << " vel " << tp.velocity() << ')';
|
||||||
formatTouchPoint(dbg, tp);
|
|
||||||
return dbg;
|
return dbg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3797,16 +3715,16 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
|
|||||||
const QMouseEvent *me = static_cast<const QMouseEvent*>(e);
|
const QMouseEvent *me = static_cast<const QMouseEvent*>(e);
|
||||||
const Qt::MouseButton button = me->button();
|
const Qt::MouseButton button = me->button();
|
||||||
const Qt::MouseButtons buttons = me->buttons();
|
const Qt::MouseButtons buttons = me->buttons();
|
||||||
dbg << "QMouseEvent(" << eventTypeName(type);
|
dbg << "QMouseEvent(" << type;
|
||||||
if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove)
|
if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove)
|
||||||
dbg << ", " << DebugHelper::mouseButtonToString(button);
|
dbg << ", " << button;
|
||||||
if (buttons && button != buttons)
|
if (buttons && button != buttons)
|
||||||
dbg << ", buttons=" << DebugHelper::mouseButtonsToString(buttons).constData();
|
dbg << ", buttons=" << buttons;
|
||||||
if (const int mods = int(me->modifiers()))
|
if (const int mods = int(me->modifiers()))
|
||||||
dbg << ", modifiers=0x" << hex << mods << dec;
|
dbg << ", modifiers=0x" << hex << mods << dec;
|
||||||
dbg << ", localPos=" << me->localPos() << ", screenPos=" << me->screenPos();
|
dbg << ", localPos=" << me->localPos() << ", screenPos=" << me->screenPos();
|
||||||
if (me->source())
|
if (me->source())
|
||||||
dbg << ", " << DebugHelper::mouseEventSourceToString(me->source());
|
dbg << ", " << me->source();
|
||||||
if (const Qt::MouseEventFlags flags = me->flags())
|
if (const Qt::MouseEventFlags flags = me->flags())
|
||||||
dbg << ", flags = " << hex << int(flags) << dec;
|
dbg << ", flags = " << hex << int(flags) << dec;
|
||||||
dbg << ')';
|
dbg << ')';
|
||||||
@ -3824,7 +3742,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
|
|||||||
case QEvent::ShortcutOverride:
|
case QEvent::ShortcutOverride:
|
||||||
{
|
{
|
||||||
const QKeyEvent *ke = static_cast<const QKeyEvent *>(e);
|
const QKeyEvent *ke = static_cast<const QKeyEvent *>(e);
|
||||||
dbg << "QKeyEvent(" << eventTypeName(type)
|
dbg << "QKeyEvent(" << type
|
||||||
<< ", key=0x" << hex << ke->key() << dec;
|
<< ", key=0x" << hex << ke->key() << dec;
|
||||||
if (const int mods = ke->modifiers())
|
if (const int mods = ke->modifiers())
|
||||||
dbg << ", modifiers=0x" << hex << mods << dec;
|
dbg << ", modifiers=0x" << hex << mods << dec;
|
||||||
@ -3846,9 +3764,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
|
|||||||
case QEvent::FocusAboutToChange:
|
case QEvent::FocusAboutToChange:
|
||||||
case QEvent::FocusIn:
|
case QEvent::FocusIn:
|
||||||
case QEvent::FocusOut:
|
case QEvent::FocusOut:
|
||||||
dbg << "QFocusEvent(" << eventTypeName(type) << ", "
|
dbg << "QFocusEvent(" << type << ", " << static_cast<const QFocusEvent *>(e)->reason() << ')';
|
||||||
<< DebugHelper::focusReasonToString(static_cast<const QFocusEvent *>(e)->reason())
|
|
||||||
<< ')';
|
|
||||||
break;
|
break;
|
||||||
case QEvent::Move: {
|
case QEvent::Move: {
|
||||||
const QMoveEvent *me = static_cast<const QMoveEvent *>(e);
|
const QMoveEvent *me = static_cast<const QMoveEvent *>(e);
|
||||||
@ -3882,17 +3798,17 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
|
|||||||
case QEvent::TouchBegin:
|
case QEvent::TouchBegin:
|
||||||
case QEvent::TouchUpdate:
|
case QEvent::TouchUpdate:
|
||||||
case QEvent::TouchEnd:
|
case QEvent::TouchEnd:
|
||||||
formatTouchEvent(dbg, eventTypeName(type), *static_cast<const QTouchEvent*>(e));
|
formatTouchEvent(dbg, *static_cast<const QTouchEvent*>(e));
|
||||||
break;
|
break;
|
||||||
case QEvent::ChildAdded:
|
case QEvent::ChildAdded:
|
||||||
case QEvent::ChildPolished:
|
case QEvent::ChildPolished:
|
||||||
case QEvent::ChildRemoved:
|
case QEvent::ChildRemoved:
|
||||||
dbg << "QChildEvent(" << eventTypeName(type) << ", " << (static_cast<const QChildEvent*>(e))->child() << ')';
|
dbg << "QChildEvent(" << type << ", " << (static_cast<const QChildEvent*>(e))->child() << ')';
|
||||||
break;
|
break;
|
||||||
# ifndef QT_NO_GESTURES
|
# ifndef QT_NO_GESTURES
|
||||||
case QEvent::NativeGesture: {
|
case QEvent::NativeGesture: {
|
||||||
const QNativeGestureEvent *ne = static_cast<const QNativeGestureEvent *>(e);
|
const QNativeGestureEvent *ne = static_cast<const QNativeGestureEvent *>(e);
|
||||||
dbg << "QNativeGestureEvent(" << DebugHelper::nativeGestureTypeToString(ne->gestureType())
|
dbg << "QNativeGestureEvent(" << ne->gestureType()
|
||||||
<< "localPos=" << ne->localPos() << ", value=" << ne->value() << ')';
|
<< "localPos=" << ne->localPos() << ", value=" << ne->value() << ')';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3932,7 +3848,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
|
|||||||
dbg << ')';
|
dbg << ')';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dbg << eventClassName(type) << '(' << eventTypeName(type) << ", "
|
dbg << eventClassName(type) << '(' << type << ", "
|
||||||
<< (const void *)e << ", type = " << e->type() << ')';
|
<< (const void *)e << ", type = " << e->type() << ')';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -401,8 +401,8 @@ int QBezier::shifted(QBezier *curveSegments, int maxSegments, qreal offset, floa
|
|||||||
Q_ASSERT(curveSegments);
|
Q_ASSERT(curveSegments);
|
||||||
Q_ASSERT(maxSegments > 0);
|
Q_ASSERT(maxSegments > 0);
|
||||||
|
|
||||||
if (x1 == x2 && x1 == x3 && x1 == x4 &&
|
if (qFuzzyCompare(x1, x2) && qFuzzyCompare(x1, x3) && qFuzzyCompare(x1, x4) &&
|
||||||
y1 == y2 && y1 == y3 && y1 == y4)
|
qFuzzyCompare(y1, y2) && qFuzzyCompare(y1, y3) && qFuzzyCompare(y1, y4))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
--maxSegments;
|
--maxSegments;
|
||||||
|
@ -44,6 +44,11 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
// If the change in scale for a single touch event is out of this range,
|
||||||
|
// we consider it to be spurious.
|
||||||
|
static const qreal kSingleStepScaleMax = 2.0;
|
||||||
|
static const qreal kSingleStepScaleMin = 0.1;
|
||||||
|
|
||||||
QGesture *QPanGestureRecognizer::create(QObject *target)
|
QGesture *QPanGestureRecognizer::create(QObject *target)
|
||||||
{
|
{
|
||||||
if (target && target->isWidgetType()) {
|
if (target && target->isWidgetType()) {
|
||||||
@ -197,7 +202,10 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state,
|
|||||||
d->lastScaleFactor = d->scaleFactor;
|
d->lastScaleFactor = d->scaleFactor;
|
||||||
QLineF line(p1.screenPos(), p2.screenPos());
|
QLineF line(p1.screenPos(), p2.screenPos());
|
||||||
QLineF lastLine(p1.lastScreenPos(), p2.lastScreenPos());
|
QLineF lastLine(p1.lastScreenPos(), p2.lastScreenPos());
|
||||||
d->scaleFactor = line.length() / lastLine.length();
|
qreal newScaleFactor = line.length() / lastLine.length();
|
||||||
|
if (newScaleFactor > kSingleStepScaleMax || newScaleFactor < kSingleStepScaleMin)
|
||||||
|
return QGestureRecognizer::Ignore;
|
||||||
|
d->scaleFactor = newScaleFactor;
|
||||||
}
|
}
|
||||||
d->totalScaleFactor = d->totalScaleFactor * d->scaleFactor;
|
d->totalScaleFactor = d->totalScaleFactor * d->scaleFactor;
|
||||||
d->changeFlags |= QPinchGesture::ScaleFactorChanged;
|
d->changeFlags |= QPinchGesture::ScaleFactorChanged;
|
||||||
|
@ -734,6 +734,13 @@ void tst_QImage::convertToFormat_data()
|
|||||||
QTest::newRow("blue rgb888 -> argb32") << int(QImage::Format_RGB888) << 0xff0000ff
|
QTest::newRow("blue rgb888 -> argb32") << int(QImage::Format_RGB888) << 0xff0000ff
|
||||||
<< int(QImage::Format_ARGB32) << 0xff0000ff;
|
<< int(QImage::Format_ARGB32) << 0xff0000ff;
|
||||||
|
|
||||||
|
QTest::newRow("red rgb888 -> rgbx8888") << int(QImage::Format_RGB888) << 0xffff0000
|
||||||
|
<< int(QImage::Format_RGBX8888) << 0xffff0000;
|
||||||
|
QTest::newRow("green rgb888 -> rgbx8888") << int(QImage::Format_RGB888) << 0xff00ff00
|
||||||
|
<< int(QImage::Format_RGBX8888) << 0xff00ff00;
|
||||||
|
QTest::newRow("blue rgb888 -> rgbx8888") << int(QImage::Format_RGB888) << 0xff0000ff
|
||||||
|
<< int(QImage::Format_RGBX8888) << 0xff0000ff;
|
||||||
|
|
||||||
QTest::newRow("semired argb32 -> rgb888") << int(QImage::Format_ARGB32) << 0x7fff0000u
|
QTest::newRow("semired argb32 -> rgb888") << int(QImage::Format_ARGB32) << 0x7fff0000u
|
||||||
<< int(QImage::Format_RGB888) << 0xffff0000;
|
<< int(QImage::Format_RGB888) << 0xffff0000;
|
||||||
QTest::newRow("semigreen argb32 -> rgb888") << int(QImage::Format_ARGB32) << 0x7f00ff00u
|
QTest::newRow("semigreen argb32 -> rgb888") << int(QImage::Format_ARGB32) << 0x7f00ff00u
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define EXAMPLE_URL "http://user:pass@www.example.com/#foo"
|
#define EXAMPLE_URL "http://user:pass@localhost:4/#foo"
|
||||||
//cached objects are organized into these many subdirs
|
//cached objects are organized into these many subdirs
|
||||||
#define NUM_SUBDIRECTORIES 16
|
#define NUM_SUBDIRECTORIES 16
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ void tst_QNetworkDiskCache::accessAfterRemoveReadyReadSlot()
|
|||||||
void tst_QNetworkDiskCache::setCookieHeader() // QTBUG-41514
|
void tst_QNetworkDiskCache::setCookieHeader() // QTBUG-41514
|
||||||
{
|
{
|
||||||
SubQNetworkDiskCache *cache = new SubQNetworkDiskCache();
|
SubQNetworkDiskCache *cache = new SubQNetworkDiskCache();
|
||||||
url = QUrl("http://www.foo.com/cookieTest.html");
|
url = QUrl("http://localhost:4/cookieTest.html"); // hopefully no one is running an HTTP server on port 4
|
||||||
QNetworkCacheMetaData metaData;
|
QNetworkCacheMetaData metaData;
|
||||||
metaData.setUrl(url);
|
metaData.setUrl(url);
|
||||||
|
|
||||||
@ -518,7 +518,7 @@ void tst_QNetworkDiskCache::expire()
|
|||||||
if (i % 3 == 0)
|
if (i % 3 == 0)
|
||||||
QTest::qWait(2000);
|
QTest::qWait(2000);
|
||||||
QNetworkCacheMetaData m;
|
QNetworkCacheMetaData m;
|
||||||
m.setUrl(QUrl("http://www.foo.com/" + QString::number(i)));
|
m.setUrl(QUrl("http://localhost:4/" + QString::number(i)));
|
||||||
QIODevice *d = cache.prepare(m);
|
QIODevice *d = cache.prepare(m);
|
||||||
QString bigString;
|
QString bigString;
|
||||||
bigString.fill(QLatin1Char('Z'), (1024 * 1024 / 4));
|
bigString.fill(QLatin1Char('Z'), (1024 * 1024 / 4));
|
||||||
@ -540,7 +540,7 @@ void tst_QNetworkDiskCache::expire()
|
|||||||
std::sort(cacheList.begin(), cacheList.end());
|
std::sort(cacheList.begin(), cacheList.end());
|
||||||
for (int i = 0; i < cacheList.count(); ++i) {
|
for (int i = 0; i < cacheList.count(); ++i) {
|
||||||
QString fileName = cacheList[i];
|
QString fileName = cacheList[i];
|
||||||
QCOMPARE(fileName, QString("http://www.foo.com/%1").arg(i + 6));
|
QCOMPARE(fileName, QString("http://localhost:4/%1").arg(i + 6));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,9 @@ private slots:
|
|||||||
void resizeEvent_data();
|
void resizeEvent_data();
|
||||||
void resizeEvent();
|
void resizeEvent();
|
||||||
void paintEvent();
|
void paintEvent();
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void wheelEvent();
|
void wheelEvent();
|
||||||
|
#endif
|
||||||
void sizeHint_data();
|
void sizeHint_data();
|
||||||
void sizeHint();
|
void sizeHint();
|
||||||
void sizePolicy();
|
void sizePolicy();
|
||||||
@ -260,6 +262,7 @@ public:
|
|||||||
int focusOut;
|
int focusOut;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
class WheelWidget : public QWidget
|
class WheelWidget : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -269,6 +272,7 @@ public:
|
|||||||
|
|
||||||
bool wheelEventCalled;
|
bool wheelEventCalled;
|
||||||
};
|
};
|
||||||
|
#endif // !QT_NO_WHEELEVENT
|
||||||
|
|
||||||
// This will be called before the first test function is executed.
|
// This will be called before the first test function is executed.
|
||||||
// It is only called once.
|
// It is only called once.
|
||||||
@ -1308,6 +1312,7 @@ void tst_QGraphicsProxyWidget::paintEvent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void tst_QGraphicsProxyWidget::wheelEvent()
|
void tst_QGraphicsProxyWidget::wheelEvent()
|
||||||
{
|
{
|
||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
@ -1331,6 +1336,7 @@ void tst_QGraphicsProxyWidget::wheelEvent()
|
|||||||
QVERIFY(event.isAccepted());
|
QVERIFY(event.isAccepted());
|
||||||
QVERIFY(wheelWidget->wheelEventCalled);
|
QVERIFY(wheelWidget->wheelEventCalled);
|
||||||
}
|
}
|
||||||
|
#endif // !QT_NO_WHEELEVENT
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Qt::SizeHint)
|
Q_DECLARE_METATYPE(Qt::SizeHint)
|
||||||
void tst_QGraphicsProxyWidget::sizeHint_data()
|
void tst_QGraphicsProxyWidget::sizeHint_data()
|
||||||
|
@ -198,7 +198,9 @@ private slots:
|
|||||||
void mapFromScenePoly();
|
void mapFromScenePoly();
|
||||||
void mapFromScenePath();
|
void mapFromScenePath();
|
||||||
void sendEvent();
|
void sendEvent();
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void wheelEvent();
|
void wheelEvent();
|
||||||
|
#endif
|
||||||
#ifndef QTEST_NO_CURSOR
|
#ifndef QTEST_NO_CURSOR
|
||||||
void cursor();
|
void cursor();
|
||||||
void cursor2();
|
void cursor2();
|
||||||
@ -2172,6 +2174,7 @@ void tst_QGraphicsView::sendEvent()
|
|||||||
QCOMPARE(item->events.last(), QEvent::KeyPress);
|
QCOMPARE(item->events.last(), QEvent::KeyPress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
class MouseWheelScene : public QGraphicsScene
|
class MouseWheelScene : public QGraphicsScene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -2228,6 +2231,7 @@ void tst_QGraphicsView::wheelEvent()
|
|||||||
QCOMPARE(spy.count(), 2);
|
QCOMPARE(spy.count(), 2);
|
||||||
QVERIFY(widget->hasFocus());
|
QVERIFY(widget->hasFocus());
|
||||||
}
|
}
|
||||||
|
#endif // !QT_NO_WHEELEVENT
|
||||||
|
|
||||||
#ifndef QTEST_NO_CURSOR
|
#ifndef QTEST_NO_CURSOR
|
||||||
void tst_QGraphicsView::cursor()
|
void tst_QGraphicsView::cursor()
|
||||||
|
@ -195,15 +195,19 @@ private slots:
|
|||||||
void task191545_dragSelectRows();
|
void task191545_dragSelectRows();
|
||||||
void taskQTBUG_5062_spansInconsistency();
|
void taskQTBUG_5062_spansInconsistency();
|
||||||
void taskQTBUG_4516_clickOnRichTextLabel();
|
void taskQTBUG_4516_clickOnRichTextLabel();
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void taskQTBUG_5237_wheelEventOnHeader();
|
void taskQTBUG_5237_wheelEventOnHeader();
|
||||||
|
#endif
|
||||||
void taskQTBUG_8585_crashForNoGoodReason();
|
void taskQTBUG_8585_crashForNoGoodReason();
|
||||||
void taskQTBUG_7774_RtoLVisualRegionForSelection();
|
void taskQTBUG_7774_RtoLVisualRegionForSelection();
|
||||||
void taskQTBUG_8777_scrollToSpans();
|
void taskQTBUG_8777_scrollToSpans();
|
||||||
void taskQTBUG_10169_sizeHintForRow();
|
void taskQTBUG_10169_sizeHintForRow();
|
||||||
void taskQTBUG_30653_doItemsLayout();
|
void taskQTBUG_30653_doItemsLayout();
|
||||||
|
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void mouseWheel_data();
|
void mouseWheel_data();
|
||||||
void mouseWheel();
|
void mouseWheel();
|
||||||
|
#endif
|
||||||
|
|
||||||
void addColumnWhileEditing();
|
void addColumnWhileEditing();
|
||||||
void task234926_setHeaderSorting();
|
void task234926_setHeaderSorting();
|
||||||
@ -3994,7 +3998,7 @@ void tst_QTableView::task248688_autoScrollNavigation()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void tst_QTableView::mouseWheel_data()
|
void tst_QTableView::mouseWheel_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<int>("scrollMode");
|
QTest::addColumn<int>("scrollMode");
|
||||||
@ -4051,6 +4055,7 @@ void tst_QTableView::mouseWheel()
|
|||||||
QApplication::sendEvent(view.viewport(), &verticalEvent);
|
QApplication::sendEvent(view.viewport(), &verticalEvent);
|
||||||
QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 10);
|
QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 10);
|
||||||
}
|
}
|
||||||
|
#endif // !QT_NO_WHEELEVENT
|
||||||
|
|
||||||
void tst_QTableView::addColumnWhileEditing()
|
void tst_QTableView::addColumnWhileEditing()
|
||||||
{
|
{
|
||||||
@ -4311,6 +4316,7 @@ void tst_QTableView::changeHeaderData()
|
|||||||
QVERIFY(view.verticalHeader()->width() > textWidth);
|
QVERIFY(view.verticalHeader()->width() > textWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader()
|
void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader()
|
||||||
{
|
{
|
||||||
QTableView view;
|
QTableView view;
|
||||||
@ -4327,6 +4333,7 @@ void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader()
|
|||||||
int sbValueAfter = view.verticalScrollBar()->value();
|
int sbValueAfter = view.verticalScrollBar()->value();
|
||||||
QVERIFY(sbValueBefore != sbValueAfter);
|
QVERIFY(sbValueBefore != sbValueAfter);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
class TestTableView : public QTableView {
|
class TestTableView : public QTableView {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -149,7 +149,9 @@ private slots:
|
|||||||
|
|
||||||
void execAfterExit();
|
void execAfterExit();
|
||||||
|
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void wheelScrollLines();
|
void wheelScrollLines();
|
||||||
|
#endif
|
||||||
|
|
||||||
void task109149();
|
void task109149();
|
||||||
|
|
||||||
@ -1844,6 +1846,7 @@ void tst_QApplication::execAfterExit()
|
|||||||
QCOMPARE(exitCode, 0);
|
QCOMPARE(exitCode, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void tst_QApplication::wheelScrollLines()
|
void tst_QApplication::wheelScrollLines()
|
||||||
{
|
{
|
||||||
int argc = 1;
|
int argc = 1;
|
||||||
@ -1851,6 +1854,7 @@ void tst_QApplication::wheelScrollLines()
|
|||||||
// If wheelScrollLines returns 0, the mose wheel will be disabled.
|
// If wheelScrollLines returns 0, the mose wheel will be disabled.
|
||||||
QVERIFY(app.wheelScrollLines() > 0);
|
QVERIFY(app.wheelScrollLines() > 0);
|
||||||
}
|
}
|
||||||
|
#endif // !QT_NO_WHEELEVENT
|
||||||
|
|
||||||
void tst_QApplication::style()
|
void tst_QApplication::style()
|
||||||
{
|
{
|
||||||
|
@ -79,8 +79,10 @@ private slots:
|
|||||||
void minimum_maximum();
|
void minimum_maximum();
|
||||||
void keyPressed_data();
|
void keyPressed_data();
|
||||||
void keyPressed();
|
void keyPressed();
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void wheelEvent_data();
|
void wheelEvent_data();
|
||||||
void wheelEvent();
|
void wheelEvent();
|
||||||
|
#endif
|
||||||
void sliderPressedReleased_data();
|
void sliderPressedReleased_data();
|
||||||
void sliderPressedReleased();
|
void sliderPressedReleased();
|
||||||
void setOrientation();
|
void setOrientation();
|
||||||
@ -691,6 +693,7 @@ void tst_QAbstractSlider::keyPressed()
|
|||||||
QCOMPARE(slider->sliderPosition(), expectedSliderPositionVerticalInverted);
|
QCOMPARE(slider->sliderPosition(), expectedSliderPositionVerticalInverted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void tst_QAbstractSlider::wheelEvent_data()
|
void tst_QAbstractSlider::wheelEvent_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<int>("initialSliderPosition");
|
QTest::addColumn<int>("initialSliderPosition");
|
||||||
@ -894,6 +897,7 @@ void tst_QAbstractSlider::wheelEvent()
|
|||||||
if (expectedSignalCount)
|
if (expectedSignalCount)
|
||||||
QVERIFY(actionTriggeredTimeStamp < valueChangedTimeStamp);
|
QVERIFY(actionTriggeredTimeStamp < valueChangedTimeStamp);
|
||||||
}
|
}
|
||||||
|
#endif // !QT_NO_WHEELEVENT
|
||||||
|
|
||||||
void tst_QAbstractSlider::sliderPressedReleased_data()
|
void tst_QAbstractSlider::sliderPressedReleased_data()
|
||||||
{
|
{
|
||||||
|
@ -122,9 +122,11 @@ private slots:
|
|||||||
void flaggedItems_data();
|
void flaggedItems_data();
|
||||||
void flaggedItems();
|
void flaggedItems();
|
||||||
void pixmapIcon();
|
void pixmapIcon();
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void mouseWheel_data();
|
void mouseWheel_data();
|
||||||
void mouseWheel();
|
void mouseWheel();
|
||||||
void popupWheelHandling();
|
void popupWheelHandling();
|
||||||
|
#endif // !QT_NO_WHEELEVENT
|
||||||
void layoutDirection();
|
void layoutDirection();
|
||||||
void itemListPosition();
|
void itemListPosition();
|
||||||
void separatorItem_data();
|
void separatorItem_data();
|
||||||
@ -2004,6 +2006,7 @@ void tst_QComboBox::pixmapIcon()
|
|||||||
QCOMPARE( box.itemIcon(1).isNull(), false );
|
QCOMPARE( box.itemIcon(1).isNull(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
// defined to be 120 by the wheel mouse vendors according to the docs
|
// defined to be 120 by the wheel mouse vendors according to the docs
|
||||||
#define WHEEL_DELTA 120
|
#define WHEEL_DELTA 120
|
||||||
|
|
||||||
@ -2094,6 +2097,7 @@ void tst_QComboBox::popupWheelHandling()
|
|||||||
QVERIFY(comboBox->view()->isVisible());
|
QVERIFY(comboBox->view()->isVisible());
|
||||||
QCOMPARE(comboBox->view()->pos(), popupPos);
|
QCOMPARE(comboBox->view()->pos(), popupPos);
|
||||||
}
|
}
|
||||||
|
#endif // !QT_NO_WHEELEVENT
|
||||||
|
|
||||||
void tst_QComboBox::layoutDirection()
|
void tst_QComboBox::layoutDirection()
|
||||||
{
|
{
|
||||||
|
@ -236,7 +236,9 @@ private slots:
|
|||||||
void reverseTest();
|
void reverseTest();
|
||||||
|
|
||||||
void ddMMMMyyyy();
|
void ddMMMMyyyy();
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void wheelEvent();
|
void wheelEvent();
|
||||||
|
#endif
|
||||||
|
|
||||||
void specialValueCornerCase();
|
void specialValueCornerCase();
|
||||||
void cursorPositionOnInit();
|
void cursorPositionOnInit();
|
||||||
@ -3028,6 +3030,7 @@ void tst_QDateTimeEdit::ddMMMMyyyy()
|
|||||||
QCOMPARE(testWidget->lineEdit()->text(), "01." + QDate::longMonthName(1) + ".200");
|
QCOMPARE(testWidget->lineEdit()->text(), "01." + QDate::longMonthName(1) + ".200");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_WHEELEVENT
|
||||||
void tst_QDateTimeEdit::wheelEvent()
|
void tst_QDateTimeEdit::wheelEvent()
|
||||||
{
|
{
|
||||||
testWidget->setDisplayFormat("dddd/MM");
|
testWidget->setDisplayFormat("dddd/MM");
|
||||||
@ -3040,6 +3043,7 @@ void tst_QDateTimeEdit::wheelEvent()
|
|||||||
qApp->sendEvent(testWidget, &w);
|
qApp->sendEvent(testWidget, &w);
|
||||||
QCOMPARE(testWidget->date(), QDate(2000, 3, 22));
|
QCOMPARE(testWidget->date(), QDate(2000, 3, 22));
|
||||||
}
|
}
|
||||||
|
#endif // !QT_NO_WHEELEVENT
|
||||||
|
|
||||||
void tst_QDateTimeEdit::specialValueCornerCase()
|
void tst_QDateTimeEdit::specialValueCornerCase()
|
||||||
{
|
{
|
||||||
|
@ -43,6 +43,9 @@ private slots:
|
|||||||
void convertRgb888ToRgb32_data();
|
void convertRgb888ToRgb32_data();
|
||||||
void convertRgb888ToRgb32();
|
void convertRgb888ToRgb32();
|
||||||
|
|
||||||
|
void convertRgb888ToRgbx8888_data();
|
||||||
|
void convertRgb888ToRgbx8888();
|
||||||
|
|
||||||
void convertRgb32ToRgb888_data();
|
void convertRgb32ToRgb888_data();
|
||||||
void convertRgb32ToRgb888();
|
void convertRgb32ToRgb888();
|
||||||
|
|
||||||
@ -74,8 +77,8 @@ void tst_QImageConversion::convertRgb888ToRgb32_data()
|
|||||||
// 16 pixels, minimum for the SSSE3 implementation
|
// 16 pixels, minimum for the SSSE3 implementation
|
||||||
QTest::newRow("width: 16px; height: 5000px;") << generateImageRgb888(16, 5000);
|
QTest::newRow("width: 16px; height: 5000px;") << generateImageRgb888(16, 5000);
|
||||||
|
|
||||||
// 50 pixels, more realistic use case
|
// 200 pixels, more realistic use case
|
||||||
QTest::newRow("width: 50px; height: 5000px;") << generateImageRgb888(50, 5000);
|
QTest::newRow("width: 200px; height: 5000px;") << generateImageRgb888(200, 5000);
|
||||||
|
|
||||||
// 2000 pixels -> typical values for pictures
|
// 2000 pixels -> typical values for pictures
|
||||||
QTest::newRow("width: 2000px; height: 2000px;") << generateImageRgb888(2000, 2000);
|
QTest::newRow("width: 2000px; height: 2000px;") << generateImageRgb888(2000, 2000);
|
||||||
@ -93,6 +96,23 @@ void tst_QImageConversion::convertRgb888ToRgb32()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QImageConversion::convertRgb888ToRgbx8888_data()
|
||||||
|
{
|
||||||
|
convertRgb888ToRgb32_data();
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QImageConversion::convertRgb888ToRgbx8888()
|
||||||
|
{
|
||||||
|
QFETCH(QImage, inputImage);
|
||||||
|
|
||||||
|
QBENCHMARK {
|
||||||
|
volatile QImage output = inputImage.convertToFormat(QImage::Format_RGBX8888);
|
||||||
|
// we need the volatile and the following to make sure the compiler does not do
|
||||||
|
// anything stupid :)
|
||||||
|
(void)output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QImageConversion::convertRgb32ToRgb888_data()
|
void tst_QImageConversion::convertRgb32ToRgb888_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QImage>("inputImage");
|
QTest::addColumn<QImage>("inputImage");
|
||||||
|
@ -147,29 +147,23 @@ void EventReportWidget::paintEvent(QPaintEvent *)
|
|||||||
|
|
||||||
void EventReportWidget::tabletEvent(QTabletEvent *event)
|
void EventReportWidget::tabletEvent(QTabletEvent *event)
|
||||||
{
|
{
|
||||||
|
|
||||||
QWidget::tabletEvent(event);
|
QWidget::tabletEvent(event);
|
||||||
QString type;
|
bool isMove = false;
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::TabletEnterProximity:
|
case QEvent::TabletEnterProximity:
|
||||||
type = QString::fromLatin1("TabletEnterProximity");
|
|
||||||
break;
|
|
||||||
case QEvent::TabletLeaveProximity:
|
case QEvent::TabletLeaveProximity:
|
||||||
type = QString::fromLatin1("TabletLeaveProximity");
|
|
||||||
break;
|
break;
|
||||||
case QEvent::TabletMove:
|
case QEvent::TabletMove:
|
||||||
type = QString::fromLatin1("TabletMove");
|
|
||||||
m_points.push_back(TabletPoint(event->pos(), TabletMove, m_lastButton, event->pointerType(), event->pressure(), event->rotation()));
|
m_points.push_back(TabletPoint(event->pos(), TabletMove, m_lastButton, event->pointerType(), event->pressure(), event->rotation()));
|
||||||
update();
|
update();
|
||||||
|
isMove = true;
|
||||||
break;
|
break;
|
||||||
case QEvent::TabletPress:
|
case QEvent::TabletPress:
|
||||||
type = QString::fromLatin1("TabletPress");
|
|
||||||
m_points.push_back(TabletPoint(event->pos(), TabletButtonPress, event->button(), event->pointerType(), event->rotation()));
|
m_points.push_back(TabletPoint(event->pos(), TabletButtonPress, event->button(), event->pointerType(), event->rotation()));
|
||||||
m_lastButton = event->button();
|
m_lastButton = event->button();
|
||||||
update();
|
update();
|
||||||
break;
|
break;
|
||||||
case QEvent::TabletRelease:
|
case QEvent::TabletRelease:
|
||||||
type = QString::fromLatin1("TabletRelease");
|
|
||||||
m_points.push_back(TabletPoint(event->pos(), TabletButtonRelease, event->button(), event->pointerType(), event->rotation()));
|
m_points.push_back(TabletPoint(event->pos(), TabletButtonRelease, event->button(), event->pointerType(), event->rotation()));
|
||||||
update();
|
update();
|
||||||
break;
|
break;
|
||||||
@ -178,84 +172,24 @@ void EventReportWidget::tabletEvent(QTabletEvent *event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString pointerType = "UNKNOWN";
|
if (!(isMove && m_lastIsTabletMove)) {
|
||||||
switch (event->pointerType()) {
|
QDebug d = qDebug();
|
||||||
case QTabletEvent::Pen:
|
d << event << " global position = " << event->globalPos()
|
||||||
pointerType = "Pen";
|
<< " cursor at " << QCursor::pos();
|
||||||
break;
|
if (event->button() != Qt::NoButton)
|
||||||
case QTabletEvent::Cursor:
|
d << " changed button " << event->button();
|
||||||
pointerType = "Cursor";
|
|
||||||
break;
|
|
||||||
case QTabletEvent::Eraser:
|
|
||||||
pointerType = "Eraser";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
m_lastIsTabletMove = isMove;
|
||||||
QString device = "UNKNOWN";
|
|
||||||
switch (event->device()) {
|
|
||||||
case QTabletEvent::Puck:
|
|
||||||
pointerType = "Puck";
|
|
||||||
break;
|
|
||||||
case QTabletEvent::Stylus:
|
|
||||||
pointerType = "Stylus";
|
|
||||||
break;
|
|
||||||
case QTabletEvent::Airbrush:
|
|
||||||
pointerType = "Airbrush";
|
|
||||||
break;
|
|
||||||
case QTabletEvent::FourDMouse:
|
|
||||||
pointerType = "FourDMouse";
|
|
||||||
break;
|
|
||||||
case QTabletEvent::RotationStylus:
|
|
||||||
pointerType = "RotationStylus";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_lastIsTabletMove)
|
|
||||||
qDebug() << "Tablet event, type = " << type
|
|
||||||
<< " position = " << event->pos()
|
|
||||||
<< " global position = " << event->globalPos()
|
|
||||||
<< " cursor at " << QCursor::pos()
|
|
||||||
<< " buttons " << event->buttons() << " changed " << event->button()
|
|
||||||
<< " pointer type " << pointerType << " device " << device;
|
|
||||||
|
|
||||||
m_lastIsTabletMove = (event->type() == QEvent::TabletMove);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventReportWidget::outputMouseEvent(QMouseEvent *event)
|
void EventReportWidget::outputMouseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QString type;
|
if (event->type() == QEvent::MouseMove) {
|
||||||
switch (event->type()) {
|
|
||||||
case QEvent::MouseButtonDblClick:
|
|
||||||
m_lastIsMouseMove = false;
|
|
||||||
type = QString::fromLatin1("MouseButtonDblClick");
|
|
||||||
break;
|
|
||||||
case QEvent::MouseButtonPress:
|
|
||||||
m_lastIsMouseMove = false;
|
|
||||||
type = QString::fromLatin1("MouseButtonPress");
|
|
||||||
break;
|
|
||||||
case QEvent::MouseButtonRelease:
|
|
||||||
m_lastIsMouseMove = false;
|
|
||||||
type = QString::fromLatin1("MouseButtonRelease");
|
|
||||||
break;
|
|
||||||
case QEvent::MouseMove:
|
|
||||||
if (m_lastIsMouseMove)
|
if (m_lastIsMouseMove)
|
||||||
return; // only show one move to keep things readable
|
return; // only show one move to keep things readable
|
||||||
|
|
||||||
m_lastIsMouseMove = true;
|
m_lastIsMouseMove = true;
|
||||||
type = QString::fromLatin1("MouseMove");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Q_ASSERT(false);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
qDebug() << event;
|
||||||
qDebug() << "Mouse event, type = " << type
|
|
||||||
<< " position = " << event->pos()
|
|
||||||
<< " global position = " << event->globalPos();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
Loading…
Reference in New Issue
Block a user