Merge "Merge remote-tracking branch 'origin/5.13' into dev"
This commit is contained in:
commit
275ad4ce4c
@ -1 +1,2 @@
|
|||||||
SOURCES = arch.cpp
|
SOURCES = arch.cpp
|
||||||
|
include(write_info.pri)
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
option(host_build)
|
option(host_build)
|
||||||
SOURCES = arch.cpp
|
SOURCES = arch.cpp
|
||||||
|
include(write_info.pri)
|
||||||
|
17
config.tests/arch/write_info.pri
Normal file
17
config.tests/arch/write_info.pri
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
targetinfofile = $$basename(_PRO_FILE_)
|
||||||
|
targetinfofile ~= s/pro$/target.txt/
|
||||||
|
|
||||||
|
win32 {
|
||||||
|
ext = .exe
|
||||||
|
} else:android {
|
||||||
|
file_prefix = lib
|
||||||
|
ext = .so
|
||||||
|
} else:wasm {
|
||||||
|
equals(WASM_OBJECT_FILES, 1): \
|
||||||
|
ext = .o
|
||||||
|
else: \
|
||||||
|
ext = .wasm
|
||||||
|
}
|
||||||
|
|
||||||
|
content = $${file_prefix}$${TARGET}$${ext}
|
||||||
|
write_file($$OUT_PWD/$$targetinfofile, content)
|
@ -286,37 +286,13 @@ defineTest(qtConfTest_architecture) {
|
|||||||
!qtConfTest_compile($${1}): \
|
!qtConfTest_compile($${1}): \
|
||||||
error("Could not determine $$eval($${1}.label). See config.log for details.")
|
error("Could not determine $$eval($${1}.label). See config.log for details.")
|
||||||
|
|
||||||
host = $$eval($${1}.host)
|
|
||||||
isEmpty(host): host = false
|
|
||||||
file_prefix =
|
|
||||||
exts = -
|
|
||||||
$$host {
|
|
||||||
equals(QMAKE_HOST.os, Windows): \
|
|
||||||
exts = .exe
|
|
||||||
} else {
|
|
||||||
win32 {
|
|
||||||
exts = .exe
|
|
||||||
} else:android {
|
|
||||||
file_prefix = lib
|
|
||||||
exts = .so
|
|
||||||
} else:wasm {
|
|
||||||
exts = .wasm .o
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
test = $$eval($${1}.test)
|
test = $$eval($${1}.test)
|
||||||
output = $$eval($${1}.output)
|
output = $$eval($${1}.output)
|
||||||
test_out_dir = $$OUT_PWD/$$basename(QMAKE_CONFIG_TESTS_DIR)/$$test
|
test_out_dir = $$OUT_PWD/$$basename(QMAKE_CONFIG_TESTS_DIR)/$$test
|
||||||
test_out_file =
|
test_out_file = $$test_out_dir/$$cat($$test_out_dir/$${output}.target.txt)
|
||||||
for(ext, exts) {
|
exists($$test_out_file): \
|
||||||
equals(ext, -): ext =
|
content = $$cat($$test_out_file, blob)
|
||||||
f = $$test_out_dir/$$file_prefix$$output$$ext
|
else: \
|
||||||
exists($$f) {
|
|
||||||
test_out_file = $$f
|
|
||||||
break()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
isEmpty(test_out_file): \
|
|
||||||
error("$$eval($${1}.label) detection binary not found.")
|
error("$$eval($${1}.label) detection binary not found.")
|
||||||
content = $$cat($$test_out_file, blob)
|
content = $$cat($$test_out_file, blob)
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
load(default_post)
|
load(default_post)
|
||||||
|
|
||||||
|
# Recompute SDK version in case the user set it explicitly
|
||||||
|
sdk_version = $$QMAKE_MAC_SDK_VERSION
|
||||||
|
QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
|
||||||
|
|
||||||
contains(TEMPLATE, .*app) {
|
contains(TEMPLATE, .*app) {
|
||||||
!macx-xcode:if(isEmpty(BUILDS)|build_pass) {
|
!macx-xcode:if(isEmpty(BUILDS)|build_pass) {
|
||||||
# Detect changes to the platform SDK
|
# Detect changes to the platform SDK
|
||||||
@ -14,7 +18,7 @@ contains(TEMPLATE, .*app) {
|
|||||||
|
|
||||||
!versionAtLeast(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION_MIN): \
|
!versionAtLeast(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION_MIN): \
|
||||||
warning("Qt requires at least version $$QT_MAC_SDK_VERSION_MIN of the platform SDK," \
|
warning("Qt requires at least version $$QT_MAC_SDK_VERSION_MIN of the platform SDK," \
|
||||||
"you're using $${QMAKE_MAC_SDK_VERSION}. Please upgrade.")
|
"you're building against version $${QMAKE_MAC_SDK_VERSION}. Please upgrade.")
|
||||||
|
|
||||||
!isEmpty(QT_MAC_SDK_VERSION_MAX) {
|
!isEmpty(QT_MAC_SDK_VERSION_MAX) {
|
||||||
# For Qt developers only
|
# For Qt developers only
|
||||||
@ -244,6 +248,11 @@ macx-xcode {
|
|||||||
QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
|
QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
!equals(sdk_version, $$QMAKE_MAC_SDK_VERSION) {
|
||||||
|
# Explicit SDK version has been set, respect that
|
||||||
|
QMAKE_LFLAGS += -Wl,-sdk_version -Wl,$$sdk_version
|
||||||
|
}
|
||||||
|
|
||||||
cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
|
cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
|
||||||
!isEmpty(QMAKE_XCODE_VERSION): \
|
!isEmpty(QMAKE_XCODE_VERSION): \
|
||||||
cache(QMAKE_XCODE_VERSION, stash)
|
cache(QMAKE_XCODE_VERSION, stash)
|
||||||
@ -261,7 +270,7 @@ xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identif
|
|||||||
QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
|
QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
|
||||||
|
|
||||||
!macx-xcode {
|
!macx-xcode {
|
||||||
generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode $(EXPORT__PRO_FILE_)
|
generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode $(EXPORT__PRO_FILE_) $$QMAKE_ARGS
|
||||||
generate_xcode_project.target = xcodeproj
|
generate_xcode_project.target = xcodeproj
|
||||||
QMAKE_EXTRA_VARIABLES += _PRO_FILE_
|
QMAKE_EXTRA_VARIABLES += _PRO_FILE_
|
||||||
QMAKE_EXTRA_TARGETS += generate_xcode_project
|
QMAKE_EXTRA_TARGETS += generate_xcode_project
|
||||||
|
@ -39,6 +39,11 @@ QMAKE_CXXFLAGS += -Wno-microsoft-enum-value
|
|||||||
QMAKE_LINK = lld-link
|
QMAKE_LINK = lld-link
|
||||||
QMAKE_LIB = llvm-lib /NOLOGO
|
QMAKE_LIB = llvm-lib /NOLOGO
|
||||||
|
|
||||||
|
QMAKE_CXXFLAGS_CXX11 = -std:c++11
|
||||||
|
QMAKE_CXXFLAGS_CXX14 = -std:c++14
|
||||||
|
QMAKE_CXXFLAGS_CXX1Z = -std:c++17
|
||||||
|
QMAKE_CXXFLAGS_CXX2A = -std:c++latest
|
||||||
|
|
||||||
QMAKE_CFLAGS_LTCG = -flto=thin
|
QMAKE_CFLAGS_LTCG = -flto=thin
|
||||||
QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
|
QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
|
||||||
QMAKE_CFLAGS_LTCG_FATOBJECTS = -flto
|
QMAKE_CFLAGS_LTCG_FATOBJECTS = -flto
|
||||||
|
@ -2583,10 +2583,8 @@
|
|||||||
|
|
||||||
\section1 RC_FILE
|
\section1 RC_FILE
|
||||||
|
|
||||||
Specifies the name of the resource file for the application.
|
Windows only. Specifies the name of the Windows resource file (.rc) for the
|
||||||
The value of this variable is typically handled by
|
target. See \l{Adding Windows Resource Files}.
|
||||||
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
|
|
||||||
needs to be modified.
|
|
||||||
|
|
||||||
\target RC_CODEPAGE
|
\target RC_CODEPAGE
|
||||||
\section1 RC_CODEPAGE
|
\section1 RC_CODEPAGE
|
||||||
@ -2649,7 +2647,9 @@
|
|||||||
|
|
||||||
\section1 RES_FILE
|
\section1 RES_FILE
|
||||||
|
|
||||||
Specifies the name of the compiled Windows resource file for the target.
|
Windows only. Specifies the name of the Windows resource compiler's output
|
||||||
|
file for this target. See \l{RC_FILE} and \l{Adding Windows Resource Files}.
|
||||||
|
|
||||||
The value of this variable is typically handled by
|
The value of this variable is typically handled by
|
||||||
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
|
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
|
||||||
needs to be modified.
|
needs to be modified.
|
||||||
|
@ -1447,7 +1447,36 @@ UnixMakefileGenerator::libtoolFileName(bool fixify)
|
|||||||
void
|
void
|
||||||
UnixMakefileGenerator::writeLibtoolFile()
|
UnixMakefileGenerator::writeLibtoolFile()
|
||||||
{
|
{
|
||||||
|
auto fixDependencyLibs
|
||||||
|
= [this](const ProStringList &libs)
|
||||||
|
{
|
||||||
|
ProStringList result;
|
||||||
|
for (auto lib : libs) {
|
||||||
|
auto fi = fileInfo(lib.toQString());
|
||||||
|
if (fi.isAbsolute()) {
|
||||||
|
const QString libDirArg = "-L" + fi.path();
|
||||||
|
if (!result.contains(libDirArg))
|
||||||
|
result += libDirArg;
|
||||||
|
QString namespec = fi.fileName();
|
||||||
|
int dotPos = namespec.lastIndexOf('.');
|
||||||
|
if (dotPos != -1 && namespec.startsWith("lib")) {
|
||||||
|
namespec.truncate(dotPos);
|
||||||
|
namespec.remove(0, 3);
|
||||||
|
} else {
|
||||||
|
debug_msg(1, "Ignoring dependency library %s",
|
||||||
|
lib.toLatin1().constData());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result += "-l" + namespec;
|
||||||
|
} else {
|
||||||
|
result += lib;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
QString fname = libtoolFileName(), lname = fname;
|
QString fname = libtoolFileName(), lname = fname;
|
||||||
|
debug_msg(1, "Writing libtool file %s", fname.toLatin1().constData());
|
||||||
mkdir(fileInfo(fname).path());
|
mkdir(fileInfo(fname).path());
|
||||||
int slsh = lname.lastIndexOf(Option::dir_sep);
|
int slsh = lname.lastIndexOf(Option::dir_sep);
|
||||||
if(slsh != -1)
|
if(slsh != -1)
|
||||||
@ -1485,12 +1514,11 @@ UnixMakefileGenerator::writeLibtoolFile()
|
|||||||
<< ".a'\n\n";
|
<< ".a'\n\n";
|
||||||
|
|
||||||
t << "# Libraries that this one depends upon.\n";
|
t << "# Libraries that this one depends upon.\n";
|
||||||
|
static const ProKey libVars[] = { "LIBS", "QMAKE_LIBS" };
|
||||||
ProStringList libs;
|
ProStringList libs;
|
||||||
libs << "LIBS" << "QMAKE_LIBS";
|
for (auto var : libVars)
|
||||||
t << "dependency_libs='";
|
libs += fixLibFlags(var);
|
||||||
for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it)
|
t << "dependency_libs='" << fixDependencyLibs(libs).join(' ') << "'\n\n";
|
||||||
t << fixLibFlags((*it).toKey()).join(' ') << ' ';
|
|
||||||
t << "'\n\n";
|
|
||||||
|
|
||||||
t << "# Version information for " << lname << "\n";
|
t << "# Version information for " << lname << "\n";
|
||||||
int maj = project->first("VER_MAJ").toInt();
|
int maj = project->first("VER_MAJ").toInt();
|
||||||
|
@ -183,7 +183,7 @@ QUrl url("http://qt-project.org/support/file.html");
|
|||||||
//! [19]
|
//! [19]
|
||||||
|
|
||||||
//! [20]
|
//! [20]
|
||||||
qDebug() << QUrl("file:file.txt").toLocalFile(); // "file:file.txt"
|
qDebug() << QUrl("file:file.txt").toLocalFile(); // "file.txt"
|
||||||
qDebug() << QUrl("file:/home/user/file.txt").toLocalFile(); // "file:///home/user/file.txt"
|
qDebug() << QUrl("file:/home/user/file.txt").toLocalFile(); // "/home/user/file.txt"
|
||||||
qDebug() << QUrl("file.txt").toLocalFile(); // ""; wasn't a local file as it had no scheme
|
qDebug() << QUrl("file.txt").toLocalFile(); // ""; wasn't a local file as it had no scheme
|
||||||
//! [20]
|
//! [20]
|
||||||
|
@ -443,6 +443,14 @@ const QOperatingSystemVersion QOperatingSystemVersion::MacOSHighSierra =
|
|||||||
const QOperatingSystemVersion QOperatingSystemVersion::MacOSMojave =
|
const QOperatingSystemVersion QOperatingSystemVersion::MacOSMojave =
|
||||||
QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 14);
|
QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 14);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\variable QOperatingSystemVersion::MacOSCatalina
|
||||||
|
\brief a version corresponding to macOS Catalina (version 10.15).
|
||||||
|
\since 5.12.5
|
||||||
|
*/
|
||||||
|
const QOperatingSystemVersion QOperatingSystemVersion::MacOSCatalina =
|
||||||
|
QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 15);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\variable QOperatingSystemVersion::AndroidJellyBean
|
\variable QOperatingSystemVersion::AndroidJellyBean
|
||||||
\brief a version corresponding to Android Jelly Bean (version 4.1, API level 16).
|
\brief a version corresponding to Android Jelly Bean (version 4.1, API level 16).
|
||||||
|
@ -72,6 +72,7 @@ public:
|
|||||||
static const QOperatingSystemVersion MacOSSierra;
|
static const QOperatingSystemVersion MacOSSierra;
|
||||||
static const QOperatingSystemVersion MacOSHighSierra;
|
static const QOperatingSystemVersion MacOSHighSierra;
|
||||||
static const QOperatingSystemVersion MacOSMojave;
|
static const QOperatingSystemVersion MacOSMojave;
|
||||||
|
static const QOperatingSystemVersion MacOSCatalina;
|
||||||
|
|
||||||
static const QOperatingSystemVersion AndroidJellyBean;
|
static const QOperatingSystemVersion AndroidJellyBean;
|
||||||
static const QOperatingSystemVersion AndroidJellyBean_MR1;
|
static const QOperatingSystemVersion AndroidJellyBean_MR1;
|
||||||
|
@ -240,17 +240,23 @@
|
|||||||
# if !defined(__MAC_10_14)
|
# if !defined(__MAC_10_14)
|
||||||
# define __MAC_10_14 101400
|
# define __MAC_10_14 101400
|
||||||
# endif
|
# endif
|
||||||
|
# if !defined(__MAC_10_15)
|
||||||
|
# define __MAC_10_15 101500
|
||||||
|
# endif
|
||||||
# if !defined(MAC_OS_X_VERSION_10_11)
|
# if !defined(MAC_OS_X_VERSION_10_11)
|
||||||
# define MAC_OS_X_VERSION_10_11 101100
|
# define MAC_OS_X_VERSION_10_11 __MAC_10_11
|
||||||
# endif
|
# endif
|
||||||
# if !defined(MAC_OS_X_VERSION_10_12)
|
# if !defined(MAC_OS_X_VERSION_10_12)
|
||||||
# define MAC_OS_X_VERSION_10_12 101200
|
# define MAC_OS_X_VERSION_10_12 __MAC_10_12
|
||||||
# endif
|
# endif
|
||||||
# if !defined(MAC_OS_X_VERSION_10_13)
|
# if !defined(MAC_OS_X_VERSION_10_13)
|
||||||
# define MAC_OS_X_VERSION_10_13 101300
|
# define MAC_OS_X_VERSION_10_13 __MAC_10_13
|
||||||
# endif
|
# endif
|
||||||
# if !defined(MAC_OS_X_VERSION_10_14)
|
# if !defined(MAC_OS_X_VERSION_10_14)
|
||||||
# define MAC_OS_X_VERSION_10_14 101400
|
# define MAC_OS_X_VERSION_10_14 __MAC_10_14
|
||||||
|
# endif
|
||||||
|
# if !defined(MAC_OS_X_VERSION_10_15)
|
||||||
|
# define MAC_OS_X_VERSION_10_15 __MAC_10_15
|
||||||
# endif
|
# endif
|
||||||
#
|
#
|
||||||
# if !defined(__IPHONE_10_0)
|
# if !defined(__IPHONE_10_0)
|
||||||
|
@ -177,9 +177,9 @@ class Q_CORE_EXPORT QJsonValueRef
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QJsonValueRef(QJsonArray *array, int idx)
|
QJsonValueRef(QJsonArray *array, int idx)
|
||||||
: a(array), is_object(false), index(idx) {}
|
: a(array), is_object(false), index(static_cast<uint>(idx)) {}
|
||||||
QJsonValueRef(QJsonObject *object, int idx)
|
QJsonValueRef(QJsonObject *object, int idx)
|
||||||
: o(object), is_object(true), index(idx) {}
|
: o(object), is_object(true), index(static_cast<uint>(idx)) {}
|
||||||
|
|
||||||
inline operator QJsonValue() const { return toValue(); }
|
inline operator QJsonValue() const { return toValue(); }
|
||||||
QJsonValueRef &operator = (const QJsonValue &val);
|
QJsonValueRef &operator = (const QJsonValue &val);
|
||||||
|
@ -99,6 +99,8 @@ void qt_create_tls()
|
|||||||
return;
|
return;
|
||||||
static QBasicMutex mutex;
|
static QBasicMutex mutex;
|
||||||
QMutexLocker locker(&mutex);
|
QMutexLocker locker(&mutex);
|
||||||
|
if (qt_current_thread_data_tls_index != TLS_OUT_OF_INDEXES)
|
||||||
|
return;
|
||||||
qt_current_thread_data_tls_index = TlsAlloc();
|
qt_current_thread_data_tls_index = TlsAlloc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2016 The Qt Company Ltd.
|
||||||
** Copyright (C) 2016 Intel Corporation.
|
** Copyright (C) 2019 Intel Corporation.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the QtCore module of the Qt Toolkit.
|
** This file is part of the QtCore module of the Qt Toolkit.
|
||||||
@ -132,12 +132,12 @@ QT_BEGIN_NAMESPACE
|
|||||||
* We overallocate the byte array by 1 byte. The first user bit is at
|
* We overallocate the byte array by 1 byte. The first user bit is at
|
||||||
* d.data()[1]. On the extra first byte, we store the difference between the
|
* d.data()[1]. On the extra first byte, we store the difference between the
|
||||||
* number of bits in the byte array (including this byte) and the number of
|
* number of bits in the byte array (including this byte) and the number of
|
||||||
* bits in the bit array. Therefore, it's always a number between 8 and 15.
|
* bits in the bit array. Therefore, for a non-empty QBitArray, it's always a
|
||||||
|
* number between 8 and 15. For the empty one, d is the an empty QByteArray and
|
||||||
|
* *d.constData() is the QByteArray's terminating NUL (0) byte.
|
||||||
*
|
*
|
||||||
* This allows for fast calculation of the bit array size:
|
* This allows for fast calculation of the bit array size:
|
||||||
* inline int size() const { return (d.size() << 3) - *d.constData(); }
|
* inline int size() const { return (d.size() << 3) - *d.constData(); }
|
||||||
*
|
|
||||||
* Note: for an array of zero size, *d.constData() is the QByteArray implicit NUL.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -154,8 +154,8 @@ QBitArray::QBitArray(int size, bool value)
|
|||||||
uchar* c = reinterpret_cast<uchar*>(d.data());
|
uchar* c = reinterpret_cast<uchar*>(d.data());
|
||||||
memset(c + 1, value ? 0xff : 0, d.size() - 1);
|
memset(c + 1, value ? 0xff : 0, d.size() - 1);
|
||||||
*c = d.size()*8 - size;
|
*c = d.size()*8 - size;
|
||||||
if (value && size && size % 8)
|
if (value && size && size & 7)
|
||||||
*(c+1+size/8) &= (1 << (size%8)) - 1;
|
*(c+1+size/8) &= (1 << (size & 7)) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \fn int QBitArray::size() const
|
/*! \fn int QBitArray::size() const
|
||||||
@ -227,8 +227,8 @@ void QBitArray::resize(int size)
|
|||||||
uchar* c = reinterpret_cast<uchar*>(d.data());
|
uchar* c = reinterpret_cast<uchar*>(d.data());
|
||||||
if (size > (s << 3))
|
if (size > (s << 3))
|
||||||
memset(c + s, 0, d.size() - s);
|
memset(c + s, 0, d.size() - s);
|
||||||
else if ( size % 8)
|
else if (size & 7)
|
||||||
*(c+1+size/8) &= (1 << (size%8)) - 1;
|
*(c+1+size/8) &= (1 << (size & 7)) - 1;
|
||||||
*c = d.size()*8 - size;
|
*c = d.size()*8 - size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,6 +326,8 @@ void QBitArray::fill(bool value, int begin, int end)
|
|||||||
QBitArray QBitArray::fromBits(const char *data, qsizetype size)
|
QBitArray QBitArray::fromBits(const char *data, qsizetype size)
|
||||||
{
|
{
|
||||||
QBitArray result;
|
QBitArray result;
|
||||||
|
if (size == 0)
|
||||||
|
return result;
|
||||||
qsizetype nbytes = (size + 7) / 8;
|
qsizetype nbytes = (size + 7) / 8;
|
||||||
|
|
||||||
result.d = QByteArray(nbytes + 1, Qt::Uninitialized);
|
result.d = QByteArray(nbytes + 1, Qt::Uninitialized);
|
||||||
@ -334,7 +336,7 @@ QBitArray QBitArray::fromBits(const char *data, qsizetype size)
|
|||||||
|
|
||||||
// clear any unused bits from the last byte
|
// clear any unused bits from the last byte
|
||||||
if (size & 7)
|
if (size & 7)
|
||||||
bits[nbytes] &= 0xffU >> (size & 7);
|
bits[nbytes] &= 0xffU >> (8 - (size & 7));
|
||||||
|
|
||||||
*bits = result.d.size() * 8 - size;
|
*bits = result.d.size() * 8 - size;
|
||||||
return result;
|
return result;
|
||||||
|
@ -391,19 +391,19 @@ void QCryptographicHash::addData(const char *data, int length)
|
|||||||
break;
|
break;
|
||||||
case RealSha3_224:
|
case RealSha3_224:
|
||||||
case Keccak_224:
|
case Keccak_224:
|
||||||
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
|
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
|
||||||
break;
|
break;
|
||||||
case RealSha3_256:
|
case RealSha3_256:
|
||||||
case Keccak_256:
|
case Keccak_256:
|
||||||
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
|
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
|
||||||
break;
|
break;
|
||||||
case RealSha3_384:
|
case RealSha3_384:
|
||||||
case Keccak_384:
|
case Keccak_384:
|
||||||
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
|
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
|
||||||
break;
|
break;
|
||||||
case RealSha3_512:
|
case RealSha3_512:
|
||||||
case Keccak_512:
|
case Keccak_512:
|
||||||
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
|
sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ struct Q_CORE_EXPORT QListData {
|
|||||||
void remove(int i);
|
void remove(int i);
|
||||||
void remove(int i, int n);
|
void remove(int i, int n);
|
||||||
void move(int from, int to);
|
void move(int from, int to);
|
||||||
inline int size() const noexcept { return d->end - d->begin; }
|
inline int size() const noexcept { return int(d->end - d->begin); } // q6sizetype
|
||||||
inline bool isEmpty() const noexcept { return d->end == d->begin; }
|
inline bool isEmpty() const noexcept { return d->end == d->begin; }
|
||||||
inline void **at(int i) const noexcept { return d->array + d->begin + i; }
|
inline void **at(int i) const noexcept { return d->array + d->begin + i; }
|
||||||
inline void **begin() const noexcept { return d->array + d->begin; }
|
inline void **begin() const noexcept { return d->array + d->begin; }
|
||||||
@ -1051,7 +1051,7 @@ int lastIndexOf(const QList<T> &list, const U &u, int from)
|
|||||||
Node *n = reinterpret_cast<Node *>(list.p.at(from + 1));
|
Node *n = reinterpret_cast<Node *>(list.p.at(from + 1));
|
||||||
while (n-- != b) {
|
while (n-- != b) {
|
||||||
if (n->t() == u)
|
if (n->t() == u)
|
||||||
return n - b;
|
return typename QList<T>::difference_type(n - b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -716,7 +716,7 @@ bool QImageData::checkForAlphaPixels() const
|
|||||||
\value Format_Grayscale8 The image is stored using an 8-bit grayscale format. (added in Qt 5.5)
|
\value Format_Grayscale8 The image is stored using an 8-bit grayscale format. (added in Qt 5.5)
|
||||||
\value Format_Grayscale16 The image is stored using an 16-bit grayscale format. (added in Qt 5.13)
|
\value Format_Grayscale16 The image is stored using an 16-bit grayscale format. (added in Qt 5.13)
|
||||||
\value Format_RGBX64 The image is stored using a 64-bit halfword-ordered RGB(x) format (16-16-16-16).
|
\value Format_RGBX64 The image is stored using a 64-bit halfword-ordered RGB(x) format (16-16-16-16).
|
||||||
This is the same as the Format_RGBX64 except alpha must always be 65535. (added in Qt 5.12)
|
This is the same as the Format_RGBA64 except alpha must always be 65535. (added in Qt 5.12)
|
||||||
\value Format_RGBA64 The image is stored using a 64-bit halfword-ordered RGBA format (16-16-16-16). (added in Qt 5.12)
|
\value Format_RGBA64 The image is stored using a 64-bit halfword-ordered RGBA format (16-16-16-16). (added in Qt 5.12)
|
||||||
\value Format_RGBA64_Premultiplied The image is stored using a premultiplied 64-bit halfword-ordered
|
\value Format_RGBA64_Premultiplied The image is stored using a premultiplied 64-bit halfword-ordered
|
||||||
RGBA format (16-16-16-16). (added in Qt 5.12)
|
RGBA format (16-16-16-16). (added in Qt 5.12)
|
||||||
|
@ -456,6 +456,8 @@ QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QPlatformS
|
|||||||
{
|
{
|
||||||
if (!m_active)
|
if (!m_active)
|
||||||
return { qreal(1), QPoint() };
|
return { qreal(1), QPoint() };
|
||||||
|
if (!platformScreen)
|
||||||
|
return { m_factor, QPoint() }; // the global factor
|
||||||
const QPlatformScreen *actualScreen = nativePosition ?
|
const QPlatformScreen *actualScreen = nativePosition ?
|
||||||
platformScreen->screenForPosition(*nativePosition) : platformScreen;
|
platformScreen->screenForPosition(*nativePosition) : platformScreen;
|
||||||
return { m_factor * screenSubfactor(actualScreen), actualScreen->geometry().topLeft() };
|
return { m_factor * screenSubfactor(actualScreen), actualScreen->geometry().topLeft() };
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
#include <QtGui/qregion.h>
|
#include <QtGui/qregion.h>
|
||||||
#include <QtGui/qscreen.h>
|
#include <QtGui/qscreen.h>
|
||||||
|
#include <QtGui/qvector2d.h>
|
||||||
#include <QtGui/qwindow.h>
|
#include <QtGui/qwindow.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -117,13 +118,26 @@ private:
|
|||||||
|
|
||||||
namespace QHighDpi {
|
namespace QHighDpi {
|
||||||
|
|
||||||
template <typename T>
|
inline qreal scale(qreal value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0))
|
||||||
inline T scale(const T &value, qreal scaleFactor, QPoint origin = QPoint(0, 0))
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(origin)
|
|
||||||
return value * scaleFactor;
|
return value * scaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline QSize scale(const QSize &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0))
|
||||||
|
{
|
||||||
|
return value * scaleFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QSizeF scale(const QSizeF &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0))
|
||||||
|
{
|
||||||
|
return value * scaleFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QVector2D scale(const QVector2D &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0))
|
||||||
|
{
|
||||||
|
return value * float(scaleFactor);
|
||||||
|
}
|
||||||
|
|
||||||
inline QPointF scale(const QPointF &pos, qreal scaleFactor, QPointF origin = QPointF(0, 0))
|
inline QPointF scale(const QPointF &pos, qreal scaleFactor, QPointF origin = QPointF(0, 0))
|
||||||
{
|
{
|
||||||
return (pos - origin) * scaleFactor + origin;
|
return (pos - origin) * scaleFactor + origin;
|
||||||
|
@ -976,11 +976,8 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
|
|||||||
if (!surface->surfaceHandle())
|
if (!surface->surfaceHandle())
|
||||||
return false;
|
return false;
|
||||||
if (!surface->supportsOpenGL()) {
|
if (!surface->supportsOpenGL()) {
|
||||||
#ifndef Q_OS_WASM // ### work around the WASM platform plugin using QOpenGLContext with raster surfaces.
|
|
||||||
// see QTBUG-70076
|
|
||||||
qWarning() << "QOpenGLContext::makeCurrent() called with non-opengl surface" << surface;
|
qWarning() << "QOpenGLContext::makeCurrent() called with non-opengl surface" << surface;
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!d->platformGLContext->makeCurrent(surface->surfaceHandle()))
|
if (!d->platformGLContext->makeCurrent(surface->surfaceHandle()))
|
||||||
|
@ -244,6 +244,9 @@ QPlatformServices *QPlatformIntegration::services() const
|
|||||||
\value TopStackedNativeChildWindows The platform supports native child windows via
|
\value TopStackedNativeChildWindows The platform supports native child windows via
|
||||||
QWindowContainer without having to punch a transparent hole in the
|
QWindowContainer without having to punch a transparent hole in the
|
||||||
backingstore. (since 5.10)
|
backingstore. (since 5.10)
|
||||||
|
|
||||||
|
\value OpenGLOnRasterSurface The platform supports making a QOpenGLContext current
|
||||||
|
in combination with a QWindow of type RasterSurface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -105,7 +105,8 @@ public:
|
|||||||
AllGLFunctionsQueryable,
|
AllGLFunctionsQueryable,
|
||||||
ApplicationIcon,
|
ApplicationIcon,
|
||||||
SwitchableWidgetComposition,
|
SwitchableWidgetComposition,
|
||||||
TopStackedNativeChildWindows
|
TopStackedNativeChildWindows,
|
||||||
|
OpenGLOnRasterSurface
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~QPlatformIntegration() { }
|
virtual ~QPlatformIntegration() { }
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
#include "qsurface.h"
|
#include "qsurface.h"
|
||||||
#include "qopenglcontext.h"
|
#include "qopenglcontext.h"
|
||||||
|
#include <qpa/qplatformintegration.h>
|
||||||
|
#include <QtGui/private/qguiapplication_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -103,6 +105,10 @@ QT_BEGIN_NAMESPACE
|
|||||||
bool QSurface::supportsOpenGL() const
|
bool QSurface::supportsOpenGL() const
|
||||||
{
|
{
|
||||||
SurfaceType type = surfaceType();
|
SurfaceType type = surfaceType();
|
||||||
|
if (type == RasterSurface) {
|
||||||
|
QPlatformIntegration *integ = QGuiApplicationPrivate::instance()->platformIntegration();
|
||||||
|
return integ->hasCapability(QPlatformIntegration::OpenGLOnRasterSurface);
|
||||||
|
}
|
||||||
return type == OpenGLSurface || type == RasterGLSurface;
|
return type == OpenGLSurface || type == RasterGLSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,10 +554,6 @@ int QSurfaceFormat::alphaBufferSize() const
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Set the desired \a size in bits of the red channel of the color buffer.
|
Set the desired \a size in bits of the red channel of the color buffer.
|
||||||
|
|
||||||
\note On Mac OSX, be sure to set the buffer size of all color channels,
|
|
||||||
otherwise this setting will have no effect. If one of the buffer sizes is not set,
|
|
||||||
the current bit-depth of the screen is used.
|
|
||||||
*/
|
*/
|
||||||
void QSurfaceFormat::setRedBufferSize(int size)
|
void QSurfaceFormat::setRedBufferSize(int size)
|
||||||
{
|
{
|
||||||
@ -569,10 +565,6 @@ void QSurfaceFormat::setRedBufferSize(int size)
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Set the desired \a size in bits of the green channel of the color buffer.
|
Set the desired \a size in bits of the green channel of the color buffer.
|
||||||
|
|
||||||
\note On Mac OSX, be sure to set the buffer size of all color channels,
|
|
||||||
otherwise this setting will have no effect. If one of the buffer sizes is not set,
|
|
||||||
the current bit-depth of the screen is used.
|
|
||||||
*/
|
*/
|
||||||
void QSurfaceFormat::setGreenBufferSize(int size)
|
void QSurfaceFormat::setGreenBufferSize(int size)
|
||||||
{
|
{
|
||||||
@ -584,10 +576,6 @@ void QSurfaceFormat::setGreenBufferSize(int size)
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Set the desired \a size in bits of the blue channel of the color buffer.
|
Set the desired \a size in bits of the blue channel of the color buffer.
|
||||||
|
|
||||||
\note On Mac OSX, be sure to set the buffer size of all color channels,
|
|
||||||
otherwise this setting will have no effect. If one of the buffer sizes is not set,
|
|
||||||
the current bit-depth of the screen is used.
|
|
||||||
*/
|
*/
|
||||||
void QSurfaceFormat::setBlueBufferSize(int size)
|
void QSurfaceFormat::setBlueBufferSize(int size)
|
||||||
{
|
{
|
||||||
|
@ -1813,8 +1813,10 @@ void QT_FASTCALL comp_func_Lighten_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QR
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if Sca.Da + Dca.Sa >= Sa.Da
|
if Sca.Da + Dca.Sa > Sa.Da
|
||||||
Dca' = Sa.Da + Sca.(1 - Da) + Dca.(1 - Sa)
|
Dca' = Sa.Da + Sca.(1 - Da) + Dca.(1 - Sa)
|
||||||
|
else if Sca == Sa
|
||||||
|
Dca' = Dca.Sa + Sca.(1 - Da) + Dca.(1 - Sa)
|
||||||
otherwise
|
otherwise
|
||||||
Dca' = Dca.Sa/(1-Sca/Sa) + Sca.(1 - Da) + Dca.(1 - Sa)
|
Dca' = Dca.Sa/(1-Sca/Sa) + Sca.(1 - Da) + Dca.(1 - Sa)
|
||||||
*/
|
*/
|
||||||
@ -1825,8 +1827,10 @@ static inline int color_dodge_op(int dst, int src, int da, int sa)
|
|||||||
const int src_da = src * da;
|
const int src_da = src * da;
|
||||||
|
|
||||||
const int temp = src * (255 - da) + dst * (255 - sa);
|
const int temp = src * (255 - da) + dst * (255 - sa);
|
||||||
if (src_da + dst_sa >= sa_da)
|
if (src_da + dst_sa > sa_da)
|
||||||
return qt_div_255(sa_da + temp);
|
return qt_div_255(sa_da + temp);
|
||||||
|
else if (src == sa || sa == 0)
|
||||||
|
return qt_div_255(temp);
|
||||||
else
|
else
|
||||||
return qt_div_255(255 * dst_sa / (255 - 255 * src / sa) + temp);
|
return qt_div_255(255 * dst_sa / (255 - 255 * src / sa) + temp);
|
||||||
}
|
}
|
||||||
@ -1870,8 +1874,10 @@ static inline uint color_dodge_op_rgb64(qint64 dst, qint64 src, qint64 da, qint6
|
|||||||
const qint64 src_da = src * da;
|
const qint64 src_da = src * da;
|
||||||
|
|
||||||
const qint64 temp = src * (65535 - da) + dst * (65535 - sa);
|
const qint64 temp = src * (65535 - da) + dst * (65535 - sa);
|
||||||
if (src_da + dst_sa >= sa_da)
|
if (src_da + dst_sa > sa_da)
|
||||||
return qt_div_65535(sa_da + temp);
|
return qt_div_65535(sa_da + temp);
|
||||||
|
else if (src == sa || sa == 0)
|
||||||
|
return qt_div_65535(temp);
|
||||||
else
|
else
|
||||||
return qt_div_65535(65535 * dst_sa / (65535 - 65535 * src / sa) + temp);
|
return qt_div_65535(65535 * dst_sa / (65535 - 65535 * src / sa) + temp);
|
||||||
}
|
}
|
||||||
@ -1969,8 +1975,10 @@ void QT_FASTCALL comp_func_ColorDodge_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if Sca.Da + Dca.Sa <= Sa.Da
|
if Sca.Da + Dca.Sa < Sa.Da
|
||||||
Dca' = Sca.(1 - Da) + Dca.(1 - Sa)
|
Dca' = Sca.(1 - Da) + Dca.(1 - Sa)
|
||||||
|
else if Sca == 0
|
||||||
|
Dca' = Dca.Sa + Sca.(1 - Da) + Dca.(1 - Sa)
|
||||||
otherwise
|
otherwise
|
||||||
Dca' = Sa.(Sca.Da + Dca.Sa - Sa.Da)/Sca + Sca.(1 - Da) + Dca.(1 - Sa)
|
Dca' = Sa.(Sca.Da + Dca.Sa - Sa.Da)/Sca + Sca.(1 - Da) + Dca.(1 - Sa)
|
||||||
*/
|
*/
|
||||||
@ -1982,8 +1990,10 @@ static inline int color_burn_op(int dst, int src, int da, int sa)
|
|||||||
|
|
||||||
const int temp = src * (255 - da) + dst * (255 - sa);
|
const int temp = src * (255 - da) + dst * (255 - sa);
|
||||||
|
|
||||||
if (src == 0 || src_da + dst_sa <= sa_da)
|
if (src_da + dst_sa < sa_da)
|
||||||
return qt_div_255(temp);
|
return qt_div_255(temp);
|
||||||
|
else if (src == 0)
|
||||||
|
return qt_div_255(dst_sa + temp);
|
||||||
return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp);
|
return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2027,8 +2037,10 @@ static inline uint color_burn_op_rgb64(qint64 dst, qint64 src, qint64 da, qint64
|
|||||||
|
|
||||||
const qint64 temp = src * (65535 - da) + dst * (65535 - sa);
|
const qint64 temp = src * (65535 - da) + dst * (65535 - sa);
|
||||||
|
|
||||||
if (src == 0 || src_da + dst_sa <= sa_da)
|
if (src_da + dst_sa < sa_da)
|
||||||
return qt_div_65535(temp);
|
return qt_div_65535(temp);
|
||||||
|
else if (src == 0)
|
||||||
|
return qt_div_65535(dst_sa + temp);
|
||||||
return qt_div_65535(sa * (src_da + dst_sa - sa_da) / src + temp);
|
return qt_div_65535(sa * (src_da + dst_sa - sa_da) / src + temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2883,19 +2883,34 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
|
|||||||
for (int i = 0; i < numGlyphs; i++) {
|
for (int i = 0; i < numGlyphs; i++) {
|
||||||
QFixed spp = fontEngine->subPixelPositionForX(positions[i].x);
|
QFixed spp = fontEngine->subPixelPositionForX(positions[i].x);
|
||||||
|
|
||||||
QPoint offset;
|
const QFontEngine::Glyph *alphaMap = fontEngine->glyphData(glyphs[i], spp, neededFormat, s->matrix);
|
||||||
const QImage *alphaMap = fontEngine->lockedAlphaMapForGlyph(glyphs[i], spp, neededFormat, s->matrix,
|
if (!alphaMap)
|
||||||
&offset);
|
|
||||||
if (alphaMap == 0 || alphaMap->isNull())
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
alphaPenBlt(alphaMap->constBits(), alphaMap->bytesPerLine(), alphaMap->depth(),
|
int depth;
|
||||||
qFloor(positions[i].x) + offset.x(),
|
int bytesPerLine;
|
||||||
qRound(positions[i].y) + offset.y(),
|
switch (alphaMap->format) {
|
||||||
alphaMap->width(), alphaMap->height(),
|
case QFontEngine::Format_Mono:
|
||||||
fontEngine->expectsGammaCorrectedBlending());
|
depth = 1;
|
||||||
|
bytesPerLine = ((alphaMap->width + 31) & ~31) >> 3;
|
||||||
|
break;
|
||||||
|
case QFontEngine::Format_A8:
|
||||||
|
depth = 8;
|
||||||
|
bytesPerLine = (alphaMap->width + 3) & ~3;
|
||||||
|
break;
|
||||||
|
case QFontEngine::Format_A32:
|
||||||
|
depth = 32;
|
||||||
|
bytesPerLine = alphaMap->width * 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
};
|
||||||
|
|
||||||
fontEngine->unlockAlphaMapForGlyph();
|
alphaPenBlt(alphaMap->data, bytesPerLine, depth,
|
||||||
|
qFloor(positions[i].x) + alphaMap->x,
|
||||||
|
qRound(positions[i].y) - alphaMap->y,
|
||||||
|
alphaMap->width, alphaMap->height,
|
||||||
|
fontEngine->expectsGammaCorrectedBlending());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
26
src/gui/text/AGLFN_LICENSE.txt
Normal file
26
src/gui/text/AGLFN_LICENSE.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
Neither the name of Adobe Systems Incorporated nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -923,29 +923,10 @@ QFixed QFontEngine::subPixelPositionForX(QFixed x) const
|
|||||||
return subPixelPosition;
|
return subPixelPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage *QFontEngine::lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
|
QFontEngine::Glyph *QFontEngine::glyphData(glyph_t, QFixed,
|
||||||
QFontEngine::GlyphFormat neededFormat,
|
QFontEngine::GlyphFormat, const QTransform &)
|
||||||
const QTransform &t, QPoint *offset)
|
|
||||||
{
|
{
|
||||||
Q_ASSERT(currentlyLockedAlphaMap.isNull());
|
return nullptr;
|
||||||
if (neededFormat == Format_None)
|
|
||||||
neededFormat = Format_A32;
|
|
||||||
|
|
||||||
if (neededFormat != Format_A32)
|
|
||||||
currentlyLockedAlphaMap = alphaMapForGlyph(glyph, subPixelPosition, t);
|
|
||||||
else
|
|
||||||
currentlyLockedAlphaMap = alphaRGBMapForGlyph(glyph, subPixelPosition, t);
|
|
||||||
|
|
||||||
if (offset != 0)
|
|
||||||
*offset = QPoint(0, 0);
|
|
||||||
|
|
||||||
return ¤tlyLockedAlphaMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QFontEngine::unlockAlphaMapForGlyph()
|
|
||||||
{
|
|
||||||
Q_ASSERT(!currentlyLockedAlphaMap.isNull());
|
|
||||||
currentlyLockedAlphaMap = QImage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage QFontEngine::alphaMapForGlyph(glyph_t glyph)
|
QImage QFontEngine::alphaMapForGlyph(glyph_t glyph)
|
||||||
|
@ -123,6 +123,22 @@ public:
|
|||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(ShaperFlags, ShaperFlag)
|
Q_DECLARE_FLAGS(ShaperFlags, ShaperFlag)
|
||||||
|
|
||||||
|
/* Used with the Freetype font engine. We don't cache glyphs that are too large anyway, so we can make this struct rather small */
|
||||||
|
struct Glyph {
|
||||||
|
Glyph() = default;
|
||||||
|
~Glyph() { delete [] data; }
|
||||||
|
short linearAdvance = 0;
|
||||||
|
unsigned char width = 0;
|
||||||
|
unsigned char height = 0;
|
||||||
|
short x = 0;
|
||||||
|
short y = 0;
|
||||||
|
short advance = 0;
|
||||||
|
signed char format = 0;
|
||||||
|
uchar *data = nullptr;
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(Glyph);
|
||||||
|
};
|
||||||
|
|
||||||
virtual ~QFontEngine();
|
virtual ~QFontEngine();
|
||||||
|
|
||||||
inline Type type() const { return m_type; }
|
inline Type type() const { return m_type; }
|
||||||
@ -190,11 +206,7 @@ public:
|
|||||||
virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
|
virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
|
||||||
virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
|
virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t);
|
||||||
virtual QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t, const QColor &color = QColor());
|
virtual QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t, const QColor &color = QColor());
|
||||||
virtual QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
|
virtual Glyph *glyphData(glyph_t glyph, QFixed subPixelPosition, GlyphFormat neededFormat, const QTransform &t);
|
||||||
GlyphFormat neededFormat,
|
|
||||||
const QTransform &t = QTransform(),
|
|
||||||
QPoint *offset = nullptr);
|
|
||||||
virtual void unlockAlphaMapForGlyph();
|
|
||||||
virtual bool hasInternalCaching() const { return false; }
|
virtual bool hasInternalCaching() const { return false; }
|
||||||
|
|
||||||
virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &matrix, GlyphFormat /*format*/)
|
virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &matrix, GlyphFormat /*format*/)
|
||||||
@ -345,7 +357,6 @@ public:
|
|||||||
void loadKerningPairs(QFixed scalingFactor);
|
void loadKerningPairs(QFixed scalingFactor);
|
||||||
|
|
||||||
GlyphFormat glyphFormat;
|
GlyphFormat glyphFormat;
|
||||||
QImage currentlyLockedAlphaMap;
|
|
||||||
int m_subPixelPositionCount; // Number of positions within a single pixel for this cache
|
int m_subPixelPositionCount; // Number of positions within a single pixel for this cache
|
||||||
|
|
||||||
inline QVariant userData() const { return m_userData; }
|
inline QVariant userData() const { return m_userData; }
|
||||||
|
17
src/gui/text/qt_attribution.json
Normal file
17
src/gui/text/qt_attribution.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"Id": "aglfn",
|
||||||
|
"Name": "Adobe Glyph List For New Fonts",
|
||||||
|
"QDocModule": "qtgui",
|
||||||
|
"Description": "Provides standardized names for glyphs.",
|
||||||
|
"QtUsage": "Used by PDF generator to make it easier for reader applications to resolve the original contents of rendered text.",
|
||||||
|
"Path": "qfontsubset_agl.cpp",
|
||||||
|
|
||||||
|
"Homepage": "https://github.com/adobe-type-tools/agl-aglfn",
|
||||||
|
"Version": "1.7",
|
||||||
|
"License": "BSD 3-Clause \"New\" or \"Revised\" License",
|
||||||
|
"LicenseId": "BSD-3-Clause",
|
||||||
|
"LicenseFile": "AGLFN_LICENSE.txt",
|
||||||
|
"Copyright": "Copyright 2002, 2003, 2005, 2006, 2008, 2010, 2015 Adobe Systems"
|
||||||
|
}
|
||||||
|
]
|
@ -1106,12 +1106,11 @@ void QTextDocumentPrivate::clearUndoRedoStacks(QTextDocument::Stacks stacksToCle
|
|||||||
bool redoCommandsAvailable = undoState != undoStack.size();
|
bool redoCommandsAvailable = undoState != undoStack.size();
|
||||||
if (stacksToClear == QTextDocument::UndoStack && undoCommandsAvailable) {
|
if (stacksToClear == QTextDocument::UndoStack && undoCommandsAvailable) {
|
||||||
for (int i = 0; i < undoState; ++i) {
|
for (int i = 0; i < undoState; ++i) {
|
||||||
QTextUndoCommand c = undoStack.at(undoState);
|
QTextUndoCommand c = undoStack.at(i);
|
||||||
if (c.command & QTextUndoCommand::Custom)
|
if (c.command & QTextUndoCommand::Custom)
|
||||||
delete c.custom;
|
delete c.custom;
|
||||||
}
|
}
|
||||||
undoStack.remove(0, undoState);
|
undoStack.remove(0, undoState);
|
||||||
undoStack.resize(undoStack.size() - undoState);
|
|
||||||
undoState = 0;
|
undoState = 0;
|
||||||
if (emitSignals)
|
if (emitSignals)
|
||||||
emitUndoAvailable(false);
|
emitUndoAvailable(false);
|
||||||
|
@ -114,8 +114,8 @@ public:
|
|||||||
// not ambiguous. Implementation detail that should not be documented.
|
// not ambiguous. Implementation detail that should not be documented.
|
||||||
template<char = 0>
|
template<char = 0>
|
||||||
#endif
|
#endif
|
||||||
QTextLayout(const QString &text, const QFont &font, const QPaintDevice *paintdevice)
|
QTextLayout(const QString &textData, const QFont &textFont, const QPaintDevice *paintdevice)
|
||||||
: QTextLayout(text, font, const_cast<QPaintDevice*>(paintdevice))
|
: QTextLayout(textData, textFont, const_cast<QPaintDevice*>(paintdevice))
|
||||||
{}
|
{}
|
||||||
#else
|
#else
|
||||||
QTextLayout(const QString &text, const QFont &font, const QPaintDevice *paintdevice = nullptr);
|
QTextLayout(const QString &text, const QFont &font, const QPaintDevice *paintdevice = nullptr);
|
||||||
|
@ -106,7 +106,7 @@ static bool ft_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *leng
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QFontEngineFT::Glyph emptyGlyph = {0, 0, 0, 0, 0, 0, 0, 0};
|
static QFontEngineFT::Glyph emptyGlyph;
|
||||||
|
|
||||||
static const QFontEngine::HintStyle ftInitialDefaultHintStyle =
|
static const QFontEngine::HintStyle ftInitialDefaultHintStyle =
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@ -550,11 +550,6 @@ void QFreetypeFace::addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point,
|
|||||||
slot->bitmap.buffer, slot->bitmap.pitch, slot->bitmap.width, slot->bitmap.rows, path);
|
slot->bitmap.buffer, slot->bitmap.pitch, slot->bitmap.width, slot->bitmap.rows, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
QFontEngineFT::Glyph::~Glyph()
|
|
||||||
{
|
|
||||||
delete [] data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr)
|
static inline void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr)
|
||||||
{
|
{
|
||||||
const int offs = bgr ? -1 : 1;
|
const int offs = bgr ? -1 : 1;
|
||||||
@ -1810,11 +1805,10 @@ static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEng
|
|||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixelPosition,
|
QFontEngine::Glyph *QFontEngineFT::glyphData(glyph_t glyphIndex, QFixed subPixelPosition,
|
||||||
QFontEngine::GlyphFormat neededFormat,
|
QFontEngine::GlyphFormat neededFormat, const QTransform &t)
|
||||||
const QTransform &t, QPoint *offset)
|
|
||||||
{
|
{
|
||||||
Q_ASSERT(currentlyLockedAlphaMap.isNull());
|
Q_ASSERT(cacheEnabled);
|
||||||
|
|
||||||
if (isBitmapFont())
|
if (isBitmapFont())
|
||||||
neededFormat = Format_Mono;
|
neededFormat = Format_Mono;
|
||||||
@ -1824,33 +1818,10 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe
|
|||||||
neededFormat = Format_A8;
|
neededFormat = Format_A8;
|
||||||
|
|
||||||
Glyph *glyph = loadGlyphFor(glyphIndex, subPixelPosition, neededFormat, t);
|
Glyph *glyph = loadGlyphFor(glyphIndex, subPixelPosition, neededFormat, t);
|
||||||
|
if (!glyph || !glyph->width || !glyph->height)
|
||||||
if (offset != 0 && glyph != 0)
|
|
||||||
*offset = QPoint(glyph->x, -glyph->y);
|
|
||||||
|
|
||||||
currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat);
|
|
||||||
|
|
||||||
const bool glyphHasGeometry = glyph != nullptr && glyph->height != 0 && glyph->width != 0;
|
|
||||||
if (!cacheEnabled && glyph != &emptyGlyph) {
|
|
||||||
currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy();
|
|
||||||
delete glyph;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!glyphHasGeometry)
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (currentlyLockedAlphaMap.isNull())
|
return glyph;
|
||||||
return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset);
|
|
||||||
|
|
||||||
QImageData *data = currentlyLockedAlphaMap.data_ptr();
|
|
||||||
data->is_locked = true;
|
|
||||||
|
|
||||||
return ¤tlyLockedAlphaMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QFontEngineFT::unlockAlphaMapForGlyph()
|
|
||||||
{
|
|
||||||
QFontEngine::unlockAlphaMapForGlyph();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool is2dRotation(const QTransform &t)
|
static inline bool is2dRotation(const QTransform &t)
|
||||||
|
@ -129,20 +129,6 @@ private:
|
|||||||
class QFontEngineFT : public QFontEngine
|
class QFontEngineFT : public QFontEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/* we don't cache glyphs that are too large anyway, so we can make this struct rather small */
|
|
||||||
struct Glyph {
|
|
||||||
~Glyph();
|
|
||||||
int linearAdvance : 22;
|
|
||||||
unsigned char width;
|
|
||||||
unsigned char height;
|
|
||||||
short x;
|
|
||||||
short y;
|
|
||||||
short advance;
|
|
||||||
signed char format;
|
|
||||||
uchar *data;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GlyphInfo {
|
struct GlyphInfo {
|
||||||
int linearAdvance;
|
int linearAdvance;
|
||||||
unsigned short width;
|
unsigned short width;
|
||||||
@ -241,11 +227,9 @@ private:
|
|||||||
QFixed subPixelPosition,
|
QFixed subPixelPosition,
|
||||||
const QTransform &matrix,
|
const QTransform &matrix,
|
||||||
QFontEngine::GlyphFormat format) override;
|
QFontEngine::GlyphFormat format) override;
|
||||||
QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
|
Glyph *glyphData(glyph_t glyph, QFixed subPixelPosition,
|
||||||
GlyphFormat neededFormat, const QTransform &t,
|
GlyphFormat neededFormat, const QTransform &t) override;
|
||||||
QPoint *offset) override;
|
|
||||||
bool hasInternalCaching() const override { return cacheEnabled; }
|
bool hasInternalCaching() const override { return cacheEnabled; }
|
||||||
void unlockAlphaMapForGlyph() override;
|
|
||||||
bool expectsGammaCorrectedBlending() const override;
|
bool expectsGammaCorrectedBlending() const override;
|
||||||
|
|
||||||
void removeGlyphFromCache(glyph_t glyph) override;
|
void removeGlyphFromCache(glyph_t glyph) override;
|
||||||
|
@ -225,10 +225,11 @@ namespace QtAndroidMenu
|
|||||||
QString itemText = removeAmpersandEscapes(item->text());
|
QString itemText = removeAmpersandEscapes(item->text());
|
||||||
jstring jtext = env->NewString(reinterpret_cast<const jchar *>(itemText.data()),
|
jstring jtext = env->NewString(reinterpret_cast<const jchar *>(itemText.data()),
|
||||||
itemText.length());
|
itemText.length());
|
||||||
|
jint menuId = platformMenu->menuId(item);
|
||||||
jobject menuItem = env->CallObjectMethod(menu,
|
jobject menuItem = env->CallObjectMethod(menu,
|
||||||
addMenuItemMethodID,
|
addMenuItemMethodID,
|
||||||
menuNoneValue,
|
menuNoneValue,
|
||||||
int(item->tag()),
|
menuId,
|
||||||
order++,
|
order++,
|
||||||
jtext);
|
jtext);
|
||||||
env->DeleteLocalRef(jtext);
|
env->DeleteLocalRef(jtext);
|
||||||
@ -262,10 +263,11 @@ namespace QtAndroidMenu
|
|||||||
QString itemText = removeAmpersandEscapes(item->text());
|
QString itemText = removeAmpersandEscapes(item->text());
|
||||||
jstring jtext = env->NewString(reinterpret_cast<const jchar *>(itemText.data()),
|
jstring jtext = env->NewString(reinterpret_cast<const jchar *>(itemText.data()),
|
||||||
itemText.length());
|
itemText.length());
|
||||||
|
jint menuId = visibleMenuBar->menuId(item);
|
||||||
jobject menuItem = env->CallObjectMethod(menu,
|
jobject menuItem = env->CallObjectMethod(menu,
|
||||||
addMenuItemMethodID,
|
addMenuItemMethodID,
|
||||||
menuNoneValue,
|
menuNoneValue,
|
||||||
int(item->tag()),
|
menuId,
|
||||||
order++,
|
order++,
|
||||||
jtext);
|
jtext);
|
||||||
env->DeleteLocalRef(jtext);
|
env->DeleteLocalRef(jtext);
|
||||||
@ -290,7 +292,7 @@ namespace QtAndroidMenu
|
|||||||
|
|
||||||
const QAndroidPlatformMenuBar::PlatformMenusType &menus = visibleMenuBar->menus();
|
const QAndroidPlatformMenuBar::PlatformMenusType &menus = visibleMenuBar->menus();
|
||||||
if (menus.size() == 1) { // Expanded menu
|
if (menus.size() == 1) { // Expanded menu
|
||||||
QAndroidPlatformMenuItem *item = static_cast<QAndroidPlatformMenuItem *>(menus.front()->menuItemForTag(menuId));
|
QAndroidPlatformMenuItem *item = static_cast<QAndroidPlatformMenuItem *>(menus.front()->menuItemForId(menuId));
|
||||||
if (item) {
|
if (item) {
|
||||||
if (item->menu()) {
|
if (item->menu()) {
|
||||||
showContextMenu(item->menu(), QRect(), env);
|
showContextMenu(item->menu(), QRect(), env);
|
||||||
@ -301,7 +303,7 @@ namespace QtAndroidMenu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QAndroidPlatformMenu *menu = static_cast<QAndroidPlatformMenu *>(visibleMenuBar->menuForTag(menuId));
|
QAndroidPlatformMenu *menu = static_cast<QAndroidPlatformMenu *>(visibleMenuBar->menuForId(menuId));
|
||||||
if (menu)
|
if (menu)
|
||||||
showContextMenu(menu, QRect(), env);
|
showContextMenu(menu, QRect(), env);
|
||||||
}
|
}
|
||||||
@ -341,7 +343,7 @@ namespace QtAndroidMenu
|
|||||||
static jboolean onContextItemSelected(JNIEnv *env, jobject /*thiz*/, jint menuId, jboolean checked)
|
static jboolean onContextItemSelected(JNIEnv *env, jobject /*thiz*/, jint menuId, jboolean checked)
|
||||||
{
|
{
|
||||||
QMutexLocker lock(&visibleMenuMutex);
|
QMutexLocker lock(&visibleMenuMutex);
|
||||||
QAndroidPlatformMenuItem * item = static_cast<QAndroidPlatformMenuItem *>(visibleMenu->menuItemForTag(menuId));
|
QAndroidPlatformMenuItem * item = static_cast<QAndroidPlatformMenuItem *>(visibleMenu->menuItemForId(menuId));
|
||||||
if (item) {
|
if (item) {
|
||||||
if (item->menu()) {
|
if (item->menu()) {
|
||||||
showContextMenu(item->menu(), QRect(), env);
|
showContextMenu(item->menu(), QRect(), env);
|
||||||
|
@ -62,6 +62,7 @@ void QAndroidPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatform
|
|||||||
m_menuItems.end(),
|
m_menuItems.end(),
|
||||||
static_cast<QAndroidPlatformMenuItem *>(before)),
|
static_cast<QAndroidPlatformMenuItem *>(before)),
|
||||||
static_cast<QAndroidPlatformMenuItem *>(menuItem));
|
static_cast<QAndroidPlatformMenuItem *>(menuItem));
|
||||||
|
m_menuHash.insert(m_nextMenuId++, menuItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem)
|
void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem)
|
||||||
@ -72,6 +73,21 @@ void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem)
|
|||||||
static_cast<QAndroidPlatformMenuItem *>(menuItem));
|
static_cast<QAndroidPlatformMenuItem *>(menuItem));
|
||||||
if (it != m_menuItems.end())
|
if (it != m_menuItems.end())
|
||||||
m_menuItems.erase(it);
|
m_menuItems.erase(it);
|
||||||
|
|
||||||
|
{
|
||||||
|
int maxId = -1;
|
||||||
|
QHash<int, QPlatformMenuItem *>::iterator it = m_menuHash.begin();
|
||||||
|
while (it != m_menuHash.end()) {
|
||||||
|
if (it.value() == menuItem) {
|
||||||
|
it = m_menuHash.erase(it);
|
||||||
|
} else {
|
||||||
|
maxId = qMax(maxId, it.key());
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_nextMenuId = maxId + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAndroidPlatformMenu::syncMenuItem(QPlatformMenuItem *menuItem)
|
void QAndroidPlatformMenu::syncMenuItem(QPlatformMenuItem *menuItem)
|
||||||
@ -139,6 +155,16 @@ void QAndroidPlatformMenu::showPopup(const QWindow *parentWindow, const QRect &t
|
|||||||
QtAndroidMenu::showContextMenu(this, targetRect, QJNIEnvironmentPrivate());
|
QtAndroidMenu::showContextMenu(this, targetRect, QJNIEnvironmentPrivate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPlatformMenuItem *QAndroidPlatformMenu::menuItemForTag(quintptr tag) const
|
||||||
|
{
|
||||||
|
for (QAndroidPlatformMenuItem *menuItem : m_menuItems) {
|
||||||
|
if (menuItem->tag() == tag)
|
||||||
|
return menuItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const
|
QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const
|
||||||
{
|
{
|
||||||
if (position < m_menuItems.size())
|
if (position < m_menuItems.size())
|
||||||
@ -146,13 +172,20 @@ QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformMenuItem *QAndroidPlatformMenu::menuItemForTag(quintptr tag) const
|
int QAndroidPlatformMenu::menuId(QPlatformMenuItem *menu) const
|
||||||
{
|
{
|
||||||
for (QPlatformMenuItem *menuItem : m_menuItems) {
|
QHash<int, QPlatformMenuItem *>::const_iterator it;
|
||||||
if (menuItem->tag() == tag)
|
for (it = m_menuHash.constBegin(); it != m_menuHash.constEnd(); ++it) {
|
||||||
return menuItem;
|
if (it.value() == menu)
|
||||||
|
return it.key();
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPlatformMenuItem *QAndroidPlatformMenu::menuItemForId(int menuId) const
|
||||||
|
{
|
||||||
|
return m_menuHash.value(menuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
QAndroidPlatformMenu::PlatformMenuItemsType QAndroidPlatformMenu::menuItems() const
|
QAndroidPlatformMenu::PlatformMenuItemsType QAndroidPlatformMenu::menuItems() const
|
||||||
|
@ -73,6 +73,8 @@ public:
|
|||||||
|
|
||||||
QPlatformMenuItem *menuItemAt(int position) const override;
|
QPlatformMenuItem *menuItemAt(int position) const override;
|
||||||
QPlatformMenuItem *menuItemForTag(quintptr tag) const override;
|
QPlatformMenuItem *menuItemForTag(quintptr tag) const override;
|
||||||
|
QPlatformMenuItem *menuItemForId(int menuId) const;
|
||||||
|
int menuId(QPlatformMenuItem *menuItem) const;
|
||||||
|
|
||||||
PlatformMenuItemsType menuItems() const;
|
PlatformMenuItemsType menuItems() const;
|
||||||
QMutex *menuItemsMutex();
|
QMutex *menuItemsMutex();
|
||||||
@ -84,6 +86,9 @@ private:
|
|||||||
bool m_enabled;
|
bool m_enabled;
|
||||||
bool m_isVisible;
|
bool m_isVisible;
|
||||||
QMutex m_menuItemsMutex;
|
QMutex m_menuItemsMutex;
|
||||||
|
|
||||||
|
int m_nextMenuId = 0;
|
||||||
|
QHash<int, QPlatformMenuItem *> m_menuHash;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -61,6 +61,7 @@ void QAndroidPlatformMenuBar::insertMenu(QPlatformMenu *menu, QPlatformMenu *bef
|
|||||||
m_menus.end(),
|
m_menus.end(),
|
||||||
static_cast<QAndroidPlatformMenu *>(before)),
|
static_cast<QAndroidPlatformMenu *>(before)),
|
||||||
static_cast<QAndroidPlatformMenu *>(menu));
|
static_cast<QAndroidPlatformMenu *>(menu));
|
||||||
|
m_menuHash.insert(m_nextMenuId++, menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAndroidPlatformMenuBar::removeMenu(QPlatformMenu *menu)
|
void QAndroidPlatformMenuBar::removeMenu(QPlatformMenu *menu)
|
||||||
@ -69,6 +70,30 @@ void QAndroidPlatformMenuBar::removeMenu(QPlatformMenu *menu)
|
|||||||
m_menus.erase(std::find(m_menus.begin(),
|
m_menus.erase(std::find(m_menus.begin(),
|
||||||
m_menus.end(),
|
m_menus.end(),
|
||||||
static_cast<QAndroidPlatformMenu *>(menu)));
|
static_cast<QAndroidPlatformMenu *>(menu)));
|
||||||
|
|
||||||
|
int maxId = -1;
|
||||||
|
QHash<int, QPlatformMenu *>::iterator it = m_menuHash.begin();
|
||||||
|
while (it != m_menuHash.end()) {
|
||||||
|
if (it.value() == menu) {
|
||||||
|
it = m_menuHash.erase(it);
|
||||||
|
} else {
|
||||||
|
maxId = qMax(maxId, it.key());
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_nextMenuId = maxId + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int QAndroidPlatformMenuBar::menuId(QPlatformMenu *menu) const
|
||||||
|
{
|
||||||
|
QHash<int, QPlatformMenu *>::const_iterator it;
|
||||||
|
for (it = m_menuHash.constBegin(); it != m_menuHash.constEnd(); ++it) {
|
||||||
|
if (it.value() == menu)
|
||||||
|
return it.key();
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAndroidPlatformMenuBar::syncMenu(QPlatformMenu *menu)
|
void QAndroidPlatformMenuBar::syncMenu(QPlatformMenu *menu)
|
||||||
@ -86,12 +111,17 @@ void QAndroidPlatformMenuBar::handleReparent(QWindow *newParentWindow)
|
|||||||
|
|
||||||
QPlatformMenu *QAndroidPlatformMenuBar::menuForTag(quintptr tag) const
|
QPlatformMenu *QAndroidPlatformMenuBar::menuForTag(quintptr tag) const
|
||||||
{
|
{
|
||||||
for (QPlatformMenu *menu : m_menus) {
|
for (QAndroidPlatformMenu *menu : m_menus) {
|
||||||
if (menu->tag() == tag)
|
if (menu->tag() == tag)
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPlatformMenu *QAndroidPlatformMenuBar::menuForId(int menuId) const
|
||||||
|
{
|
||||||
|
return m_menuHash.value(menuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWindow *QAndroidPlatformMenuBar::parentWindow() const
|
QWindow *QAndroidPlatformMenuBar::parentWindow() const
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include <qpa/qplatformmenu.h>
|
#include <qpa/qplatformmenu.h>
|
||||||
#include <qvector.h>
|
#include <qvector.h>
|
||||||
#include <qmutex.h>
|
#include <qmutex.h>
|
||||||
|
#include <qhash.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -60,6 +61,8 @@ public:
|
|||||||
void syncMenu(QPlatformMenu *menu) override;
|
void syncMenu(QPlatformMenu *menu) override;
|
||||||
void handleReparent(QWindow *newParentWindow) override;
|
void handleReparent(QWindow *newParentWindow) override;
|
||||||
QPlatformMenu *menuForTag(quintptr tag) const override;
|
QPlatformMenu *menuForTag(quintptr tag) const override;
|
||||||
|
QPlatformMenu *menuForId(int menuId) const;
|
||||||
|
int menuId(QPlatformMenu *menu) const;
|
||||||
|
|
||||||
QWindow *parentWindow() const override;
|
QWindow *parentWindow() const override;
|
||||||
PlatformMenusType menus() const;
|
PlatformMenusType menus() const;
|
||||||
@ -69,6 +72,9 @@ private:
|
|||||||
PlatformMenusType m_menus;
|
PlatformMenusType m_menus;
|
||||||
QWindow *m_parentWindow;
|
QWindow *m_parentWindow;
|
||||||
QMutex m_menusListMutex;
|
QMutex m_menusListMutex;
|
||||||
|
|
||||||
|
int m_nextMenuId = 0;
|
||||||
|
QHash<int, QPlatformMenu *> m_menuHash;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -197,8 +197,15 @@ NSOpenGLPixelFormat *QCocoaGLContext::pixelFormatForSurfaceFormat(const QSurface
|
|||||||
attrs << NSOpenGLPFAStencilSize << format.stencilBufferSize();
|
attrs << NSOpenGLPFAStencilSize << format.stencilBufferSize();
|
||||||
if (format.alphaBufferSize() > 0)
|
if (format.alphaBufferSize() > 0)
|
||||||
attrs << NSOpenGLPFAAlphaSize << format.alphaBufferSize();
|
attrs << NSOpenGLPFAAlphaSize << format.alphaBufferSize();
|
||||||
if (format.redBufferSize() > 0 && format.greenBufferSize() > 0 && format.blueBufferSize() > 0) {
|
|
||||||
const int colorSize = format.redBufferSize() + format.greenBufferSize() + format.blueBufferSize();
|
auto rbz = format.redBufferSize();
|
||||||
|
auto gbz = format.greenBufferSize();
|
||||||
|
auto bbz = format.blueBufferSize();
|
||||||
|
if (rbz > 0 || gbz > 0 || bbz > 0) {
|
||||||
|
auto fallbackSize = qMax(rbz, qMax(gbz, bbz));
|
||||||
|
auto colorSize = (rbz > 0 ? rbz : fallbackSize)
|
||||||
|
+ (gbz > 0 ? gbz : fallbackSize)
|
||||||
|
+ (bbz > 0 ? bbz : fallbackSize);
|
||||||
attrs << NSOpenGLPFAColorSize << colorSize << NSOpenGLPFAMinimumPolicy;
|
attrs << NSOpenGLPFAColorSize << colorSize << NSOpenGLPFAMinimumPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@
|
|||||||
NSMenuItem *aboutItem;
|
NSMenuItem *aboutItem;
|
||||||
NSMenuItem *aboutQtItem;
|
NSMenuItem *aboutQtItem;
|
||||||
NSMenuItem *hideItem;
|
NSMenuItem *hideItem;
|
||||||
NSMenuItem *lastAppSpecificItem;
|
|
||||||
NSMenuItem *servicesItem;
|
NSMenuItem *servicesItem;
|
||||||
NSMenuItem *hideAllOthersItem;
|
NSMenuItem *hideAllOthersItem;
|
||||||
NSMenuItem *showAllItem;
|
NSMenuItem *showAllItem;
|
||||||
@ -118,6 +117,9 @@
|
|||||||
[appMenu addItem:[NSMenuItem separatorItem]];
|
[appMenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
|
||||||
// Preferences
|
// Preferences
|
||||||
|
// We'll be adding app specific items after this. The macOS HIG state that,
|
||||||
|
// "In general, a Preferences menu item should be the first app-specific menu item."
|
||||||
|
// https://developer.apple.com/macos/human-interface-guidelines/menus/menu-bar-menus/
|
||||||
preferencesItem = [[QCocoaNSMenuItem alloc] init];
|
preferencesItem = [[QCocoaNSMenuItem alloc] init];
|
||||||
preferencesItem.title = @"Preferences…";
|
preferencesItem.title = @"Preferences…";
|
||||||
preferencesItem.keyEquivalent = @",";
|
preferencesItem.keyEquivalent = @",";
|
||||||
@ -126,11 +128,6 @@
|
|||||||
preferencesItem.hidden = YES;
|
preferencesItem.hidden = YES;
|
||||||
[appMenu addItem:preferencesItem];
|
[appMenu addItem:preferencesItem];
|
||||||
|
|
||||||
// We'll be adding app specific items after this. The macOS HIG state that,
|
|
||||||
// "In general, a Preferences menu item should be the first app-specific menu item."
|
|
||||||
// https://developer.apple.com/macos/human-interface-guidelines/menus/menu-bar-menus/
|
|
||||||
lastAppSpecificItem = preferencesItem;
|
|
||||||
|
|
||||||
[appMenu addItem:[NSMenuItem separatorItem]];
|
[appMenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
|
||||||
// Services item and menu
|
// Services item and menu
|
||||||
@ -194,8 +191,6 @@
|
|||||||
[showAllItem release];
|
[showAllItem release];
|
||||||
[quitItem release];
|
[quitItem release];
|
||||||
|
|
||||||
[lastAppSpecificItem release];
|
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,25 +267,20 @@
|
|||||||
// No reason to create the item if it already exists.
|
// No reason to create the item if it already exists.
|
||||||
for (NSMenuItem *item in appMenu.itemArray)
|
for (NSMenuItem *item in appMenu.itemArray)
|
||||||
if (qt_objc_cast<QCocoaNSMenuItem *>(item).platformMenuItem == platformItem)
|
if (qt_objc_cast<QCocoaNSMenuItem *>(item).platformMenuItem == platformItem)
|
||||||
return [[item retain] autorelease];
|
return item;
|
||||||
|
|
||||||
// Create an App-Specific menu item, insert it into the menu and return
|
// Create an App-Specific menu item, insert it into the menu and return
|
||||||
// it as an autorelease item.
|
// it as an autorelease item.
|
||||||
QCocoaNSMenuItem *item;
|
QCocoaNSMenuItem *item;
|
||||||
if (platformItem->isSeparator())
|
if (platformItem->isSeparator())
|
||||||
item = [[QCocoaNSMenuItem separatorItemWithPlatformMenuItem:platformItem] retain];
|
item = [QCocoaNSMenuItem separatorItemWithPlatformMenuItem:platformItem];
|
||||||
else
|
else
|
||||||
item = [[QCocoaNSMenuItem alloc] initWithPlatformMenuItem:platformItem];
|
item = [[[QCocoaNSMenuItem alloc] initWithPlatformMenuItem:platformItem] autorelease];
|
||||||
|
|
||||||
const auto location = [appMenu indexOfItem:lastAppSpecificItem];
|
const auto location = [self indexOfLastAppSpecificMenuItem];
|
||||||
|
[appMenu insertItem:item atIndex:NSInteger(location) + 1];
|
||||||
|
|
||||||
if (!lastAppSpecificItem.separatorItem)
|
return item;
|
||||||
[lastAppSpecificItem release];
|
|
||||||
lastAppSpecificItem = item; // Keep track of this for later (i.e., don't release it)
|
|
||||||
|
|
||||||
[appMenu insertItem:item atIndex:location + 1];
|
|
||||||
|
|
||||||
return [[item retain] autorelease];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)orderFrontStandardAboutPanel:(id)sender
|
- (void)orderFrontStandardAboutPanel:(id)sender
|
||||||
@ -344,8 +334,24 @@
|
|||||||
- (NSArray<NSMenuItem *> *)mergeable
|
- (NSArray<NSMenuItem *> *)mergeable
|
||||||
{
|
{
|
||||||
// Don't include the quitItem here, since we want it always visible and enabled regardless
|
// Don't include the quitItem here, since we want it always visible and enabled regardless
|
||||||
// Note that lastAppSpecificItem may be nil, so we can't use @[] here.
|
auto items = [NSArray arrayWithObjects:preferencesItem, aboutItem, aboutQtItem,
|
||||||
return [NSArray arrayWithObjects:preferencesItem, aboutItem, aboutQtItem, lastAppSpecificItem, nil];
|
appMenu.itemArray[[self indexOfLastAppSpecificMenuItem]], nil];
|
||||||
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSUInteger)indexOfLastAppSpecificMenuItem
|
||||||
|
{
|
||||||
|
// Either the 'Preferences', which is the first app specific menu item, or something
|
||||||
|
// else we appended later (thus the reverse order):
|
||||||
|
const auto location = [appMenu.itemArray indexOfObjectWithOptions:NSEnumerationReverse
|
||||||
|
passingTest:^BOOL(NSMenuItem *item, NSUInteger, BOOL *) {
|
||||||
|
if (auto qtItem = qt_objc_cast<QCocoaNSMenuItem*>(item))
|
||||||
|
return qtItem != quitItem;
|
||||||
|
return NO;
|
||||||
|
}];
|
||||||
|
Q_ASSERT(location != NSNotFound);
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -177,6 +177,9 @@ void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine
|
|||||||
|
|
||||||
QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard()
|
QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard()
|
||||||
{
|
{
|
||||||
|
// Note: starting with macOS 10.14, the KeyboardSetupAssistant app bundle no
|
||||||
|
// longer contains the "Background.png" image. This function then returns a
|
||||||
|
// null pixmap.
|
||||||
const int ExpectedImageWidth = 242;
|
const int ExpectedImageWidth = 242;
|
||||||
const int ExpectedImageHeight = 414;
|
const int ExpectedImageHeight = 414;
|
||||||
QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier(
|
QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier(
|
||||||
|
@ -1544,12 +1544,6 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
|
|||||||
Qt::WindowType type = window()->type();
|
Qt::WindowType type = window()->type();
|
||||||
Qt::WindowFlags flags = window()->flags();
|
Qt::WindowFlags flags = window()->flags();
|
||||||
|
|
||||||
// Note: The macOS window manager has a bug, where if a screen is rotated, it will not allow
|
|
||||||
// a window to be created within the area of the screen that has a Y coordinate (I quadrant)
|
|
||||||
// higher than the height of the screen in its non-rotated state, unless the window is
|
|
||||||
// created with the NSWindowStyleMaskBorderless style mask.
|
|
||||||
NSWindowStyleMask styleMask = windowStyleMask(flags);
|
|
||||||
|
|
||||||
QRect rect = geometry();
|
QRect rect = geometry();
|
||||||
|
|
||||||
QScreen *targetScreen = nullptr;
|
QScreen *targetScreen = nullptr;
|
||||||
@ -1560,35 +1554,57 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSWindowStyleMask styleMask = windowStyleMask(flags);
|
||||||
|
|
||||||
if (!targetScreen) {
|
if (!targetScreen) {
|
||||||
qCWarning(lcQpaWindow) << "Window position" << rect << "outside any known screen, using primary screen";
|
qCWarning(lcQpaWindow) << "Window position" << rect << "outside any known screen, using primary screen";
|
||||||
targetScreen = QGuiApplication::primaryScreen();
|
targetScreen = QGuiApplication::primaryScreen();
|
||||||
// AppKit will only reposition a window that's outside the target screen area if
|
// Unless the window is created as borderless AppKit won't find a position and
|
||||||
// the window has a title bar. If left out, the window ends up with no screen.
|
// screen that's close to the requested invalid position, and will always place
|
||||||
// The style mask will be corrected to the original style mask in setWindowFlags.
|
// the window on the primary screen.
|
||||||
styleMask |= NSWindowStyleMaskTitled;
|
styleMask = NSWindowStyleMaskBorderless;
|
||||||
}
|
}
|
||||||
|
|
||||||
rect.translate(-targetScreen->geometry().topLeft());
|
rect.translate(-targetScreen->geometry().topLeft());
|
||||||
QCocoaScreen *cocoaScreen = static_cast<QCocoaScreen *>(targetScreen->handle());
|
auto *targetCocoaScreen = static_cast<QCocoaScreen *>(targetScreen->handle());
|
||||||
NSRect frame = QCocoaScreen::mapToNative(rect, cocoaScreen);
|
NSRect contentRect = QCocoaScreen::mapToNative(rect, targetCocoaScreen);
|
||||||
|
|
||||||
|
if (targetScreen->primaryOrientation() == Qt::PortraitOrientation) {
|
||||||
|
// The macOS window manager has a bug, where if a screen is rotated, it will not allow
|
||||||
|
// a window to be created within the area of the screen that has a Y coordinate (I quadrant)
|
||||||
|
// higher than the height of the screen in its non-rotated state (including a magic padding
|
||||||
|
// of 24 points), unless the window is created with the NSWindowStyleMaskBorderless style mask.
|
||||||
|
if (styleMask && (contentRect.origin.y + 24 > targetScreen->geometry().width())) {
|
||||||
|
qCDebug(lcQpaWindow) << "Window positioned on portrait screen."
|
||||||
|
<< "Adjusting style mask during creation";
|
||||||
|
styleMask = NSWindowStyleMaskBorderless;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create NSWindow
|
// Create NSWindow
|
||||||
Class windowClass = shouldBePanel ? [QNSPanel class] : [QNSWindow class];
|
Class windowClass = shouldBePanel ? [QNSPanel class] : [QNSWindow class];
|
||||||
QCocoaNSWindow *nsWindow = [[windowClass alloc] initWithContentRect:frame
|
QCocoaNSWindow *nsWindow = [[windowClass alloc] initWithContentRect:contentRect
|
||||||
|
// Mask will be updated in setWindowFlags if not the final mask
|
||||||
styleMask:styleMask
|
styleMask:styleMask
|
||||||
// Deferring window creation breaks OpenGL (the GL context is
|
// Deferring window creation breaks OpenGL (the GL context is
|
||||||
// set up before the window is shown and needs a proper window)
|
// set up before the window is shown and needs a proper window)
|
||||||
backing:NSBackingStoreBuffered defer:NO
|
backing:NSBackingStoreBuffered defer:NO
|
||||||
screen:cocoaScreen->nativeScreen()
|
screen:targetCocoaScreen->nativeScreen()
|
||||||
platformWindow:this];
|
platformWindow:this];
|
||||||
|
|
||||||
Q_ASSERT_X(nsWindow.screen == cocoaScreen->nativeScreen(), "QCocoaWindow",
|
// The resulting screen can be different from the screen requested if
|
||||||
"Resulting NSScreen should match the requested NSScreen");
|
// for example the application has been assigned to a specific display.
|
||||||
|
auto resultingScreen = QCocoaScreen::get(nsWindow.screen);
|
||||||
|
|
||||||
if (targetScreen != window()->screen()) {
|
// But may not always be resolved at this point, in which case we fall back
|
||||||
|
// to the target screen. The real screen will be delivered as a screen change
|
||||||
|
// when resolved as part of ordering the window on screen.
|
||||||
|
if (!resultingScreen)
|
||||||
|
resultingScreen = targetCocoaScreen;
|
||||||
|
|
||||||
|
if (resultingScreen->screen() != window()->screen()) {
|
||||||
QWindowSystemInterface::handleWindowScreenChanged<
|
QWindowSystemInterface::handleWindowScreenChanged<
|
||||||
QWindowSystemInterface::SynchronousDelivery>(window(), targetScreen);
|
QWindowSystemInterface::SynchronousDelivery>(window(), resultingScreen->screen());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QSharedPointer<QNSWindowDelegate> sharedDelegate([[QNSWindowDelegate alloc] init],
|
static QSharedPointer<QNSWindowDelegate> sharedDelegate([[QNSWindowDelegate alloc] init],
|
||||||
|
@ -92,7 +92,8 @@ void QCocoaWindowManager::modalSessionChanged()
|
|||||||
if (NSApp.modalWindow) {
|
if (NSApp.modalWindow) {
|
||||||
// Lower window to that of the modal windows, but no less
|
// Lower window to that of the modal windows, but no less
|
||||||
nativeWindow.level = NSModalPanelWindowLevel;
|
nativeWindow.level = NSModalPanelWindowLevel;
|
||||||
[nativeWindow orderBack:nil];
|
if ([nativeWindow isVisible])
|
||||||
|
[nativeWindow orderBack:nil];
|
||||||
} else {
|
} else {
|
||||||
// Restore window's natural window level, whatever that was
|
// Restore window's natural window level, whatever that was
|
||||||
nativeWindow.level = naturalWindowLevel;
|
nativeWindow.level = naturalWindowLevel;
|
||||||
|
@ -265,6 +265,7 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
|
|||||||
case RasterGLSurface: return false;
|
case RasterGLSurface: return false;
|
||||||
#endif
|
#endif
|
||||||
case WindowManagement: return false;
|
case WindowManagement: return false;
|
||||||
|
case OpenGLOnRasterSurface: return true;
|
||||||
default: return QPlatformIntegration::hasCapability(cap);
|
default: return QPlatformIntegration::hasCapability(cap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,6 @@ QEglFSWindow::QEglFSWindow(QWindow *w)
|
|||||||
m_backingStore(0),
|
m_backingStore(0),
|
||||||
m_rasterCompositingContext(0),
|
m_rasterCompositingContext(0),
|
||||||
#endif
|
#endif
|
||||||
m_raster(false),
|
|
||||||
m_winId(0),
|
m_winId(0),
|
||||||
m_surface(EGL_NO_SURFACE),
|
m_surface(EGL_NO_SURFACE),
|
||||||
m_window(0),
|
m_window(0),
|
||||||
@ -94,11 +93,6 @@ void QEglFSWindow::create()
|
|||||||
|
|
||||||
m_winId = newWId();
|
m_winId = newWId();
|
||||||
|
|
||||||
// Save the original surface type before changing to OpenGLSurface.
|
|
||||||
m_raster = (window()->surfaceType() == QSurface::RasterSurface);
|
|
||||||
if (m_raster) // change to OpenGL, but not for RasterGLSurface
|
|
||||||
window()->setSurfaceType(QSurface::OpenGLSurface);
|
|
||||||
|
|
||||||
if (window()->type() == Qt::Desktop) {
|
if (window()->type() == Qt::Desktop) {
|
||||||
QRect fullscreenRect(QPoint(), screen()->availableGeometry().size());
|
QRect fullscreenRect(QPoint(), screen()->availableGeometry().size());
|
||||||
QWindowSystemInterface::handleGeometryChange(window(), fullscreenRect);
|
QWindowSystemInterface::handleGeometryChange(window(), fullscreenRect);
|
||||||
@ -329,7 +323,8 @@ QEglFSScreen *QEglFSWindow::screen() const
|
|||||||
|
|
||||||
bool QEglFSWindow::isRaster() const
|
bool QEglFSWindow::isRaster() const
|
||||||
{
|
{
|
||||||
return m_raster || window()->surfaceType() == QSurface::RasterGLSurface;
|
const QWindow::SurfaceType type = window()->surfaceType();
|
||||||
|
return type == QSurface::RasterSurface || type == QSurface::RasterGLSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_OPENGL
|
#ifndef QT_NO_OPENGL
|
||||||
|
@ -118,7 +118,6 @@ protected:
|
|||||||
QOpenGLCompositorBackingStore *m_backingStore;
|
QOpenGLCompositorBackingStore *m_backingStore;
|
||||||
QOpenGLContext *m_rasterCompositingContext;
|
QOpenGLContext *m_rasterCompositingContext;
|
||||||
#endif
|
#endif
|
||||||
bool m_raster;
|
|
||||||
WId m_winId;
|
WId m_winId;
|
||||||
|
|
||||||
EGLSurface m_surface;
|
EGLSurface m_surface;
|
||||||
|
@ -168,6 +168,7 @@ bool QWasmIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
|||||||
case RasterGLSurface: return false; // to enable this you need to fix qopenglwidget and quickwidget for wasm
|
case RasterGLSurface: return false; // to enable this you need to fix qopenglwidget and quickwidget for wasm
|
||||||
case MultipleWindows: return true;
|
case MultipleWindows: return true;
|
||||||
case WindowManagement: return true;
|
case WindowManagement: return true;
|
||||||
|
case OpenGLOnRasterSurface: return true;
|
||||||
default: return QPlatformIntegration::hasCapability(cap);
|
default: return QPlatformIntegration::hasCapability(cap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2674,7 +2674,8 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re
|
|||||||
// QTBUG-32663, suppress resize cursor for fixed size windows.
|
// QTBUG-32663, suppress resize cursor for fixed size windows.
|
||||||
const QWindow *w = window();
|
const QWindow *w = window();
|
||||||
if (!w->isTopLevel() // Task 105852, minimized windows need to respond to user input.
|
if (!w->isTopLevel() // Task 105852, minimized windows need to respond to user input.
|
||||||
|| !(m_windowState & ~Qt::WindowActive)
|
|| (m_windowState != Qt::WindowNoState)
|
||||||
|
|| !isActive()
|
||||||
|| (m_data.flags & Qt::FramelessWindowHint)) {
|
|| (m_data.flags & Qt::FramelessWindowHint)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2694,12 +2695,10 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (localPos.y() < 0) {
|
if (localPos.y() < 0) {
|
||||||
const QMargins margins = frameMargins();
|
const int topResizeBarPos = -frameMargins().top();
|
||||||
const int topResizeBarPos = margins.left() - margins.top();
|
if (localPos.y() >= topResizeBarPos)
|
||||||
if (localPos.y() < topResizeBarPos) {
|
|
||||||
*result = HTCAPTION; // Extend caption over top resize bar, let's user move the window.
|
*result = HTCAPTION; // Extend caption over top resize bar, let's user move the window.
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fixedWidth && (localPos.x() < 0 || localPos.x() >= size.width())) {
|
if (fixedWidth && (localPos.x() < 0 || localPos.x() >= size.width())) {
|
||||||
|
@ -3899,6 +3899,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
|
|||||||
CGContextScaleCTM(ctx, -1, 1);
|
CGContextScaleCTM(ctx, -1, 1);
|
||||||
CGContextTranslateCTM(ctx, -frameRect.left(), 0);
|
CGContextTranslateCTM(ctx, -frameRect.left(), 0);
|
||||||
} else if (tabDirection == QMacStylePrivate::West && tp == QStyleOptionTab::Beginning) {
|
} else if (tabDirection == QMacStylePrivate::West && tp == QStyleOptionTab::Beginning) {
|
||||||
|
CGContextTranslateCTM(ctx, 0, opt->rect.top());
|
||||||
CGContextScaleCTM(ctx, 1, -1);
|
CGContextScaleCTM(ctx, 1, -1);
|
||||||
CGContextTranslateCTM(ctx, 0, -frameRect.right());
|
CGContextTranslateCTM(ctx, 0, -frameRect.right());
|
||||||
} else if (tabDirection == QMacStylePrivate::East && tp == QStyleOptionTab::End) {
|
} else if (tabDirection == QMacStylePrivate::East && tp == QStyleOptionTab::End) {
|
||||||
|
@ -297,6 +297,12 @@ void Automaton::build ()
|
|||||||
buildDefaultReduceActions ();
|
buildDefaultReduceActions ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__cpp_lib_not_fn) && __cpp_lib_not_fn >= 201603
|
||||||
|
# define Q_NOT_FN std::not_fn
|
||||||
|
#else
|
||||||
|
# define Q_NOT_FN std::not1
|
||||||
|
#endif
|
||||||
|
|
||||||
void Automaton::buildNullables ()
|
void Automaton::buildNullables ()
|
||||||
{
|
{
|
||||||
bool changed = true;
|
bool changed = true;
|
||||||
@ -307,7 +313,7 @@ void Automaton::buildNullables ()
|
|||||||
|
|
||||||
for (RulePointer rule = _M_grammar->rules.begin (); rule != _M_grammar->rules.end (); ++rule)
|
for (RulePointer rule = _M_grammar->rules.begin (); rule != _M_grammar->rules.end (); ++rule)
|
||||||
{
|
{
|
||||||
NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (Nullable (this)));
|
NameList::iterator nn = std::find_if(rule->rhs.begin(), rule->rhs.end(), Q_NOT_FN(Nullable(this)));
|
||||||
|
|
||||||
if (nn == rule->rhs.end ())
|
if (nn == rule->rhs.end ())
|
||||||
changed |= nullables.insert (rule->lhs).second;
|
changed |= nullables.insert (rule->lhs).second;
|
||||||
@ -648,7 +654,7 @@ void Automaton::buildIncludesDigraph ()
|
|||||||
if (! _M_grammar->isNonTerminal (*A))
|
if (! _M_grammar->isNonTerminal (*A))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (Nullable (this)));
|
NameList::iterator first_not_nullable = std::find_if(dot, rule->rhs.end(), Q_NOT_FN(Nullable(this)));
|
||||||
if (first_not_nullable != rule->rhs.end ())
|
if (first_not_nullable != rule->rhs.end ())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -2379,10 +2379,10 @@ QList<QUrl> QFileDialog::getOpenFileUrls(QWidget *parent,
|
|||||||
It can also be used on other platforms, where it will fall back to using QFileDialog.
|
It can also be used on other platforms, where it will fall back to using QFileDialog.
|
||||||
|
|
||||||
The function is asynchronous and returns immediately. The \a fileOpenCompleted
|
The function is asynchronous and returns immediately. The \a fileOpenCompleted
|
||||||
callback will be called when a file has been selected and its contents has been
|
callback will be called when a file has been selected and its contents have been
|
||||||
read into memory.
|
read into memory.
|
||||||
|
|
||||||
\snippet code/src_gui_dialogs_qfiledialog.cpp 14
|
\snippet code/src_gui_dialogs_qfiledialog.cpp 15
|
||||||
\since 5.13
|
\since 5.13
|
||||||
*/
|
*/
|
||||||
void QFileDialog::getOpenFileContent(const QString &nameFilter, const std::function<void(const QString &, const QByteArray &)> &fileOpenCompleted)
|
void QFileDialog::getOpenFileContent(const QString &nameFilter, const std::function<void(const QString &, const QByteArray &)> &fileOpenCompleted)
|
||||||
|
@ -2892,7 +2892,7 @@ void QWizard::setPixmap(WizardPixmap which, const QPixmap &pixmap)
|
|||||||
Returns the pixmap set for role \a which.
|
Returns the pixmap set for role \a which.
|
||||||
|
|
||||||
By default, the only pixmap that is set is the BackgroundPixmap on
|
By default, the only pixmap that is set is the BackgroundPixmap on
|
||||||
\macos.
|
\macos version 10.13 and earlier.
|
||||||
|
|
||||||
\sa QWizardPage::pixmap(), {Elements of a Wizard Page}
|
\sa QWizardPage::pixmap(), {Elements of a Wizard Page}
|
||||||
*/
|
*/
|
||||||
|
@ -145,8 +145,8 @@ dialog.exec();
|
|||||||
"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
|
"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
|
||||||
//! [14]
|
//! [14]
|
||||||
|
|
||||||
//! [14]
|
//! [15]
|
||||||
auto fileOpenCompleted = [](const QSting &fileName, const QByteArray &fileContent) {
|
auto fileOpenCompleted = [](const QString &fileName, const QByteArray &fileContent) {
|
||||||
if (fileName.isEmpty()) {
|
if (fileName.isEmpty()) {
|
||||||
// No file was selected
|
// No file was selected
|
||||||
} else {
|
} else {
|
||||||
@ -154,4 +154,4 @@ auto fileOpenCompleted = [](const QSting &fileName, const QByteArray &fileConten
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QFileDialog::getOpenFileContent("Images (*.png *.xpm *.jpg)", fileContentReady);
|
QFileDialog::getOpenFileContent("Images (*.png *.xpm *.jpg)", fileContentReady);
|
||||||
//! [14]
|
//! [15]
|
||||||
|
@ -76,6 +76,11 @@ extern QRegion qt_dirtyRegion(QWidget *);
|
|||||||
Q_GLOBAL_STATIC(QPlatformTextureList, qt_dummy_platformTextureList)
|
Q_GLOBAL_STATIC(QPlatformTextureList, qt_dummy_platformTextureList)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static bool hasPlatformWindow(QWidget *widget)
|
||||||
|
{
|
||||||
|
return widget && widget->windowHandle() && widget->windowHandle()->handle();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flushes the contents of the \a backingStore into the screen area of \a widget.
|
* Flushes the contents of the \a backingStore into the screen area of \a widget.
|
||||||
* \a region is the region to be updated in \a widget coordinates.
|
* \a region is the region to be updated in \a widget coordinates.
|
||||||
@ -198,7 +203,7 @@ void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePa
|
|||||||
QRegion paintRegion = toBePainted;
|
QRegion paintRegion = toBePainted;
|
||||||
QRect widgetRect = widget->rect();
|
QRect widgetRect = widget->rect();
|
||||||
|
|
||||||
if (!widget->internalWinId()) {
|
if (!hasPlatformWindow(widget)) {
|
||||||
QWidget *nativeParent = widget->nativeParentWidget();
|
QWidget *nativeParent = widget->nativeParentWidget();
|
||||||
const QPoint offset = widget->mapTo(nativeParent, QPoint(0, 0));
|
const QPoint offset = widget->mapTo(nativeParent, QPoint(0, 0));
|
||||||
paintRegion.translate(offset);
|
paintRegion.translate(offset);
|
||||||
@ -648,7 +653,7 @@ void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widg
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Alien widgets.
|
// Alien widgets.
|
||||||
if (!widget->internalWinId() && !widget->isWindow()) {
|
if (!hasPlatformWindow(widget) && !widget->isWindow()) {
|
||||||
QWidget *nativeParent = widget->nativeParentWidget(); // Alien widgets with the top-level as the native parent (common case).
|
QWidget *nativeParent = widget->nativeParentWidget(); // Alien widgets with the top-level as the native parent (common case).
|
||||||
if (nativeParent == tlw) {
|
if (nativeParent == tlw) {
|
||||||
if (!widget->testAttribute(Qt::WA_WState_InPaintEvent))
|
if (!widget->testAttribute(Qt::WA_WState_InPaintEvent))
|
||||||
@ -778,7 +783,7 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy)
|
|||||||
destRect = destRect.translated(dx, dy).intersected(clipR);
|
destRect = destRect.translated(dx, dy).intersected(clipR);
|
||||||
const QRect sourceRect(destRect.translated(-dx, -dy));
|
const QRect sourceRect(destRect.translated(-dx, -dy));
|
||||||
const QRect parentRect(rect & clipR);
|
const QRect parentRect(rect & clipR);
|
||||||
const bool nativeWithTextureChild = textureChildSeen && q->internalWinId();
|
const bool nativeWithTextureChild = textureChildSeen && hasPlatformWindow(q);
|
||||||
|
|
||||||
const bool accelerateMove = accelEnv && isOpaque && !nativeWithTextureChild
|
const bool accelerateMove = accelEnv && isOpaque && !nativeWithTextureChild
|
||||||
#if QT_CONFIG(graphicsview)
|
#if QT_CONFIG(graphicsview)
|
||||||
@ -946,9 +951,9 @@ static void findTextureWidgetsRecursively(QWidget *tlw, QWidget *widget, QPlatfo
|
|||||||
for (int i = 0; i < wd->children.size(); ++i) {
|
for (int i = 0; i < wd->children.size(); ++i) {
|
||||||
QWidget *w = qobject_cast<QWidget *>(wd->children.at(i));
|
QWidget *w = qobject_cast<QWidget *>(wd->children.at(i));
|
||||||
// Stop at native widgets but store them. Stop at hidden widgets too.
|
// Stop at native widgets but store them. Stop at hidden widgets too.
|
||||||
if (w && !w->isWindow() && w->internalWinId())
|
if (w && !w->isWindow() && hasPlatformWindow(w))
|
||||||
nativeChildren->append(w);
|
nativeChildren->append(w);
|
||||||
if (w && !w->isWindow() && !w->internalWinId() && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen)
|
if (w && !w->isWindow() && !hasPlatformWindow(w) && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen)
|
||||||
findTextureWidgetsRecursively(tlw, w, widgetTextures, nativeChildren);
|
findTextureWidgetsRecursively(tlw, w, widgetTextures, nativeChildren);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -979,7 +984,7 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
|
|||||||
Q_ASSERT(!tl->isEmpty());
|
Q_ASSERT(!tl->isEmpty());
|
||||||
for (int i = 0; i < tl->count(); ++i) {
|
for (int i = 0; i < tl->count(); ++i) {
|
||||||
QWidget *w = static_cast<QWidget *>(tl->source(i));
|
QWidget *w = static_cast<QWidget *>(tl->source(i));
|
||||||
if ((w->internalWinId() && w == widget) || (!w->internalWinId() && w->nativeParentWidget() == widget))
|
if ((hasPlatformWindow(w) && w == widget) || (!hasPlatformWindow(w) && w->nativeParentWidget() == widget))
|
||||||
return tl;
|
return tl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1090,7 +1095,8 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg
|
|||||||
if (!tlw->isVisible() || !tlwExtra || tlwExtra->inTopLevelResize)
|
if (!tlw->isVisible() || !tlwExtra || tlwExtra->inTopLevelResize)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!exposedWidget || !exposedWidget->internalWinId() || !exposedWidget->isVisible() || !exposedWidget->testAttribute(Qt::WA_Mapped)
|
if (!exposedWidget || !hasPlatformWindow(exposedWidget)
|
||||||
|
|| !exposedWidget->isVisible() || !exposedWidget->testAttribute(Qt::WA_Mapped)
|
||||||
|| !exposedWidget->updatesEnabled() || exposedRegion.isEmpty()) {
|
|| !exposedWidget->updatesEnabled() || exposedRegion.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1263,8 +1269,8 @@ void QWidgetBackingStore::doSync()
|
|||||||
w->d_func()->sendPaintEvent(w->rect());
|
w->d_func()->sendPaintEvent(w->rect());
|
||||||
if (w != tlw) {
|
if (w != tlw) {
|
||||||
QWidget *npw = w->nativeParentWidget();
|
QWidget *npw = w->nativeParentWidget();
|
||||||
if (w->internalWinId() || (npw && npw != tlw)) {
|
if (hasPlatformWindow(w) || (npw && npw != tlw)) {
|
||||||
if (!w->internalWinId())
|
if (!hasPlatformWindow(w))
|
||||||
w = npw;
|
w = npw;
|
||||||
QWidgetPrivate *wPrivate = w->d_func();
|
QWidgetPrivate *wPrivate = w->d_func();
|
||||||
if (!wPrivate->needsFlush)
|
if (!wPrivate->needsFlush)
|
||||||
|
@ -118,7 +118,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionFocusRect();
|
QStyleOptionFocusRect();
|
||||||
QStyleOptionFocusRect(const QStyleOptionFocusRect &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionFocusRect(const QStyleOptionFocusRect &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionFocusRect &operator=(const QStyleOptionFocusRect &other) = default;
|
QStyleOptionFocusRect &operator=(const QStyleOptionFocusRect &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionFocusRect(int version);
|
QStyleOptionFocusRect(int version);
|
||||||
@ -143,7 +143,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionFrame();
|
QStyleOptionFrame();
|
||||||
QStyleOptionFrame(const QStyleOptionFrame &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionFrame(const QStyleOptionFrame &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionFrame &operator=(const QStyleOptionFrame &other) = default;
|
QStyleOptionFrame &operator=(const QStyleOptionFrame &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionFrame(int version);
|
QStyleOptionFrame(int version);
|
||||||
@ -173,7 +173,7 @@ public:
|
|||||||
QStyleOptionTabWidgetFrame();
|
QStyleOptionTabWidgetFrame();
|
||||||
inline QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other)
|
inline QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other)
|
||||||
: QStyleOption(Version, Type) { *this = other; }
|
: QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionTabWidgetFrame &operator=(const QStyleOptionTabWidgetFrame &other) = default;
|
QStyleOptionTabWidgetFrame &operator=(const QStyleOptionTabWidgetFrame &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionTabWidgetFrame(int version);
|
QStyleOptionTabWidgetFrame(int version);
|
||||||
@ -197,7 +197,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionTabBarBase();
|
QStyleOptionTabBarBase();
|
||||||
QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionTabBarBase &operator=(const QStyleOptionTabBarBase &other) = default;
|
QStyleOptionTabBarBase &operator=(const QStyleOptionTabBarBase &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionTabBarBase(int version);
|
QStyleOptionTabBarBase(int version);
|
||||||
@ -229,7 +229,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionHeader();
|
QStyleOptionHeader();
|
||||||
QStyleOptionHeader(const QStyleOptionHeader &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionHeader(const QStyleOptionHeader &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionHeader &operator=(const QStyleOptionHeader &other) = default;
|
QStyleOptionHeader &operator=(const QStyleOptionHeader &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionHeader(int version);
|
QStyleOptionHeader(int version);
|
||||||
@ -252,7 +252,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionButton();
|
QStyleOptionButton();
|
||||||
QStyleOptionButton(const QStyleOptionButton &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionButton(const QStyleOptionButton &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionButton &operator=(const QStyleOptionButton &other) = default;
|
QStyleOptionButton &operator=(const QStyleOptionButton &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionButton(int version);
|
QStyleOptionButton(int version);
|
||||||
@ -290,7 +290,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionTab();
|
QStyleOptionTab();
|
||||||
QStyleOptionTab(const QStyleOptionTab &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionTab(const QStyleOptionTab &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionTab &operator=(const QStyleOptionTab &other) = default;
|
QStyleOptionTab &operator=(const QStyleOptionTab &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionTab(int version);
|
QStyleOptionTab(int version);
|
||||||
@ -321,7 +321,7 @@ public:
|
|||||||
int midLineWidth;
|
int midLineWidth;
|
||||||
QStyleOptionToolBar();
|
QStyleOptionToolBar();
|
||||||
QStyleOptionToolBar(const QStyleOptionToolBar &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionToolBar(const QStyleOptionToolBar &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionToolBar &operator=(const QStyleOptionToolBar &other) = default;
|
QStyleOptionToolBar &operator=(const QStyleOptionToolBar &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionToolBar(int version);
|
QStyleOptionToolBar(int version);
|
||||||
@ -349,7 +349,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionProgressBar();
|
QStyleOptionProgressBar();
|
||||||
QStyleOptionProgressBar(const QStyleOptionProgressBar &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionProgressBar(const QStyleOptionProgressBar &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionProgressBar &operator=(const QStyleOptionProgressBar &other) = default;
|
QStyleOptionProgressBar &operator=(const QStyleOptionProgressBar &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionProgressBar(int version);
|
QStyleOptionProgressBar(int version);
|
||||||
@ -380,7 +380,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionMenuItem();
|
QStyleOptionMenuItem();
|
||||||
QStyleOptionMenuItem(const QStyleOptionMenuItem &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionMenuItem(const QStyleOptionMenuItem &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionMenuItem &operator=(const QStyleOptionMenuItem &other) = default;
|
QStyleOptionMenuItem &operator=(const QStyleOptionMenuItem &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionMenuItem(int version);
|
QStyleOptionMenuItem(int version);
|
||||||
@ -400,7 +400,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionDockWidget();
|
QStyleOptionDockWidget();
|
||||||
QStyleOptionDockWidget(const QStyleOptionDockWidget &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionDockWidget(const QStyleOptionDockWidget &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionDockWidget &operator=(const QStyleOptionDockWidget &other) = default;
|
QStyleOptionDockWidget &operator=(const QStyleOptionDockWidget &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionDockWidget(int version);
|
QStyleOptionDockWidget(int version);
|
||||||
@ -452,7 +452,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionViewItem();
|
QStyleOptionViewItem();
|
||||||
QStyleOptionViewItem(const QStyleOptionViewItem &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionViewItem(const QStyleOptionViewItem &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionViewItem &operator=(const QStyleOptionViewItem &other) = default;
|
QStyleOptionViewItem &operator=(const QStyleOptionViewItem &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionViewItem(int version);
|
QStyleOptionViewItem(int version);
|
||||||
@ -483,7 +483,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionToolBox();
|
QStyleOptionToolBox();
|
||||||
QStyleOptionToolBox(const QStyleOptionToolBox &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionToolBox(const QStyleOptionToolBox &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionToolBox &operator=(const QStyleOptionToolBox &other) = default;
|
QStyleOptionToolBox &operator=(const QStyleOptionToolBox &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionToolBox(int version);
|
QStyleOptionToolBox(int version);
|
||||||
@ -503,7 +503,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionRubberBand();
|
QStyleOptionRubberBand();
|
||||||
QStyleOptionRubberBand(const QStyleOptionRubberBand &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionRubberBand(const QStyleOptionRubberBand &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionRubberBand &operator=(const QStyleOptionRubberBand &other) = default;
|
QStyleOptionRubberBand &operator=(const QStyleOptionRubberBand &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionRubberBand(int version);
|
QStyleOptionRubberBand(int version);
|
||||||
@ -522,7 +522,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionComplex(int version = QStyleOptionComplex::Version, int type = SO_Complex);
|
QStyleOptionComplex(int version = QStyleOptionComplex::Version, int type = SO_Complex);
|
||||||
QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionComplex &operator=(const QStyleOptionComplex &other) = default;
|
QStyleOptionComplex &operator=(const QStyleOptionComplex &) = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if QT_CONFIG(slider)
|
#if QT_CONFIG(slider)
|
||||||
@ -547,7 +547,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionSlider();
|
QStyleOptionSlider();
|
||||||
QStyleOptionSlider(const QStyleOptionSlider &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
QStyleOptionSlider(const QStyleOptionSlider &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
||||||
QStyleOptionSlider &operator=(const QStyleOptionSlider &other) = default;
|
QStyleOptionSlider &operator=(const QStyleOptionSlider &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionSlider(int version);
|
QStyleOptionSlider(int version);
|
||||||
@ -567,7 +567,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionSpinBox();
|
QStyleOptionSpinBox();
|
||||||
QStyleOptionSpinBox(const QStyleOptionSpinBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
QStyleOptionSpinBox(const QStyleOptionSpinBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
||||||
QStyleOptionSpinBox &operator=(const QStyleOptionSpinBox &other) = default;
|
QStyleOptionSpinBox &operator=(const QStyleOptionSpinBox &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionSpinBox(int version);
|
QStyleOptionSpinBox(int version);
|
||||||
@ -595,7 +595,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionToolButton();
|
QStyleOptionToolButton();
|
||||||
QStyleOptionToolButton(const QStyleOptionToolButton &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
QStyleOptionToolButton(const QStyleOptionToolButton &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
||||||
QStyleOptionToolButton &operator=(const QStyleOptionToolButton &other) = default;
|
QStyleOptionToolButton &operator=(const QStyleOptionToolButton &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionToolButton(int version);
|
QStyleOptionToolButton(int version);
|
||||||
@ -618,7 +618,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionComboBox();
|
QStyleOptionComboBox();
|
||||||
QStyleOptionComboBox(const QStyleOptionComboBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
QStyleOptionComboBox(const QStyleOptionComboBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
||||||
QStyleOptionComboBox &operator=(const QStyleOptionComboBox &other) = default;
|
QStyleOptionComboBox &operator=(const QStyleOptionComboBox &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionComboBox(int version);
|
QStyleOptionComboBox(int version);
|
||||||
@ -637,7 +637,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionTitleBar();
|
QStyleOptionTitleBar();
|
||||||
QStyleOptionTitleBar(const QStyleOptionTitleBar &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
QStyleOptionTitleBar(const QStyleOptionTitleBar &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
||||||
QStyleOptionTitleBar &operator=(const QStyleOptionTitleBar &other) = default;
|
QStyleOptionTitleBar &operator=(const QStyleOptionTitleBar &) = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionTitleBar(int version);
|
QStyleOptionTitleBar(int version);
|
||||||
@ -658,7 +658,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionGroupBox();
|
QStyleOptionGroupBox();
|
||||||
QStyleOptionGroupBox(const QStyleOptionGroupBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
QStyleOptionGroupBox(const QStyleOptionGroupBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
||||||
QStyleOptionGroupBox &operator=(const QStyleOptionGroupBox &other) = default;
|
QStyleOptionGroupBox &operator=(const QStyleOptionGroupBox &) = default;
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionGroupBox(int version);
|
QStyleOptionGroupBox(int version);
|
||||||
};
|
};
|
||||||
@ -673,7 +673,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionSizeGrip();
|
QStyleOptionSizeGrip();
|
||||||
QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other) : QStyleOptionComplex(Version, Type) { *this = other; }
|
||||||
QStyleOptionSizeGrip &operator=(const QStyleOptionSizeGrip &other) = default;
|
QStyleOptionSizeGrip &operator=(const QStyleOptionSizeGrip &) = default;
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionSizeGrip(int version);
|
QStyleOptionSizeGrip(int version);
|
||||||
};
|
};
|
||||||
@ -690,7 +690,7 @@ public:
|
|||||||
|
|
||||||
QStyleOptionGraphicsItem();
|
QStyleOptionGraphicsItem();
|
||||||
QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
QStyleOptionGraphicsItem &operator=(const QStyleOptionGraphicsItem &other) = default;
|
QStyleOptionGraphicsItem &operator=(const QStyleOptionGraphicsItem &) = default;
|
||||||
static qreal levelOfDetailFromTransform(const QTransform &worldTransform);
|
static qreal levelOfDetailFromTransform(const QTransform &worldTransform);
|
||||||
protected:
|
protected:
|
||||||
QStyleOptionGraphicsItem(int version);
|
QStyleOptionGraphicsItem(int version);
|
||||||
|
@ -84,6 +84,8 @@ private slots:
|
|||||||
void operator_noteq();
|
void operator_noteq();
|
||||||
|
|
||||||
void resize();
|
void resize();
|
||||||
|
void fromBits_data();
|
||||||
|
void fromBits();
|
||||||
};
|
};
|
||||||
|
|
||||||
void tst_QBitArray::size_data()
|
void tst_QBitArray::size_data()
|
||||||
@ -610,5 +612,60 @@ void tst_QBitArray::resize()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QBitArray::fromBits_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<QByteArray>("data");
|
||||||
|
QTest::addColumn<int>("size");
|
||||||
|
QTest::addColumn<QBitArray>("expected");
|
||||||
|
|
||||||
|
QTest::newRow("empty") << QByteArray() << 0 << QBitArray();
|
||||||
|
|
||||||
|
auto add = [](const QByteArray &tag, const char *data) {
|
||||||
|
QTest::newRow(tag) << QByteArray(data, (tag.size() + 7) / 8) << tag.size()
|
||||||
|
<< QStringToQBitArray(tag);
|
||||||
|
};
|
||||||
|
|
||||||
|
// "0" to "0000000000000000"
|
||||||
|
for (int i = 1; i < 16; ++i) {
|
||||||
|
char zero[2] = { 0, 0 };
|
||||||
|
QByteArray pattern(i, '0');
|
||||||
|
add(pattern, zero);
|
||||||
|
}
|
||||||
|
|
||||||
|
// "1" to "1111111111111111"
|
||||||
|
for (int i = 1; i < 16; ++i) {
|
||||||
|
char one[2] = { '\xff', '\xff' };
|
||||||
|
QByteArray pattern(i, '1');
|
||||||
|
add(pattern, one);
|
||||||
|
}
|
||||||
|
|
||||||
|
// trailing 0 and 1
|
||||||
|
char zero = 1;
|
||||||
|
char one = 0;
|
||||||
|
QByteArray pzero = "1";
|
||||||
|
QByteArray pone = "0";
|
||||||
|
for (int i = 2; i < 8; ++i) {
|
||||||
|
zero <<= 1;
|
||||||
|
pzero.prepend('0');
|
||||||
|
add(pzero, &zero);
|
||||||
|
|
||||||
|
one = (one << 1) | 1;
|
||||||
|
pone.prepend('1');
|
||||||
|
add(pone, &one);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QBitArray::fromBits()
|
||||||
|
{
|
||||||
|
QFETCH(QByteArray, data);
|
||||||
|
QFETCH(int, size);
|
||||||
|
QFETCH(QBitArray, expected);
|
||||||
|
|
||||||
|
QBitArray fromBits = QBitArray::fromBits(data, size);
|
||||||
|
QCOMPARE(fromBits, expected);
|
||||||
|
|
||||||
|
QCOMPARE(QBitArray::fromBits(fromBits.bits(), fromBits.size()), expected);
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_APPLESS_MAIN(tst_QBitArray)
|
QTEST_APPLESS_MAIN(tst_QBitArray)
|
||||||
#include "tst_qbitarray.moc"
|
#include "tst_qbitarray.moc"
|
||||||
|
@ -11,6 +11,7 @@ SUBDIRS=\
|
|||||||
qguimetatype \
|
qguimetatype \
|
||||||
qguitimer \
|
qguitimer \
|
||||||
qguivariant \
|
qguivariant \
|
||||||
|
qhighdpiscaling \
|
||||||
qinputmethod \
|
qinputmethod \
|
||||||
qkeyevent \
|
qkeyevent \
|
||||||
qkeysequence \
|
qkeysequence \
|
||||||
@ -35,6 +36,8 @@ win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
|
|||||||
!qtHaveModule(network): SUBDIRS -= \
|
!qtHaveModule(network): SUBDIRS -= \
|
||||||
qguieventloop
|
qguieventloop
|
||||||
|
|
||||||
|
!qtConfig(highdpiscaling): SUBDIRS -= qhighdpiscaling
|
||||||
|
|
||||||
!qtConfig(opengl): SUBDIRS -= qopenglwindow
|
!qtConfig(opengl): SUBDIRS -= qopenglwindow
|
||||||
|
|
||||||
android|uikit: SUBDIRS -= qclipboard
|
android|uikit: SUBDIRS -= qclipboard
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
CONFIG += testcase
|
||||||
|
TARGET = tst_qhighdpiscaling
|
||||||
|
|
||||||
|
QT += core-private gui-private testlib
|
||||||
|
|
||||||
|
SOURCES += tst_qhighdpiscaling.cpp
|
@ -0,0 +1,95 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2019 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
||||||
|
** 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 General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** 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-3.0.html.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <private/qhighdpiscaling_p.h>
|
||||||
|
#include <qpa/qplatformscreen.h>
|
||||||
|
|
||||||
|
#include <QtTest/QtTest>
|
||||||
|
|
||||||
|
class tst_QHighDpiScaling: public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void factor();
|
||||||
|
void scale();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Emulate the case of a High DPI secondary screen
|
||||||
|
class MyPlatformScreen : public QPlatformScreen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QRect geometry() const override { return QRect(3840, 0, 3840, 1920); }
|
||||||
|
QRect availableGeometry() const override { return geometry(); }
|
||||||
|
|
||||||
|
int depth() const override { return 32; }
|
||||||
|
QImage::Format format() const override { return QImage::Format_ARGB32_Premultiplied; }
|
||||||
|
};
|
||||||
|
|
||||||
|
void tst_QHighDpiScaling::factor()
|
||||||
|
{
|
||||||
|
QHighDpiScaling::setGlobalFactor(2);
|
||||||
|
|
||||||
|
// Verfy that QHighDpiScaling::factor() does not crash on nullptr contexts.
|
||||||
|
QPoint fakeNativePosition = QPoint(5, 5);
|
||||||
|
QPlatformScreen *screenContext = nullptr;
|
||||||
|
QVERIFY(QHighDpiScaling::factor(screenContext) >= 0);
|
||||||
|
QVERIFY(QHighDpiScaling::factor(screenContext, &fakeNativePosition) >= 0);
|
||||||
|
QPlatformScreen *platformScreenContext = nullptr;
|
||||||
|
QVERIFY(QHighDpiScaling::factor(platformScreenContext) >= 0);
|
||||||
|
QVERIFY(QHighDpiScaling::factor(platformScreenContext, &fakeNativePosition) >= 0);
|
||||||
|
QWindow *windowContext = nullptr;
|
||||||
|
QVERIFY(QHighDpiScaling::factor(windowContext) >= 0);
|
||||||
|
QVERIFY(QHighDpiScaling::factor(windowContext, &fakeNativePosition) >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// QTBUG-77255: Test some scaling overloads
|
||||||
|
void tst_QHighDpiScaling::scale()
|
||||||
|
{
|
||||||
|
QHighDpiScaling::setGlobalFactor(2);
|
||||||
|
QScopedPointer<QPlatformScreen> screen(new MyPlatformScreen);
|
||||||
|
|
||||||
|
qreal nativeValue = 10;
|
||||||
|
const qreal value = QHighDpi::fromNativePixels(nativeValue, screen.data());
|
||||||
|
QCOMPARE(value, qreal(5));
|
||||||
|
QCOMPARE(QHighDpi::toNativePixels(value, screen.data()), nativeValue);
|
||||||
|
|
||||||
|
// 10, 10 within screen should translate to 5,5 with origin preserved
|
||||||
|
const QPoint nativePoint = screen->geometry().topLeft() + QPoint(10, 10);
|
||||||
|
const QPoint point = QHighDpi::fromNativePixels(nativePoint, screen.data());
|
||||||
|
QCOMPARE(point, QPoint(3845, 5));
|
||||||
|
QCOMPARE(QHighDpi::toNativePixels(point, screen.data()), nativePoint);
|
||||||
|
|
||||||
|
const QPointF nativePointF(nativePoint);
|
||||||
|
const QPointF pointF = QHighDpi::fromNativePixels(nativePointF, screen.data());
|
||||||
|
QCOMPARE(pointF, QPointF(3845, 5));
|
||||||
|
QCOMPARE(QHighDpi::toNativePixels(pointF, screen.data()), nativePointF);
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "tst_qhighdpiscaling.moc"
|
||||||
|
QTEST_MAIN(tst_QHighDpiScaling);
|
2
tests/auto/gui/painting/qpainterpath/BLACKLIST
Normal file
2
tests/auto/gui/painting/qpainterpath/BLACKLIST
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[contains_QPointF]
|
||||||
|
msvc-2019
|
@ -191,6 +191,7 @@ private slots:
|
|||||||
|
|
||||||
void fontTagFace();
|
void fontTagFace();
|
||||||
|
|
||||||
|
void clearUndoRedoStacks();
|
||||||
private:
|
private:
|
||||||
void backgroundImage_checkExpectedHtml(const QTextDocument &doc);
|
void backgroundImage_checkExpectedHtml(const QTextDocument &doc);
|
||||||
void buildRegExpData();
|
void buildRegExpData();
|
||||||
@ -3522,5 +3523,16 @@ void tst_QTextDocument::fontTagFace()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QTextDocument::clearUndoRedoStacks()
|
||||||
|
{
|
||||||
|
QTextDocument doc;
|
||||||
|
QTextCursor c(&doc);
|
||||||
|
c.insertText(QStringLiteral("lorem ipsum"));
|
||||||
|
QVERIFY(doc.isUndoAvailable());
|
||||||
|
doc.clearUndoRedoStacks(QTextDocument::UndoStack); // Don't crash
|
||||||
|
QVERIFY(!doc.isUndoAvailable());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QTEST_MAIN(tst_QTextDocument)
|
QTEST_MAIN(tst_QTextDocument)
|
||||||
#include "tst_qtextdocument.moc"
|
#include "tst_qtextdocument.moc"
|
||||||
|
@ -592,6 +592,19 @@ void tst_Http2::connectToHost()
|
|||||||
|
|
||||||
#if QT_CONFIG(ssl)
|
#if QT_CONFIG(ssl)
|
||||||
Q_ASSERT(!clearTextHTTP2 || connectionType != H2Type::h2Alpn);
|
Q_ASSERT(!clearTextHTTP2 || connectionType != H2Type::h2Alpn);
|
||||||
|
|
||||||
|
#if QT_CONFIG(securetransport)
|
||||||
|
// Normally on macOS we use plain text only for SecureTransport
|
||||||
|
// does not support ALPN on the server side. With 'direct encrytped'
|
||||||
|
// we have to use TLS sockets (== private key) and thus suppress a
|
||||||
|
// keychain UI asking for permission to use a private key.
|
||||||
|
// Our CI has this, but somebody testing locally - will have a problem.
|
||||||
|
qputenv("QT_SSL_USE_TEMPORARY_KEYCHAIN", QByteArray("1"));
|
||||||
|
auto envRollback = qScopeGuard([](){
|
||||||
|
qunsetenv("QT_SSL_USE_TEMPORARY_KEYCHAIN");
|
||||||
|
});
|
||||||
|
#endif // QT_CONFIG(securetransport)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
Q_ASSERT(connectionType == H2Type::h2c || connectionType == H2Type::h2cDirect);
|
Q_ASSERT(connectionType == H2Type::h2c || connectionType == H2Type::h2cDirect);
|
||||||
Q_ASSERT(targetServer->isClearText());
|
Q_ASSERT(targetServer->isClearText());
|
||||||
@ -636,9 +649,6 @@ void tst_Http2::connectToHost()
|
|||||||
eventLoop.exitLoop();
|
eventLoop.exitLoop();
|
||||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||||
QVERIFY(reply->isFinished());
|
QVERIFY(reply->isFinished());
|
||||||
// Nothing must be sent yet:
|
|
||||||
QVERIFY(!prefaceOK);
|
|
||||||
QVERIFY(!serverGotSettingsACK);
|
|
||||||
// Nothing received back:
|
// Nothing received back:
|
||||||
QVERIFY(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull());
|
QVERIFY(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull());
|
||||||
QCOMPARE(reply->readAll().size(), 0);
|
QCOMPARE(reply->readAll().size(), 0);
|
||||||
|
@ -417,20 +417,19 @@ void tst_QWizard::setPixmap()
|
|||||||
QVERIFY(wizard.pixmap(QWizard::BannerPixmap).isNull());
|
QVERIFY(wizard.pixmap(QWizard::BannerPixmap).isNull());
|
||||||
QVERIFY(wizard.pixmap(QWizard::LogoPixmap).isNull());
|
QVERIFY(wizard.pixmap(QWizard::LogoPixmap).isNull());
|
||||||
QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).isNull());
|
QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).isNull());
|
||||||
#ifdef Q_OS_OSX
|
if (QSysInfo::macVersion() <= Q_MV_OSX(10, 13))
|
||||||
QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull());
|
QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull());
|
||||||
#else
|
else
|
||||||
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull());
|
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull());
|
||||||
#endif
|
|
||||||
|
|
||||||
QVERIFY(page->pixmap(QWizard::BannerPixmap).isNull());
|
QVERIFY(page->pixmap(QWizard::BannerPixmap).isNull());
|
||||||
QVERIFY(page->pixmap(QWizard::LogoPixmap).isNull());
|
QVERIFY(page->pixmap(QWizard::LogoPixmap).isNull());
|
||||||
QVERIFY(page->pixmap(QWizard::WatermarkPixmap).isNull());
|
QVERIFY(page->pixmap(QWizard::WatermarkPixmap).isNull());
|
||||||
#ifdef Q_OS_OSX
|
if (QSysInfo::macVersion() <= Q_MV_OSX(10, 13))
|
||||||
QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull());
|
QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull());
|
||||||
#else
|
else
|
||||||
QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull());
|
QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull());
|
||||||
#endif
|
|
||||||
wizard.setPixmap(QWizard::BannerPixmap, p1);
|
wizard.setPixmap(QWizard::BannerPixmap, p1);
|
||||||
wizard.setPixmap(QWizard::LogoPixmap, p2);
|
wizard.setPixmap(QWizard::LogoPixmap, p2);
|
||||||
wizard.setPixmap(QWizard::WatermarkPixmap, p3);
|
wizard.setPixmap(QWizard::WatermarkPixmap, p3);
|
||||||
|
@ -88,7 +88,7 @@ static void sendMousePress(QWidget *widget, const QPoint &point, Qt::MouseButton
|
|||||||
static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = 0)
|
static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = 0)
|
||||||
{
|
{
|
||||||
QTest::mouseMove(widget, point);
|
QTest::mouseMove(widget, point);
|
||||||
QMouseEvent event(QEvent::MouseMove, point, button, buttons, 0);
|
QMouseEvent event(QEvent::MouseMove, point, widget->mapToGlobal(point), button, buttons, 0);
|
||||||
QApplication::sendEvent(widget, &event);
|
QApplication::sendEvent(widget, &event);
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
@ -491,7 +491,7 @@ void tst_QApplication::lastWindowClosed()
|
|||||||
QPointer<QDialog> dialog = new QDialog;
|
QPointer<QDialog> dialog = new QDialog;
|
||||||
dialog->setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1String("Dialog"));
|
dialog->setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1String("Dialog"));
|
||||||
QVERIFY(dialog->testAttribute(Qt::WA_QuitOnClose));
|
QVERIFY(dialog->testAttribute(Qt::WA_QuitOnClose));
|
||||||
QTimer::singleShot(1000, dialog, &QDialog::accept);
|
QTimer::singleShot(1000, dialog.data(), &QDialog::accept);
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
QVERIFY(dialog);
|
QVERIFY(dialog);
|
||||||
QCOMPARE(spy.count(), 0);
|
QCOMPARE(spy.count(), 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user