Merge remote-tracking branch 'origin/5.13' into dev

Change-Id: Icec0aa703d8a13efa9f1634a1a353eb9d63685c8
This commit is contained in:
Qt Forward Merge Bot 2019-03-01 01:00:53 +01:00
commit 7aa204d5b3
48 changed files with 14557 additions and 13828 deletions

View File

@ -17,7 +17,7 @@ QMAKE_EXTENSION_SHLIB = dylib
QMAKE_EXTENSIONS_AUX_SHLIB = tbd
QMAKE_LIBDIR =
# sdk.prf will prefix the proper SDK sysroot
# qtConfLibrary_openglMakeSpec will prefix the proper SDK sysroot
QMAKE_INCDIR_OPENGL = \
/System/Library/Frameworks/OpenGL.framework/Headers \
/System/Library/Frameworks/AGL.framework/Headers/

View File

@ -33,10 +33,6 @@ QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
sysrootified =
for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
QMAKE_INCDIR_OPENGL = $$sysrootified
QMAKESPEC_NAME = $$basename(QMAKESPEC)
# Resolve SDK version of various tools

View File

@ -1454,6 +1454,7 @@ void VcprojGenerator::initTranslationFiles()
vcProject.TranslationFiles.Guid = _GUIDTranslationFiles;
vcProject.TranslationFiles.addFiles(project->values("TRANSLATIONS"));
vcProject.TranslationFiles.addFiles(project->values("EXTRA_TRANSLATIONS"));
vcProject.TranslationFiles.Project = this;
vcProject.TranslationFiles.Config = &(vcProject.Configuration);
@ -1576,7 +1577,7 @@ void VcprojGenerator::initExtraCompilerOutputs()
const ProStringList &tmp_in = project->values(project->first(ProKey(*it + ".input")).toKey());
for (int i = 0; i < tmp_in.count(); ++i) {
const QString &filename = tmp_in.at(i).toQString();
if (extraCompilerSources.contains(filename))
if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename))
extraCompile.addFile(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(filename, tmp_out, QString(), NoShell), false));
}
@ -1592,7 +1593,7 @@ void VcprojGenerator::initExtraCompilerOutputs()
const ProStringList &tmp_in = project->values(inputVar.toKey());
for (int i = 0; i < tmp_in.count(); ++i) {
const QString &filename = tmp_in.at(i).toQString();
if (extraCompilerSources.contains(filename))
if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename))
extraCompile.addFile(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(filename, QString(), QString(), NoShell), false));
}
@ -1606,6 +1607,28 @@ void VcprojGenerator::initExtraCompilerOutputs()
}
}
bool VcprojGenerator::otherFiltersContain(const QString &fileName) const
{
auto filterFileMatches = [&fileName] (const VCFilterFile &ff)
{
return ff.file == fileName;
};
for (const VCFilter *filter : { &vcProject.RootFiles,
&vcProject.SourceFiles,
&vcProject.HeaderFiles,
&vcProject.GeneratedFiles,
&vcProject.LexYaccFiles,
&vcProject.TranslationFiles,
&vcProject.FormFiles,
&vcProject.ResourceFiles,
&vcProject.DeploymentFiles,
&vcProject.DistributionFiles}) {
if (std::any_of(filter->Files.cbegin(), filter->Files.cend(), filterFileMatches))
return true;
}
return false;
}
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------

View File

@ -132,6 +132,7 @@ private:
ProString firstInputFileName(const ProString &extraCompilerName) const;
QString firstExpandedOutputFileName(const ProString &extraCompilerName);
void createCustomBuildToolFakeFile(const QString &cbtFilePath, const QString &realOutFilePath);
bool otherFiltersContain(const QString &fileName) const;
friend class VCFilter;
};

View File

@ -14,7 +14,7 @@ libjpeg-turbo is covered by three compatible BSD-style open source licenses:
This license covers the TurboJPEG API library and associated programs, as
well as the build system.
- The zlib License, which is listed below
- The [zlib License](https://opensource.org/licenses/Zlib)
This license is a subset of the other two, and it covers the libjpeg-turbo
SIMD extensions.
@ -66,7 +66,7 @@ best of our understanding.
2. If your binary distribution includes or uses the TurboJPEG API, then
your product documentation must include the text of the Modified BSD
License.
License (see below.)
**Origin**
- Clause 2 of the Modified BSD License
@ -91,7 +91,8 @@ best of our understanding.
The Modified (3-clause) BSD License
===================================
Copyright (C)\<YEAR\> \<AUTHOR\>. All Rights Reserved.
Copyright (C)2009-2019 D. R. Commander. All Rights Reserved.
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@ -118,28 +119,6 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
The zlib License
================
Copyright (C) \<YEAR\>, \<AUTHOR\>.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Why Three Licenses?
===================

View File

@ -2,22 +2,22 @@
#define JPEG_LIB_VERSION 80
#define LIBJPEG_TURBO_VERSION 2.0.0
#define LIBJPEG_TURBO_VERSION 2.0.2
#define LIBJPEG_TURBO_VERSION_NUMBER 2000000
#define LIBJPEG_TURBO_VERSION_NUMBER 2000002
#define C_ARITH_CODING_SUPPORTED
#define C_ARITH_CODING_SUPPORTED 1
#define D_ARITH_CODING_SUPPORTED
#define D_ARITH_CODING_SUPPORTED 1
#define MEM_SRCDST_SUPPORTED
#define MEM_SRCDST_SUPPORTED 1
#define BITS_IN_JSAMPLE 8
#define HAVE_STDDEF_H
#define HAVE_STDDEF_H 1
#define HAVE_STDLIB_H
#define HAVE_STDLIB_H 1
#define HAVE_UNSIGNED_CHAR
#define HAVE_UNSIGNED_CHAR 1
#define HAVE_UNSIGNED_SHORT
#define HAVE_UNSIGNED_SHORT 1

View File

@ -6,11 +6,11 @@
"Description": "The Independent JPEG Group's JPEG software",
"Homepage": "http://libjpeg-turbo.virtualgl.org/",
"Version": "2.0.0",
"Version": "2.0.2",
"License": "Independent JPEG Group License",
"LicenseId": "IJG",
"LicenseFile": "LICENSE",
"Copyright": "Copyright (C) 2009-2018 D. R. Commander
"Copyright": "Copyright (C) 2009-2019 D. R. Commander
Copyright (C) 2011-2016 Siarhei Siamashka
Copyright (C) 2015-2016, 2018 Matthieu Darbois
Copyright (C) 2015 Intel Corporation

View File

@ -1,3 +1,73 @@
2.0.2
=====
### Significant changes relative to 2.0.1:
1. Fixed a regression introduced by 2.0.1[5] that prevented a runtime search
path (rpath) from being embedded in the libjpeg-turbo shared libraries and
executables for macOS and iOS. This caused a fatal error of the form
"dyld: Library not loaded" when attempting to use one of the executables,
unless `DYLD_LIBRARY_PATH` was explicitly set to the location of the
libjpeg-turbo shared libraries.
2. Fixed an integer overflow and subsequent segfault (CVE-2018-20330) that
occurred when attempting to load a BMP file with more than 1 billion pixels
using the `tjLoadImage()` function.
3. Fixed a buffer overrun (CVE-2018-19664) that occurred when attempting to
decompress a specially-crafted malformed JPEG image to a 256-color BMP using
djpeg.
4. Fixed a floating point exception that occurred when attempting to
decompress a specially-crafted malformed JPEG image with a specified image
width or height of 0 using the C version of TJBench.
5. The TurboJPEG API will now decompress 4:4:4 JPEG images with 2x1, 1x2, 3x1,
or 1x3 luminance and chrominance sampling factors. This is a non-standard way
of specifying 1x subsampling (normally 4:4:4 JPEGs have 1x1 luminance and
chrominance sampling factors), but the JPEG format and the libjpeg API both
allow it.
6. Fixed a regression introduced by 2.0 beta1[7] that caused djpeg to generate
incorrect PPM images when used with the `-colors` option.
7. Fixed an issue whereby a static build of libjpeg-turbo (a build in which
`ENABLE_SHARED` is `0`) could not be installed using the Visual Studio IDE.
8. Fixed a severe performance issue in the Loongson MMI SIMD extensions that
occurred when compressing RGB images whose image rows were not 64-bit-aligned.
2.0.1
=====
### Significant changes relative to 2.0.0:
1. Fixed a regression introduced with the new CMake-based Un*x build system,
whereby jconfig.h could cause compiler warnings of the form
`"HAVE_*_H" redefined` if it was included by downstream Autotools-based
projects that used `AC_CHECK_HEADERS()` to check for the existence of locale.h,
stddef.h, or stdlib.h.
2. The `jsimd_quantize_float_dspr2()` and `jsimd_convsamp_float_dspr2()`
functions in the MIPS DSPr2 SIMD extensions are now disabled at compile time
if the soft float ABI is enabled. Those functions use instructions that are
incompatible with the soft float ABI.
3. Fixed a regression in the SIMD feature detection code, introduced by
the AVX2 SIMD extensions (2.0 beta1[1]), that caused libjpeg-turbo to crash on
Windows 7 if Service Pack 1 was not installed.
4. Fixed out-of-bounds read in cjpeg that occurred when attempting to compress
a specially-crafted malformed color-index (8-bit-per-sample) Targa file in
which some of the samples (color indices) exceeded the bounds of the Targa
file's color table.
5. Fixed an issue whereby installing a fully static build of libjpeg-turbo
(a build in which `CFLAGS` contains `-static` and `ENABLE_SHARED` is `0`) would
fail with "No valid ELF RPATH or RUNPATH entry exists in the file."
2.0.0
=====

View File

@ -10,16 +10,16 @@
#define LIBJPEG_TURBO_VERSION_NUMBER @LIBJPEG_TURBO_VERSION_NUMBER@
/* Support arithmetic encoding */
#cmakedefine C_ARITH_CODING_SUPPORTED
#cmakedefine C_ARITH_CODING_SUPPORTED 1
/* Support arithmetic decoding */
#cmakedefine D_ARITH_CODING_SUPPORTED
#cmakedefine D_ARITH_CODING_SUPPORTED 1
/* Support in-memory source/destination managers */
#cmakedefine MEM_SRCDST_SUPPORTED
#cmakedefine MEM_SRCDST_SUPPORTED 1
/* Use accelerated SIMD routines. */
#cmakedefine WITH_SIMD
#cmakedefine WITH_SIMD 1
/*
* Define BITS_IN_JSAMPLE as either
@ -33,37 +33,37 @@
#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */
/* Define to 1 if you have the <locale.h> header file. */
#cmakedefine HAVE_LOCALE_H
#cmakedefine HAVE_LOCALE_H 1
/* Define to 1 if you have the <stddef.h> header file. */
#cmakedefine HAVE_STDDEF_H
#cmakedefine HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H
#cmakedefine HAVE_STDLIB_H 1
/* Define if you need to include <sys/types.h> to get size_t. */
#cmakedefine NEED_SYS_TYPES_H
#cmakedefine NEED_SYS_TYPES_H 1
/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
memset/memcpy in <string.h>. */
#cmakedefine NEED_BSD_STRINGS
#cmakedefine NEED_BSD_STRINGS 1
/* Define to 1 if the system has the type `unsigned char'. */
#cmakedefine HAVE_UNSIGNED_CHAR
#cmakedefine HAVE_UNSIGNED_CHAR 1
/* Define to 1 if the system has the type `unsigned short'. */
#cmakedefine HAVE_UNSIGNED_SHORT
#cmakedefine HAVE_UNSIGNED_SHORT 1
/* Compiler does not support pointers to undefined structures. */
#cmakedefine INCOMPLETE_TYPES_BROKEN
#cmakedefine INCOMPLETE_TYPES_BROKEN 1
/* Define if your (broken) compiler shifts signed values as if they were
unsigned. */
#cmakedefine RIGHT_SHIFT_IS_UNSIGNED
#cmakedefine RIGHT_SHIFT_IS_UNSIGNED 1
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
#cmakedefine __CHAR_UNSIGNED__
#cmakedefine __CHAR_UNSIGNED__ 1
#endif
/* Define to empty if `const' does not conform to ANSI C. */

View File

@ -592,7 +592,7 @@ ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
/* Declarations for ordered dithering
*
* We use a 4x4 ordered dither array packed into 32 bits. This array is
* sufficent for dithering RGB888 to RGB565.
* sufficient for dithering RGB888 to RGB565.
*/
#define DITHER_MASK 0x3

View File

@ -448,7 +448,7 @@ h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
/* Declarations for ordered dithering
*
* We use a 4x4 ordered dither array packed into 32 bits. This array is
* sufficent for dithering RGB888 to RGB565.
* sufficient for dithering RGB888 to RGB565.
*/
#define DITHER_MASK 0x3

View File

@ -154,7 +154,7 @@ typedef struct {
*/
boolean is_padded; /* is the colorindex padded for odither? */
int Ncolors[MAX_Q_COMPS]; /* # of values alloced to each component */
int Ncolors[MAX_Q_COMPS]; /* # of values allocated to each component */
/* Variables for ordered dithering */
int row_index; /* cur row's vertical index in dither matrix */

View File

@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright (C) 2010, 2012-2018, D. R. Commander.
* Copyright (C) 2010, 2012-2019, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -36,7 +36,7 @@
*/
#define JCOPYRIGHT \
"Copyright (C) 2009-2018 D. R. Commander\n" \
"Copyright (C) 2009-2019 D. R. Commander\n" \
"Copyright (C) 2011-2016 Siarhei Siamashka\n" \
"Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \
"Copyright (C) 2015 Intel Corporation\n" \
@ -49,4 +49,4 @@
"Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding"
#define JCOPYRIGHT_SHORT \
"Copyright (C) 1991-2018 The libjpeg-turbo Project and many others"
"Copyright (C) 1991-2019 The libjpeg-turbo Project and many others"

View File

@ -500,7 +500,9 @@ public:
AA_NativeWindows = 3,
AA_DontCreateNativeWidgetSiblings = 4,
AA_PluginApplication = 5,
AA_MacPluginApplication = AA_PluginApplication, // ### Qt 6: remove me
#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove me
AA_MacPluginApplication Q_DECL_ENUMERATOR_DEPRECATED = AA_PluginApplication,
#endif
AA_DontUseNativeMenuBar = 6,
AA_MacDontSwapCtrlAndMeta = 7,
AA_Use96Dpi = 8,
@ -1504,12 +1506,12 @@ public:
// Metadata
FontRole = 6,
TextAlignmentRole = 7,
#if QT_DEPRECATED_SINCE(5, 13)
BackgroundColorRole = 8,
TextColorRole = 9,
#endif
BackgroundRole = 8,
ForegroundRole = 9,
#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove me
BackgroundColorRole Q_DECL_ENUMERATOR_DEPRECATED = BackgroundRole,
TextColorRole Q_DECL_ENUMERATOR_DEPRECATED = ForegroundRole,
#endif
CheckStateRole = 10,
// Accessibility
AccessibleTextRole = 11,

View File

@ -20,7 +20,7 @@ supported by Qt (by the QNetworkCookieJar class).",
"Homepage": "Consult https://github.com/publicsuffix/list for the sha1 but download from ...",
"Homepage": "http://publicsuffix.org/",
"Version": "Generated on 2018-01-04",
"Version": "d6331e2b65fffbe9fe299dae1689db8de8fd6190, fetched on 2019-02-20",
"License": "Mozilla Public License 2.0",
"LicenseFile": "PSL-LICENSE.txt",
"LicenseId": "MPL-2.0",

File diff suppressed because it is too large Load Diff

View File

@ -2662,9 +2662,9 @@ QStringList QCoreApplication::libraryPaths()
QStringList *app_libpaths = new QStringList;
coreappdata()->app_libpaths.reset(app_libpaths);
const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
QString libPathEnv = qEnvironmentVariable("QT_PLUGIN_PATH");
if (!libPathEnv.isEmpty()) {
QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);
QStringList paths = libPathEnv.split(QDir::listSeparator(), QString::SkipEmptyParts);
for (QStringList::const_iterator it = paths.constBegin(); it != paths.constEnd(); ++it) {
QString canonicalPath = QDir(*it).canonicalPath();
if (!canonicalPath.isEmpty()

View File

@ -95,7 +95,7 @@ class QEventDispatcherWin32Private;
LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
QEventDispatcherWin32Private::QEventDispatcherWin32Private()
: threadId(GetCurrentThreadId()), interrupt(false), closingDown(false), internalHwnd(0),
: threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0),
getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0),
wakeUps(0), activateNotifiersPosted(false), winEventNotifierActivatedEvent(NULL)
{
@ -552,7 +552,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
wakeUp(); // trigger a call to sendPostedEvents()
}
d->interrupt = false;
d->interrupt.store(false);
emit awake();
bool canWait;
@ -568,7 +568,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
pHandles = &d->winEventNotifierActivatedEvent;
}
QVarLengthArray<MSG> processedTimers;
while (!d->interrupt) {
while (!d->interrupt.load()) {
MSG msg;
bool haveMessage;
@ -649,7 +649,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
// still nothing - wait for message or signalled objects
canWait = (!retVal
&& !d->interrupt
&& !d->interrupt.load()
&& (flags & QEventLoop::WaitForMoreEvents));
if (canWait) {
emit aboutToBlock();
@ -1022,7 +1022,7 @@ void QEventDispatcherWin32::wakeUp()
void QEventDispatcherWin32::interrupt()
{
Q_D(QEventDispatcherWin32);
d->interrupt = true;
d->interrupt.store(true);
wakeUp();
}

View File

@ -165,8 +165,7 @@ public:
DWORD threadId;
bool interrupt;
bool closingDown;
QAtomicInt interrupt;
// internal window handle used for socketnotifiers/timers/etc
HWND internalHwnd;
@ -193,9 +192,11 @@ public:
void postActivateSocketNotifiers();
void doWsaAsyncSelect(int socket, long event);
bool closingDown = false;
bool winEventNotifierListModified = false;
HANDLE winEventNotifierActivatedEvent;
QList<QWinEventNotifier *> winEventNotifierList;
bool winEventNotifierListModified = false;
void activateEventNotifier(QWinEventNotifier * wen);
QList<MSG> queuedUserInputEvents;

View File

@ -2129,8 +2129,10 @@ void QObject::removeEventFilter(QObject *obj)
Note that entering and leaving a new event loop (e.g., by opening a modal
dialog) will \e not perform the deferred deletion; for the object to be
deleted, the control must return to the event loop from which
deleteLater() was called.
deleted, the control must return to the event loop from which deleteLater()
was called. This does not apply to objects deleted while a previous, nested
event loop was still running: the Qt event loop will delete those objects
as soon as the new nested event loop starts.
\b{Note:} It is safe to call this function more than once; when the
first deferred deletion event is delivered, any pending events for the

View File

@ -433,7 +433,7 @@
],
"sources": [
{ "type": "pkgConfig", "args": "gl", "condition": "!config.darwin" },
{ "type": "makeSpec", "spec": "OPENGL" }
{ "type": "openglMakeSpec" }
]
},
"opengl_es2": {

View File

@ -15,6 +15,17 @@ defineTest(qtConfLibrary_freetype) {
return(true)
}
defineTest(qtConfLibrary_openglMakeSpec) {
darwin:sdk {
sysrootified =
for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
QMAKE_INCDIR_OPENGL = $$sysrootified
}
$${1}.spec = OPENGL
!qtConfLibrary_makeSpec($$1, $$2): return(false)
return(true)
}
# Check for Direct X shader compiler 'fxc'.
# Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
# DXSDK_DIR variable. Starting with Windows Kit 8, it is included in

View File

@ -695,13 +695,29 @@ QList<QTouchEvent::TouchPoint>
}
if (states == Qt::TouchPointReleased) {
g_nextPointId = 1;
g_pointIdMap->clear();
// All points on deviceId have been released.
// Remove all points associated with that device from g_pointIdMap.
// (On other devices, some touchpoints might still be pressed.
// But this function is only called with points from one device at a time.)
for (auto it = g_pointIdMap->begin(); it != g_pointIdMap->end();) {
if (it.key() >> 32 == quint64(deviceId))
it = g_pointIdMap->erase(it);
else
++it;
}
if (g_pointIdMap->isEmpty())
g_nextPointId = 1;
}
return touchPoints;
}
void QWindowSystemInterfacePrivate::clearPointIdMap()
{
g_pointIdMap->clear();
g_nextPointId = 1;
}
QList<QWindowSystemInterface::TouchPoint>
QWindowSystemInterfacePrivate::toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList,
const QWindow *window)

View File

@ -537,6 +537,7 @@ public:
static QList<QWindowSystemInterface::TouchPoint>
toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList,
const QWindow *window);
static void clearPointIdMap();
static void installWindowSystemEventHandler(QWindowSystemEventHandler *handler);
static void removeWindowSystemEventhandler(QWindowSystemEventHandler *handler);

View File

@ -297,7 +297,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block)
QSyntaxHighlighter::QSyntaxHighlighter(QObject *parent)
: QObject(*new QSyntaxHighlighterPrivate, parent)
{
if (parent->inherits("QTextEdit")) {
if (parent && parent->inherits("QTextEdit")) {
QTextDocument *doc = parent->property("document").value<QTextDocument *>();
if (doc)
setDocument(doc);

View File

@ -0,0 +1,168 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qastchandler_p.h"
#include "qtexturefiledata_p.h"
#include <private/qnumeric_p.h>
#include <QFile>
#include <QDebug>
#include <QSize>
QT_BEGIN_NAMESPACE
struct AstcHeader
{
quint8 magic[4];
quint8 blockDimX;
quint8 blockDimY;
quint8 blockDimZ;
quint8 xSize[3];
quint8 ySize[3];
quint8 zSize[3];
};
bool QAstcHandler::canRead(const QByteArray &suffix, const QByteArray &block)
{
Q_UNUSED(suffix)
return block.startsWith("\x13\xAB\xA1\x5C");
}
quint32 QAstcHandler::astcGLFormat(quint8 xBlockDim, quint8 yBlockDim) const
{
static const quint32 glFormatRGBABase = 0x93B0; // GL_COMPRESSED_RGBA_ASTC_4x4_KHR
static const quint32 glFormatSRGBBase = 0x93D0; // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
static QSize dims[14] = {
{ 4, 4 }, // GL_COMPRESSED_xxx_ASTC_4x4_KHR
{ 5, 4 }, // GL_COMPRESSED_xxx_ASTC_5x4_KHR
{ 5, 5 }, // GL_COMPRESSED_xxx_ASTC_5x5_KHR
{ 6, 5 }, // GL_COMPRESSED_xxx_ASTC_6x5_KHR
{ 6, 6 }, // GL_COMPRESSED_xxx_ASTC_6x6_KHR
{ 8, 5 }, // GL_COMPRESSED_xxx_ASTC_8x5_KHR
{ 8, 6 }, // GL_COMPRESSED_xxx_ASTC_8x6_KHR
{ 8, 8 }, // GL_COMPRESSED_xxx_ASTC_8x8_KHR
{ 10, 5 }, // GL_COMPRESSED_xxx_ASTC_10x5_KHR
{ 10, 6 }, // GL_COMPRESSED_xxx_ASTC_10x6_KHR
{ 10, 8 }, // GL_COMPRESSED_xxx_ASTC_10x8_KHR
{ 10, 10 }, // GL_COMPRESSED_xxx_ASTC_10x10_KHR
{ 12, 10 }, // GL_COMPRESSED_xxx_ASTC_12x10_KHR
{ 12, 12 } // GL_COMPRESSED_xxx_ASTC_12x12_KHR
};
const QSize dim(xBlockDim, yBlockDim);
int index = -1;
for (int i = 0; i < 14; i++) {
if (dim == dims[i]) {
index = i;
break;
}
}
if (index < 0)
return 0;
bool useSrgb = qEnvironmentVariableIsSet("QT_ASTCHANDLER_USE_SRGB")
|| logName().toLower().contains("srgb");
return useSrgb ? (glFormatSRGBBase + index) : (glFormatRGBABase + index);
}
QTextureFileData QAstcHandler::read()
{
QTextureFileData nullData;
QTextureFileData res;
if (!device())
return nullData;
QByteArray fileData = device()->readAll();
if (fileData.size() < int(sizeof(AstcHeader)) || !canRead(QByteArray(), fileData)) {
qCDebug(lcQtGuiTextureIO, "Not an ASTC file: %s", logName().constData());
return nullData;
}
res.setData(fileData);
const AstcHeader *header = reinterpret_cast<const AstcHeader *>(fileData.constData());
int xSz = int(header->xSize[0]) | int(header->xSize[1]) << 8 | int(header->xSize[2]) << 16;
int ySz = int(header->ySize[0]) | int(header->ySize[1]) << 8 | int(header->ySize[2]) << 16;
int zSz = int(header->zSize[0]) | int(header->zSize[1]) << 8 | int(header->zSize[2]) << 16;
quint32 glFmt = astcGLFormat(header->blockDimX, header->blockDimY);
if (!xSz || !ySz || !zSz || !glFmt || header->blockDimZ != 1) {
qCDebug(lcQtGuiTextureIO, "Invalid ASTC header data in file %s", logName().constData());
return nullData;
}
res.setSize(QSize(xSz, ySz));
res.setGLFormat(0); // 0 for compressed textures
res.setGLInternalFormat(glFmt);
//? BaseInternalFormat
int xBlocks = (xSz + header->blockDimX - 1) / header->blockDimX;
int yBlocks = (ySz + header->blockDimY - 1) / header->blockDimY;
int zBlocks = (zSz + header->blockDimZ - 1) / header->blockDimZ;
int byteCount = 0;
bool oob = mul_overflow(xBlocks, yBlocks, &byteCount)
|| mul_overflow(byteCount, zBlocks, &byteCount)
|| mul_overflow(byteCount, 16, &byteCount);
res.setDataOffset(sizeof(AstcHeader));
res.setNumLevels(1);
res.setDataLength(byteCount);
if (oob || !res.isValid()) {
qCDebug(lcQtGuiTextureIO, "Invalid ASTC file %s", logName().constData());
return nullData;
}
res.setLogName(logName());
#if 0
qDebug() << "ASTC file handler read" << res << res.dataOffset() << res.dataLength();
#endif
return res;
}
QT_END_NAMESPACE

View File

@ -0,0 +1,73 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QASTCHANDLER_H
#define QASTCHANDLER_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "qtexturefilehandler_p.h"
QT_BEGIN_NAMESPACE
class QAstcHandler : public QTextureFileHandler
{
public:
using QTextureFileHandler::QTextureFileHandler;
static bool canRead(const QByteArray &suffix, const QByteArray &block);
QTextureFileData read() override;
private:
quint32 astcGLFormat(quint8 xBlockDim, quint8 yBlockDim) const;
};
QT_END_NAMESPACE
#endif // QASTCHANDLER_H

View File

@ -41,6 +41,7 @@
#include "qpkmhandler_p.h"
#include "qktxhandler_p.h"
#include "qastchandler_p.h"
#include <QFileInfo>
@ -80,6 +81,8 @@ bool QTextureFileReader::canRead()
m_handler = new QPkmHandler(m_device, logName);
} else if (QKtxHandler::canRead(suffix, headerBlock)) {
m_handler = new QKtxHandler(m_device, logName);
} else if (QAstcHandler::canRead(suffix, headerBlock)) {
m_handler = new QAstcHandler(m_device, logName);
}
// else if OtherHandler::canRead() ...etc.
}
@ -89,7 +92,7 @@ bool QTextureFileReader::canRead()
QList<QByteArray> QTextureFileReader::supportedFileFormats()
{
// Hardcoded for now
return {QByteArrayLiteral("pkm"), QByteArrayLiteral("ktx")};
return {QByteArrayLiteral("pkm"), QByteArrayLiteral("ktx"), QByteArrayLiteral("astc")};
}
bool QTextureFileReader::init()

View File

@ -19,7 +19,8 @@ HEADERS += \
util/qtexturefilereader_p.h \
util/qtexturefilehandler_p.h \
util/qpkmhandler_p.h \
util/qktxhandler_p.h
util/qktxhandler_p.h \
util/qastchandler_p.h
SOURCES += \
util/qdesktopservices.cpp \
@ -38,4 +39,5 @@ SOURCES += \
util/qtexturefiledata.cpp \
util/qtexturefilereader.cpp \
util/qpkmhandler.cpp \
util/qktxhandler.cpp
util/qktxhandler.cpp \
util/qastchandler.cpp

View File

@ -5,6 +5,6 @@ qtHaveModule(dbus) {
!mac:!win32:SUBDIRS += ibus
}
qtConfig(xcb): SUBDIRS += compose
qtConfig(xkbcommon): SUBDIRS += compose

View File

@ -62,9 +62,6 @@ QEglFSScreen::QEglFSScreen(EGLDisplay dpy)
QEglFSScreen::~QEglFSScreen()
{
delete m_cursor;
#ifndef QT_NO_OPENGL
QOpenGLCompositor::destroy();
#endif
}
QRect QEglFSScreen::geometry() const

View File

@ -62,6 +62,7 @@ QEglFSWindow::QEglFSWindow(QWindow *w)
: QPlatformWindow(w),
#ifndef QT_NO_OPENGL
m_backingStore(0),
m_rasterCompositingContext(0),
#endif
m_raster(false),
m_winId(0),
@ -144,18 +145,18 @@ void QEglFSWindow::create()
#ifndef QT_NO_OPENGL
if (isRaster()) {
QOpenGLContext *context = new QOpenGLContext(QGuiApplication::instance());
context->setShareContext(qt_gl_global_share_context());
context->setFormat(m_format);
context->setScreen(window()->screen());
if (Q_UNLIKELY(!context->create()))
m_rasterCompositingContext = new QOpenGLContext;
m_rasterCompositingContext->setShareContext(qt_gl_global_share_context());
m_rasterCompositingContext->setFormat(m_format);
m_rasterCompositingContext->setScreen(window()->screen());
if (Q_UNLIKELY(!m_rasterCompositingContext->create()))
qFatal("EGLFS: Failed to create compositing context");
compositor->setTarget(context, window(), screen->rawGeometry());
compositor->setTarget(m_rasterCompositingContext, window(), screen->rawGeometry());
compositor->setRotation(qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"));
// If there is a "root" window into which raster and QOpenGLWidget content is
// composited, all other contexts must share with its context.
if (!qt_gl_global_share_context()) {
qt_gl_set_global_share_context(context);
qt_gl_set_global_share_context(m_rasterCompositingContext);
// What we set up here is in effect equivalent to the application setting
// AA_ShareOpenGLContexts. Set the attribute to be fully consistent.
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
@ -166,6 +167,10 @@ void QEglFSWindow::create()
void QEglFSWindow::destroy()
{
#ifndef QT_NO_OPENGL
QOpenGLCompositor::instance()->removeWindow(this);
#endif
QEglFSScreen *screen = this->screen();
if (m_flags.testFlag(HasNativeWindow)) {
#ifndef QT_NO_OPENGL
@ -177,12 +182,14 @@ void QEglFSWindow::destroy()
screen->setPrimarySurface(EGL_NO_SURFACE);
invalidateSurface();
#ifndef QT_NO_OPENGL
QOpenGLCompositor::destroy();
delete m_rasterCompositingContext;
#endif
}
m_flags = 0;
#ifndef QT_NO_OPENGL
QOpenGLCompositor::instance()->removeWindow(this);
#endif
}
void QEglFSWindow::invalidateSurface()

View File

@ -116,6 +116,7 @@ public:
protected:
#ifndef QT_NO_OPENGL
QOpenGLCompositorBackingStore *m_backingStore;
QOpenGLContext *m_rasterCompositingContext;
#endif
bool m_raster;
WId m_winId;

View File

@ -1,6 +1,6 @@
TARGET = qhaiku
QT += core-private gui-private eventdistpatcher_support-private
QT += core-private gui-private eventdispatcher_support-private
SOURCES = \
main.cpp \

View File

@ -550,8 +550,11 @@ void QWasmEventTranslator::processMouse(int eventType, const EmscriptenMouseEven
switch (eventType) {
case EMSCRIPTEN_EVENT_MOUSEDOWN:
{
if (window2)
if (window2) {
window2->raise();
if (!window2->isActive())
window2->requestActivate();
}
pressedButtons.setFlag(button);
@ -828,16 +831,30 @@ bool QWasmEventTranslator::processKeyboard(int eventType, const EmscriptenKeyboa
if (keyType == QEvent::None)
return 0;
QFlags<Qt::KeyboardModifier> mods = translateKeyboardEventModifier(keyEvent);
bool accepted = false;
if (keyText.isEmpty())
keyText = QString(keyEvent->key);
if (keyText.size() > 1)
keyText.clear();
accepted = QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(
0, keyType, qtKey, modifiers, keyText);
if (keyType == QEvent::KeyPress &&
mods.testFlag(Qt::ControlModifier)
&& qtKey == Qt::Key_V) {
QWasmIntegration::get()->getWasmClipboard()->readTextFromClipboard();
} else {
if (keyText.isEmpty())
keyText = QString(keyEvent->key);
if (keyText.size() > 1)
keyText.clear();
accepted = QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(
0, keyType, qtKey, modifiers, keyText);
}
if (keyType == QEvent::KeyPress &&
mods.testFlag(Qt::ControlModifier)
&& qtKey == Qt::Key_C) {
QWasmIntegration::get()->getWasmClipboard()->writeTextToClipboard();
}
QWasmEventDispatcher::maintainTimers();
return accepted ? 1 : 0;
return accepted;
}
QT_END_NAMESPACE

View File

@ -1099,6 +1099,12 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return false;
case QtWindows::ClipboardEvent:
return false;
case QtWindows::CursorEvent: // Sent to windows that do not have capture (see QTBUG-58590).
if (QWindowsCursor::hasOverrideCursor()) {
QWindowsCursor::enforceOverrideCursor();
return true;
}
break;
case QtWindows::UnknownEvent:
return false;
case QtWindows::AccessibleObjectFromWindowRequest:

View File

@ -1912,7 +1912,7 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
bool click = (index == d->pressedIndex && index.isValid());
bool selectedClicked = click && (event->button() == Qt::LeftButton) && d->pressedAlreadySelected;
EditTrigger trigger = (selectedClicked ? SelectedClicked : NoEditTriggers);
bool edited = edit(index, trigger, event);
const bool edited = click ? edit(index, trigger, event) : false;
d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate;

View File

@ -1315,8 +1315,8 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl
if (tl.isValid() && br.isValid()
&& d->isIndexEnabled(tl)
&& d->isIndexEnabled(br)) {
QRect first = rectForIndex(tl);
QRect last = rectForIndex(br);
QRect first = d->cellRectForIndex(tl);
QRect last = d->cellRectForIndex(br);
QRect middle;
if (d->flow == LeftToRight) {
QRect &top = first;

View File

@ -333,14 +333,31 @@ public:
inline QModelIndex listViewItemToIndex(const QListViewItem &item) const
{ return model->index(commonListView->itemIndex(item), column, root); }
inline bool hasRectForIndex(const QModelIndex &index) const
{
return isIndexValid(index) && index.parent() == root && index.column() == column && !isHidden(index.row());
}
QRect rectForIndex(const QModelIndex &index) const
{
if (!isIndexValid(index) || index.parent() != root || index.column() != column || isHidden(index.row()))
if (!hasRectForIndex(index))
return QRect();
executePostedLayout();
return viewItemRect(indexToListViewItem(index));
}
QRect cellRectForIndex(const QModelIndex &index)
{
if (!hasRectForIndex(index))
return QRect();
executePostedLayout();
auto oldItemAlignment = itemAlignment;
itemAlignment = Qt::Alignment();
const QRect rect = rectForIndex(index);
itemAlignment = oldItemAlignment;
return rect;
}
void viewUpdateGeometries() { q_func()->updateGeometries(); }

View File

@ -141,8 +141,10 @@ public:
PE_FrameGroupBox,
PE_FrameLineEdit,
PE_FrameMenu,
PE_FrameStatusBar, // ### Qt 6: remove
PE_FrameStatusBarItem = PE_FrameStatusBar,
PE_FrameStatusBarItem,
#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
PE_FrameStatusBar Q_DECL_ENUMERATOR_DEPRECATED = PE_FrameStatusBarItem,
#endif
PE_FrameTabWidget,
PE_FrameWindow,
PE_FrameButtonBevel,
@ -162,8 +164,10 @@ public:
PE_IndicatorArrowUp,
PE_IndicatorBranch,
PE_IndicatorButtonDropDown,
PE_IndicatorViewItemCheck, // ### Qt 6: remove
PE_IndicatorItemViewItemCheck = PE_IndicatorViewItemCheck,
PE_IndicatorItemViewItemCheck,
#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
PE_IndicatorViewItemCheck Q_DECL_ENUMERATOR_DEPRECATED = PE_IndicatorItemViewItemCheck,
#endif
PE_IndicatorCheckBox,
PE_IndicatorDockWidgetResizeHandle,
PE_IndicatorHeaderArrow,
@ -309,8 +313,9 @@ public:
SE_TabWidgetRightCorner,
SE_ItemViewItemCheckIndicator,
SE_ViewItemCheckIndicator = SE_ItemViewItemCheckIndicator, // ### Qt 6: remove
#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
SE_ViewItemCheckIndicator Q_DECL_ENUMERATOR_DEPRECATED = SE_ItemViewItemCheckIndicator,
#endif
SE_TabBarTearIndicator,
SE_TabBarTearIndicatorLeft = SE_TabBarTearIndicator,
@ -506,9 +511,11 @@ public:
PM_DialogButtonsButtonHeight,
PM_MdiSubWindowFrameWidth,
PM_MDIFrameWidth = PM_MdiSubWindowFrameWidth, // ### Qt 6: remove
PM_MdiSubWindowMinimizedWidth,
PM_MDIMinimizedWidth = PM_MdiSubWindowMinimizedWidth, // ### Qt 6: remove
#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
PM_MDIFrameWidth Q_DECL_ENUMERATOR_DEPRECATED = PM_MdiSubWindowFrameWidth,
PM_MDIMinimizedWidth Q_DECL_ENUMERATOR_DEPRECATED = PM_MdiSubWindowMinimizedWidth,
#endif
PM_HeaderMargin,
PM_HeaderMarkSize,
@ -649,7 +656,9 @@ public:
SH_ComboBox_Popup,
SH_TitleBar_NoBorder,
SH_Slider_StopMouseOverSlider,
SH_ScrollBar_StopMouseOverSlider = SH_Slider_StopMouseOverSlider, // ### Qt 6: remove
#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
SH_ScrollBar_StopMouseOverSlider Q_DECL_ENUMERATOR_DEPRECATED = SH_Slider_StopMouseOverSlider,
#endif
SH_BlinkCursorWhenTextSelected,
SH_RichText_FullWidthSelection,
SH_Menu_Scrollable,

View File

@ -3402,6 +3402,21 @@ void tst_QUrl::effectiveTLDs_data()
QTest::newRow("yes16") << QUrl::fromEncoded("http://anything.pagespeedmobilizer.com") << ".pagespeedmobilizer.com";
QTest::newRow("yes17") << QUrl::fromEncoded("http://anything.eu-central-1.compute.amazonaws.com") << ".eu-central-1.compute.amazonaws.com";
QTest::newRow("yes18") << QUrl::fromEncoded("http://anything.ltd.hk") << ".ltd.hk";
QTest::newRow("trentino.it")
<< QUrl::fromEncoded("http://any.thing.trentino.it") << ".trentino.it";
QTest::newRow("net.ni") << QUrl::fromEncoded("http://test.net.ni") << ".net.ni";
QTest::newRow("dyn.cosidns.de")
<< QUrl::fromEncoded("http://test.dyn.cosidns.de") << ".dyn.cosidns.de";
QTest::newRow("freeddns.org")
<< QUrl::fromEncoded("http://test.freeddns.org") << ".freeddns.org";
QTest::newRow("app.os.stg.fedoraproject.org")
<< QUrl::fromEncoded("http://test.app.os.stg.fedoraproject.org")
<< ".app.os.stg.fedoraproject.org";
QTest::newRow("development.run") << QUrl::fromEncoded("http://test.development.run") << ".development.run";
QTest::newRow("crafting.xyz") << QUrl::fromEncoded("http://test.crafting.xyz") << ".crafting.xyz";
QTest::newRow("nym.ie") << QUrl::fromEncoded("http://shamus.nym.ie") << ".nym.ie";
QTest::newRow("vapor.cloud") << QUrl::fromEncoded("http://test.vapor.cloud") << ".vapor.cloud";
QTest::newRow("official.academy") << QUrl::fromEncoded("http://acredited.official.academy") << ".official.academy";
}
void tst_QUrl::effectiveTLDs()

View File

@ -204,6 +204,7 @@ private slots:
void basicRawEventTranslationOfIds();
void multiPointRawEventTranslationOnTouchScreen();
void multiPointRawEventTranslationOnTouchPad();
void touchOnMultipleTouchscreens();
void deleteInEventHandler();
void deleteInRawEventTranslation();
void crashInQGraphicsSceneAfterNotHandlingTouchBegin();
@ -213,11 +214,13 @@ private slots:
private:
QTouchDevice *touchScreenDevice;
QTouchDevice *secondaryTouchScreenDevice;
QTouchDevice *touchPadDevice;
};
tst_QTouchEvent::tst_QTouchEvent()
: touchScreenDevice(QTest::createTouchDevice())
, secondaryTouchScreenDevice(QTest::createTouchDevice())
, touchPadDevice(QTest::createTouchDevice(QTouchDevice::TouchPad))
{
}
@ -225,6 +228,7 @@ tst_QTouchEvent::tst_QTouchEvent()
void tst_QTouchEvent::cleanup()
{
QVERIFY(QGuiApplication::topLevelWindows().isEmpty());
QWindowSystemInterfacePrivate::clearPointIdMap();
}
void tst_QTouchEvent::qPointerUniqueId()
@ -951,6 +955,157 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
}
}
void tst_QTouchEvent::touchOnMultipleTouchscreens()
{
tst_QTouchEventWidget touchWidget;
touchWidget.setWindowTitle(QTest::currentTestFunction());
touchWidget.setAttribute(Qt::WA_AcceptTouchEvents);
touchWidget.setGeometry(100, 100, 400, 300);
touchWidget.show();
QVERIFY(QTest::qWaitForWindowExposed(&touchWidget));
QWindow *window = touchWidget.windowHandle();
QPointF pos = touchWidget.rect().center();
QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint());
QPointF delta(10, 10);
QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget);
QVector<QTouchEvent::TouchPoint> rawTouchPoints(3);
rawTouchPoints[0].setId(0);
rawTouchPoints[1].setId(10);
rawTouchPoints[2].setId(11);
// this should be translated to a TouchBegin
rawTouchPoints[0].setState(Qt::TouchPointPressed);
rawTouchPoints[0].setScreenPos(screenPos);
rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
rawTouchPoints[0].setRawScreenPositions({{12, 34}, {56, 78}});
ulong timestamp = 1234;
QList<QWindowSystemInterface::TouchPoint> nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[0], window);
QWindowSystemInterface::handleTouchEvent(window, timestamp, touchScreenDevice, nativeTouchPoints);
QCoreApplication::processEvents();
QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd);
QCOMPARE(touchWidget.touchBeginPoints.count(), 1);
QCOMPARE(touchWidget.timestamp, timestamp);
QTouchEvent::TouchPoint touchBeginPoint = touchWidget.touchBeginPoints.first();
const int touchPointId = (QTouchDevicePrivate::get(touchScreenDevice)->id << 24) + 1;
const int secTouchPointId = (QTouchDevicePrivate::get(secondaryTouchScreenDevice)->id << 24) + 2;
QCOMPARE(touchBeginPoint.id(), touchPointId);
QCOMPARE(touchBeginPoint.state(), rawTouchPoints[0].state());
QCOMPARE(touchBeginPoint.pos(), pos);
// press a point on secondaryTouchScreenDevice
touchWidget.seenTouchBegin = false;
rawTouchPoints[1].setState(Qt::TouchPointPressed);
rawTouchPoints[1].setScreenPos(screenPos);
rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry));
rawTouchPoints[1].setRawScreenPositions({{90, 100}, {110, 120}});
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[1], window);
QWindowSystemInterface::handleTouchEvent(window, ++timestamp, secondaryTouchScreenDevice, nativeTouchPoints);
QCoreApplication::processEvents();
QVERIFY(!touchWidget.seenTouchEnd);
QCOMPARE(touchWidget.touchBeginPoints.count(), 1);
QCOMPARE(touchWidget.timestamp, timestamp);
touchBeginPoint = touchWidget.touchBeginPoints[0];
QCOMPARE(touchBeginPoint.id(), (QTouchDevicePrivate::get(secondaryTouchScreenDevice)->id << 24) + 2);
QCOMPARE(touchBeginPoint.state(), rawTouchPoints[1].state());
QCOMPARE(touchBeginPoint.pos(), pos);
// press another point on secondaryTouchScreenDevice
touchWidget.seenTouchBegin = false;
rawTouchPoints[2].setState(Qt::TouchPointPressed);
rawTouchPoints[2].setScreenPos(screenPos);
rawTouchPoints[2].setNormalizedPos(normalized(rawTouchPoints[2].pos(), screenGeometry));
rawTouchPoints[2].setRawScreenPositions({{130, 140}, {150, 160}});
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[2], window);
QWindowSystemInterface::handleTouchEvent(window, ++timestamp, secondaryTouchScreenDevice, nativeTouchPoints);
QCoreApplication::processEvents();
QVERIFY(!touchWidget.seenTouchEnd);
QCOMPARE(touchWidget.touchBeginPoints.count(), 1);
QCOMPARE(touchWidget.timestamp, timestamp);
touchBeginPoint = touchWidget.touchBeginPoints[0];
QCOMPARE(touchBeginPoint.id(), (QTouchDevicePrivate::get(secondaryTouchScreenDevice)->id << 24) + 3);
QCOMPARE(touchBeginPoint.state(), rawTouchPoints[2].state());
QCOMPARE(touchBeginPoint.pos(), pos);
// moving the first point should translate to TouchUpdate
rawTouchPoints[0].setState(Qt::TouchPointMoved);
rawTouchPoints[0].setScreenPos(screenPos + delta);
rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[0], window);
QWindowSystemInterface::handleTouchEvent(window, ++timestamp, touchScreenDevice, nativeTouchPoints);
QCoreApplication::processEvents();
QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd);
QCOMPARE(touchWidget.touchUpdatePoints.count(), 1);
QTouchEvent::TouchPoint touchUpdatePoint = touchWidget.touchUpdatePoints.first();
QCOMPARE(touchUpdatePoint.id(), touchPointId);
QCOMPARE(touchUpdatePoint.state(), rawTouchPoints[0].state());
QCOMPARE(touchUpdatePoint.pos(), pos + delta);
// releasing the first point translates to TouchEnd
rawTouchPoints[0].setState(Qt::TouchPointReleased);
rawTouchPoints[0].setScreenPos(screenPos + delta + delta);
rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry));
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[0], window);
QWindowSystemInterface::handleTouchEvent(window, ++timestamp, touchScreenDevice, nativeTouchPoints);
QCoreApplication::processEvents();
QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(touchWidget.seenTouchUpdate);
QVERIFY(touchWidget.seenTouchEnd);
QCOMPARE(touchWidget.touchEndPoints.count(), 1);
QTouchEvent::TouchPoint touchEndPoint = touchWidget.touchEndPoints.first();
QCOMPARE(touchEndPoint.id(), touchPointId);
QCOMPARE(touchEndPoint.state(), rawTouchPoints[0].state());
QCOMPARE(touchEndPoint.pos(), pos + delta + delta);
// Widgets don't normally handle this case: if a TouchEnd was seen before, then
// WA_WState_AcceptedTouchBeginEvent will be false, and
// QApplicationPrivate::translateRawTouchEvent will ignore touch events that aren't TouchBegin.
// So we have to set it true. It _did_ in fact accept the touch begin from the secondary device,
// but it also got a TouchEnd from the primary device in the meantime.
touchWidget.setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, true);
// Releasing one point on the secondary touchscreen does not yet generate TouchEnd.
touchWidget.seenTouchEnd = false;
touchWidget.touchEndPoints.clear();
rawTouchPoints[1].setState(Qt::TouchPointReleased);
rawTouchPoints[2].setState(Qt::TouchPointStationary);
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[1] << rawTouchPoints[2], window);
QWindowSystemInterface::handleTouchEvent(window, ++timestamp, secondaryTouchScreenDevice, nativeTouchPoints);
QCoreApplication::processEvents();
QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd);
QCOMPARE(touchWidget.touchUpdatePoints.count(), 2);
QCOMPARE(touchWidget.touchUpdatePoints[0].id(), secTouchPointId);
QCOMPARE(touchWidget.touchUpdatePoints[1].id(), secTouchPointId + 1);
// releasing the last point on the secondary touchscreen translates to TouchEnd
touchWidget.seenTouchEnd = false;
rawTouchPoints[2].setState(Qt::TouchPointReleased);
nativeTouchPoints =
QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[2], window);
QWindowSystemInterface::handleTouchEvent(window, ++timestamp, secondaryTouchScreenDevice, nativeTouchPoints);
QCoreApplication::processEvents();
QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(touchWidget.seenTouchUpdate);
QVERIFY(touchWidget.seenTouchEnd);
QCOMPARE(touchWidget.touchEndPoints.count(), 1);
touchEndPoint = touchWidget.touchEndPoints.first();
QCOMPARE(touchEndPoint.id(), secTouchPointId + 1);
QCOMPARE(touchEndPoint.state(), rawTouchPoints[2].state());
}
void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
{
tst_QTouchEventWidget touchWidget;

View File

@ -3,5 +3,7 @@
<file>texturefiles/car.ktx</file>
<file>texturefiles/pattern.pkm</file>
<file>texturefiles/car_mips.ktx</file>
<file>texturefiles/newlogo_srgb.astc</file>
<file>texturefiles/newlogo.astc</file>
</qresource>
</RCC>

View File

@ -49,33 +49,55 @@ void tst_qtexturefilereader::checkHandlers_data()
QTest::addColumn<QList<int>>("dataOffsets");
QTest::addColumn<QList<int>>("dataLengths");
QTest::addRow("pattern.pkm") << QStringLiteral(":/texturefiles/pattern.pkm")
<< QSize(64, 64)
<< quint32(0x0)
<< quint32(0x8d64)
<< quint32(0x0)
<< 1
<< (QList<int>() << 16)
<< (QList<int>() << 2048);
QTest::addRow("pattern.pkm")
<< QStringLiteral(":/texturefiles/pattern.pkm")
<< QSize(64, 64)
<< quint32(0x0)
<< quint32(0x8d64)
<< quint32(0x0)
<< 1
<< (QList<int>() << 16)
<< (QList<int>() << 2048);
QTest::addRow("car.ktx") << QStringLiteral(":/texturefiles/car.ktx")
<< QSize(146, 80)
<< quint32(0x0)
<< quint32(0x9278)
<< quint32(0x1908)
<< 1
<< (QList<int>() << 68)
<< (QList<int>() << 11840);
QTest::addRow("car.ktx")
<< QStringLiteral(":/texturefiles/car.ktx")
<< QSize(146, 80)
<< quint32(0x0)
<< quint32(0x9278)
<< quint32(0x1908)
<< 1
<< (QList<int>() << 68)
<< (QList<int>() << 11840);
QTest::addRow("car_mips.ktx") << QStringLiteral(":/texturefiles/car_mips.ktx")
<< QSize(146, 80)
<< quint32(0x0)
<< quint32(0x9274)
<< quint32(0x1907)
<< 8
<< (QList<int>() << 68 << 5992 << 7516 << 7880 << 8004 << 8056 << 8068 << 8080)
<< (QList<int>() << 5920 << 1520 << 360 << 120 << 48 << 8 << 8 << 8);
QTest::addRow("car_mips.ktx")
<< QStringLiteral(":/texturefiles/car_mips.ktx")
<< QSize(146, 80)
<< quint32(0x0)
<< quint32(0x9274)
<< quint32(0x1907)
<< 8
<< (QList<int>() << 68 << 5992 << 7516 << 7880 << 8004 << 8056 << 8068 << 8080)
<< (QList<int>() << 5920 << 1520 << 360 << 120 << 48 << 8 << 8 << 8);
QTest::addRow("newlogo.astc")
<< QStringLiteral(":/texturefiles/newlogo.astc")
<< QSize(111, 78)
<< quint32(0x0)
<< quint32(0x93b9)
<< quint32(0x0)
<< 1
<< (QList<int>() << 16)
<< (QList<int>() << 2496);
QTest::addRow("newlogo_srgb.astc")
<< QStringLiteral(":/texturefiles/newlogo_srgb.astc")
<< QSize(111, 78)
<< quint32(0x0)
<< quint32(0x93d9)
<< quint32(0x0)
<< 1
<< (QList<int>() << 16)
<< (QList<int>() << 2496);
}
void tst_qtexturefilereader::checkHandlers()

View File

@ -121,6 +121,7 @@ private slots:
void task254449_draggingItemToNegativeCoordinates();
void keyboardSearch();
void shiftSelectionWithNonUniformItemSizes();
void shiftSelectionWithItemAlignment();
void clickOnViewportClearsSelection();
void task262152_setModelColumnNavigate();
void taskQTBUG_2233_scrollHiddenItems_data();
@ -1802,6 +1803,51 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes()
}
}
void tst_QListView::shiftSelectionWithItemAlignment()
{
QStringList items;
for (int c = 0; c < 2; c++) {
for (int i = 10; i > 0; i--)
items << QString(i, QLatin1Char('*'));
for (int i = 1; i < 11; i++)
items << QString(i, QLatin1Char('*'));
}
QListView view;
view.setFlow(QListView::TopToBottom);
view.setWrapping(true);
view.setItemAlignment(Qt::AlignLeft);
view.setSelectionMode(QAbstractItemView::ExtendedSelection);
QStringListModel model(items);
view.setModel(&model);
QFont font = view.font();
font.setPixelSize(10);
view.setFont(font);
view.resize(300, view.sizeHintForRow(0) * items.size() / 2 + view.horizontalScrollBar()->height());
view.show();
QApplication::setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
QCOMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow());
QModelIndex index1 = view.model()->index(items.size() / 4, 0);
QPoint p = view.visualRect(index1).center();
QVERIFY(view.viewport()->rect().contains(p));
QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p);
QCOMPARE(view.currentIndex(), index1);
QCOMPARE(view.selectionModel()->selectedIndexes().size(), 1);
QModelIndex index2 = view.model()->index(items.size() / 4 * 3, 0);
p = view.visualRect(index2).center();
QVERIFY(view.viewport()->rect().contains(p));
QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, p);
QCOMPARE(view.currentIndex(), index2);
QCOMPARE(view.selectionModel()->selectedIndexes().size(), index2.row() - index1.row() + 1);
}
void tst_QListView::clickOnViewportClearsSelection()
{
QStringList items;

View File

@ -200,6 +200,7 @@ private slots:
void taskQTBUG_45697_crash();
void taskQTBUG_7232_AllowUserToControlSingleStep();
void taskQTBUG_8376();
void taskQTBUG_61476();
void testInitialFocus();
};
@ -4806,5 +4807,58 @@ void tst_QTreeView::taskQTBUG_8376()
QCOMPARE(rowHeightLvl1Visible, rowHeightLvl1Visible2);
}
void tst_QTreeView::taskQTBUG_61476()
{
// This checks that if a user clicks on an item to collapse it that it
// does not edit (in this case change the check state) the item that is
// now over the mouse just because it got a release event
QTreeView tv;
QStandardItemModel model;
QStandardItem *lastTopLevel = nullptr;
{
for (int i = 0; i < 4; ++i) {
QStandardItem *item = new QStandardItem(QLatin1String("Row Item"));
item->setCheckable(true);
item->setCheckState(Qt::Checked);
model.appendRow(item);
lastTopLevel = item;
for (int j = 0; j < 2; ++j) {
QStandardItem *childItem = new QStandardItem(QLatin1String("Child row Item"));
childItem->setCheckable(true);
childItem->setCheckState(Qt::Checked);
item->appendRow(childItem);
QStandardItem *grandChild = new QStandardItem(QLatin1String("Grand child row Item"));
grandChild->setCheckable(true);
grandChild->setCheckState(Qt::Checked);
childItem->appendRow(grandChild);
}
}
}
tv.setModel(&model);
tv.expandAll();
// We need it to be this size so that the effect of the collapsing will
// cause the parent item to move to be under the cursor
tv.resize(200, 200);
tv.show();
QVERIFY(QTest::qWaitForWindowActive(&tv));
tv.verticalScrollBar()->setValue(tv.verticalScrollBar()->maximum());
// We want to press specifically right around where a checkbox for the
// parent item could be when collapsing
QTreeViewPrivate *priv = static_cast<QTreeViewPrivate*>(qt_widget_private(&tv));
const QModelIndex mi = lastTopLevel->child(0)->index();
const QRect rect = priv->itemDecorationRect(mi);
const QPoint pos = rect.center();
QTest::mousePress(tv.viewport(), Qt::LeftButton, 0, pos);
if (tv.style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, &tv) ==
QEvent::MouseButtonPress)
QTRY_VERIFY(!tv.isExpanded(mi));
QTest::mouseRelease(tv.viewport(), Qt::LeftButton, 0, pos);
QTRY_VERIFY(!tv.isExpanded(mi));
QCOMPARE(lastTopLevel->checkState(), Qt::Checked);
}
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"