Merge remote-tracking branch 'origin/5.12' into dev
Conflicts: src/corelib/serialization/qcborcommon.h src/corelib/tools/qlocale_data_p.h tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: Ibed987f6d77a0294f78f67d78625237616082416
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.6 KiB |
@ -358,10 +358,10 @@ void CompositionRenderer::paint(QPainter *painter)
|
||||
m_blitter.create();
|
||||
|
||||
int new_pbuf_size = m_pbuffer_size;
|
||||
if (size().width() > m_pbuffer_size || size().height() > m_pbuffer_size)
|
||||
while (size().width() > new_pbuf_size || size().height() > new_pbuf_size)
|
||||
new_pbuf_size *= 2;
|
||||
|
||||
if (size().width() < m_pbuffer_size/2 && size().height() < m_pbuffer_size/2)
|
||||
while (size().width() < new_pbuf_size/2 && size().height() < new_pbuf_size/2)
|
||||
new_pbuf_size /= 2;
|
||||
|
||||
if (!m_fbo || new_pbuf_size != m_pbuffer_size) {
|
||||
@ -372,6 +372,9 @@ void CompositionRenderer::paint(QPainter *painter)
|
||||
if (size() != m_previous_size) {
|
||||
m_previous_size = size();
|
||||
QPainter p(m_fbo.data());
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
p.fillRect(QRect(QPoint(0, 0), size()), Qt::transparent);
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
||||
drawBase(p);
|
||||
p.end();
|
||||
m_base_tex = m_fbo->takeTexture();
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.2 KiB |
@ -7,7 +7,8 @@ QMAKE_MAC_SDK = macosx
|
||||
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.12
|
||||
QMAKE_APPLE_DEVICE_ARCHS = x86_64
|
||||
QT_MAC_SDK_VERSION_TESTED_WITH = 10.14
|
||||
QT_MAC_SDK_VERSION_MIN = 10.13
|
||||
QT_MAC_SDK_VERSION_MAX = 10.14
|
||||
|
||||
device.sdk = macosx
|
||||
device.target = device
|
||||
|
@ -24,5 +24,9 @@ QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy
|
||||
QMAKE_NM = $${CROSS_COMPILE}nm -P
|
||||
QMAKE_STRIP = $${CROSS_COMPILE}strip
|
||||
|
||||
# modifications to gcc-base.conf
|
||||
QMAKE_AR_LTCG = $${CROSS_COMPILE}gcc-ar cqs
|
||||
QMAKE_NM_LTCG = $${CROSS_COMPILE}gcc-nm -P
|
||||
|
||||
contains(DISTRO_OPTS, deb-multi-arch): \
|
||||
QMAKE_PKG_CONFIG = $${CROSS_COMPILE}pkg-config
|
||||
|
@ -3,25 +3,28 @@ load(default_post)
|
||||
contains(TEMPLATE, .*app) {
|
||||
!macx-xcode {
|
||||
# Detect changes to the platform SDK
|
||||
QMAKE_EXTRA_VARIABLES += QMAKE_MAC_SDK QMAKE_MAC_SDK_VERSION
|
||||
QMAKE_EXTRA_VARIABLES += QMAKE_MAC_SDK QMAKE_MAC_SDK_VERSION QMAKE_XCODE_DEVELOPER_PATH
|
||||
QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/sdk.mk)
|
||||
}
|
||||
|
||||
# Detect incompatible SDK versions
|
||||
|
||||
!versionAtLeast(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION): \
|
||||
warning("Qt requires at least version $$QT_MAC_SDK_VERSION of the platform SDK," \
|
||||
isEmpty(QT_MAC_SDK_VERSION_MIN): \
|
||||
QT_MAC_SDK_VERSION_MIN = $$QT_MAC_SDK_VERSION
|
||||
|
||||
!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," \
|
||||
"you're using $${QMAKE_MAC_SDK_VERSION}. Please upgrade.")
|
||||
|
||||
!isEmpty(QT_MAC_SDK_VERSION_TESTED_WITH) {
|
||||
!isEmpty(QT_MAC_SDK_VERSION_MAX) {
|
||||
# For Qt developers only
|
||||
!isEmpty($$list($$(QT_MAC_SDK_NO_VERSION_CHECK))): \
|
||||
CONFIG += sdk_no_version_check
|
||||
|
||||
QMAKE_MAC_SDK_MAJOR_MINOR_VERSION = $$replace(QMAKE_MAC_SDK_VERSION, "(\d+)(\.\d+)(\.\d+)?", \1\2)
|
||||
|
||||
!sdk_no_version_check:!versionAtMost(QMAKE_MAC_SDK_MAJOR_MINOR_VERSION, $$QT_MAC_SDK_VERSION_TESTED_WITH) {
|
||||
warning("Qt has only been tested with version $$QT_MAC_SDK_VERSION_TESTED_WITH"\
|
||||
!sdk_no_version_check:!versionAtMost(QMAKE_MAC_SDK_MAJOR_MINOR_VERSION, $$QT_MAC_SDK_VERSION_MAX) {
|
||||
warning("Qt has only been tested with version $$QT_MAC_SDK_VERSION_MAX"\
|
||||
"of the platform SDK, you're using $${QMAKE_MAC_SDK_MAJOR_MINOR_VERSION}.")
|
||||
warning("This is an unsupported configuration. You may experience build issues," \
|
||||
"and by using")
|
||||
@ -29,7 +32,7 @@ contains(TEMPLATE, .*app) {
|
||||
"that Qt has not been prepared for.")
|
||||
|
||||
warning("Please downgrade the SDK you use to build your app to version" \
|
||||
"$$QT_MAC_SDK_VERSION_TESTED_WITH, or configure")
|
||||
"$$QT_MAC_SDK_VERSION_MAX, or configure")
|
||||
warning("with CONFIG+=sdk_no_version_check when running qmake" \
|
||||
"to silence this warning.")
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
CURRENT_MAC_SDK_VERSION := $(shell /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version)
|
||||
CURRENT_MAC_SDK_VERSION := $(shell DEVELOPER_DIR=$(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version)
|
||||
|
||||
ifneq ($(CURRENT_MAC_SDK_VERSION),$(EXPORT_QMAKE_MAC_SDK_VERSION))
|
||||
$(info The platform SDK has been changed from version $(EXPORT_QMAKE_MAC_SDK_VERSION) to version $(CURRENT_MAC_SDK_VERSION).)
|
||||
|
@ -17,7 +17,7 @@ OBJS = \
|
||||
|
||||
#qt code (please keep in order matching DEPEND_SRC)
|
||||
QOBJS = \
|
||||
qtextcodec.o qutfcodec.o \
|
||||
qutfcodec.o \
|
||||
qendian.o qglobal.o qlogging.o qmalloc.o qnumeric.o qoperatingsystemversion.o qrandom.o \
|
||||
qabstractfileengine.o qbuffer.o qdatastream.o qdebug.o \
|
||||
qdir.o qdiriterator.o \
|
||||
@ -66,7 +66,6 @@ DEPEND_SRC = \
|
||||
$(QMKGENSRC)/win32/msvc_vcxproj.cpp \
|
||||
$(QMKGENSRC)/win32/winmakefile.cpp \
|
||||
$(QMKGENSRC)/xmloutput.cpp \
|
||||
$(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp \
|
||||
$(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \
|
||||
$(SOURCE_PATH)/src/corelib/global/qendian.cpp \
|
||||
$(SOURCE_PATH)/src/corelib/global/qglobal.cpp \
|
||||
@ -341,9 +340,6 @@ qcore_foundation.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm
|
||||
qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
|
||||
$(CXX) -c -o $@ $(CXXFLAGS) $<
|
||||
|
||||
qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp
|
||||
$(CXX) -c -o $@ $(CXXFLAGS) $<
|
||||
|
||||
qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp
|
||||
$(CXX) -c -o $@ $(CXXFLAGS) $<
|
||||
|
||||
|
@ -100,7 +100,6 @@ QTOBJS= \
|
||||
qoperatingsystemversion.obj \
|
||||
qoperatingsystemversion_win.obj \
|
||||
qregexp.obj \
|
||||
qtextcodec.obj \
|
||||
qutfcodec.obj \
|
||||
qstring.obj \
|
||||
qstring_compat.obj \
|
||||
|
@ -3038,6 +3038,7 @@
|
||||
|
||||
\snippet code/doc_src_qmake-manual.pro 59
|
||||
|
||||
\target qmake-cat
|
||||
\section2 cat(filename[, mode])
|
||||
|
||||
Returns the contents of \c filename. You can specify the following options
|
||||
@ -3404,6 +3405,10 @@
|
||||
|
||||
\snippet code/doc_src_qmake-manual.pro 72
|
||||
|
||||
Like \l {qmake-cat}{$$cat()}, the \a mode argument takes \c blob, \c lines,
|
||||
\c true, and \false as value. However, the legacy word splitting rules
|
||||
(i.e. empty or \c true, and \c false) differ subtly.
|
||||
|
||||
If you pass \c stsvar, the command's exit status will be stored in that
|
||||
variable. If the command crashes, the status will be -1, otherwise a
|
||||
non-negative exit code of the command's choosing. Usually, comparing
|
||||
|
@ -208,6 +208,16 @@ struct VcsolutionDepend {
|
||||
QStringList dependencies;
|
||||
};
|
||||
|
||||
/* Disable optimization in getProjectUUID() due to a compiler
|
||||
* bug in MSVC 2015 that causes ASSERT: "&other != this" in the QString
|
||||
* copy constructor for non-empty file names at:
|
||||
* filename.isEmpty()?project->first("QMAKE_MAKEFILE"):filename */
|
||||
|
||||
#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
|
||||
# pragma optimize( "g", off )
|
||||
# pragma warning ( disable : 4748 )
|
||||
#endif
|
||||
|
||||
QUuid VcprojGenerator::getProjectUUID(const QString &filename)
|
||||
{
|
||||
bool validUUID = true;
|
||||
@ -239,6 +249,10 @@ QUuid VcprojGenerator::getProjectUUID(const QString &filename)
|
||||
return uuid;
|
||||
}
|
||||
|
||||
#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
|
||||
# pragma optimize( "g", on )
|
||||
#endif
|
||||
|
||||
QUuid VcprojGenerator::increaseUUID(const QUuid &id)
|
||||
{
|
||||
QUuid result(id);
|
||||
|
@ -35,7 +35,7 @@ using namespace QMakeInternal;
|
||||
#include <qfile.h>
|
||||
#include <qfileinfo.h>
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include <qtextcodec.h>
|
||||
#endif
|
||||
|
||||
@ -49,7 +49,7 @@ QMakeVfs::QMakeVfs()
|
||||
, m_magicExisting(fL1S("existing"))
|
||||
#endif
|
||||
{
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
m_textCodec = 0;
|
||||
#endif
|
||||
ref();
|
||||
@ -236,7 +236,7 @@ QMakeVfs::ReadResult QMakeVfs::readFile(int id, QString *contents, QString *errS
|
||||
return ReadOtherError;
|
||||
}
|
||||
*contents =
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
m_textCodec ? m_textCodec->toUnicode(bcont) :
|
||||
#endif
|
||||
QString::fromLocal8Bit(bcont);
|
||||
@ -290,7 +290,7 @@ void QMakeVfs::invalidateContents()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
void QMakeVfs::setTextCodec(const QTextCodec *textCodec)
|
||||
{
|
||||
m_textCodec = textCodec;
|
||||
|
@ -38,7 +38,7 @@
|
||||
# include <qmutex.h>
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
QT_FORWARD_DECLARE_CLASS(QTextCodec)
|
||||
#endif
|
||||
|
||||
@ -92,7 +92,7 @@ public:
|
||||
void invalidateContents();
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
void setTextCodec(const QTextCodec *textCodec);
|
||||
#endif
|
||||
|
||||
@ -129,7 +129,7 @@ private:
|
||||
QString m_magicMissing;
|
||||
QString m_magicExisting;
|
||||
#endif
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
const QTextCodec *m_textCodec;
|
||||
#endif
|
||||
};
|
||||
|
@ -152,7 +152,6 @@ SOURCES += \
|
||||
qstringlist.cpp \
|
||||
qsystemerror.cpp \
|
||||
qtemporaryfile.cpp \
|
||||
qtextcodec.cpp \
|
||||
qtextstream.cpp \
|
||||
qutfcodec.cpp \
|
||||
quuid.cpp \
|
||||
@ -204,7 +203,6 @@ HEADERS += \
|
||||
qstringmatcher.h \
|
||||
qsystemerror_p.h \
|
||||
qtemporaryfile.h \
|
||||
qtextcodec.h \
|
||||
qtextstream.h \
|
||||
qutfcodec.h \
|
||||
quuid.h \
|
||||
|
@ -17,7 +17,7 @@ repositories {
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -1,62 +1,68 @@
|
||||
# Qt core library codecs module
|
||||
|
||||
HEADERS += \
|
||||
codecs/qlatincodec_p.h \
|
||||
codecs/qsimplecodec_p.h \
|
||||
codecs/qtextcodec_p.h \
|
||||
codecs/qtextcodec.h \
|
||||
codecs/qutfcodec_p.h
|
||||
|
||||
SOURCES += \
|
||||
codecs/qlatincodec.cpp \
|
||||
codecs/qsimplecodec.cpp \
|
||||
codecs/qtextcodec.cpp \
|
||||
codecs/qutfcodec.cpp
|
||||
|
||||
qtConfig(codecs) {
|
||||
qtConfig(textcodec) {
|
||||
HEADERS += \
|
||||
codecs/qisciicodec_p.h \
|
||||
codecs/qtsciicodec_p.h
|
||||
codecs/qlatincodec_p.h \
|
||||
codecs/qsimplecodec_p.h \
|
||||
codecs/qtextcodec.h
|
||||
|
||||
SOURCES += \
|
||||
codecs/qisciicodec.cpp \
|
||||
codecs/qtsciicodec.cpp
|
||||
}
|
||||
codecs/qlatincodec.cpp \
|
||||
codecs/qsimplecodec.cpp \
|
||||
codecs/qtextcodec.cpp
|
||||
|
||||
qtConfig(icu) {
|
||||
HEADERS += \
|
||||
codecs/qicucodec_p.h
|
||||
SOURCES += \
|
||||
codecs/qicucodec.cpp
|
||||
} else {
|
||||
qtConfig(big_codecs) {
|
||||
qtConfig(codecs) {
|
||||
HEADERS += \
|
||||
codecs/qgb18030codec_p.h \
|
||||
codecs/qeucjpcodec_p.h \
|
||||
codecs/qjiscodec_p.h \
|
||||
codecs/qsjiscodec_p.h \
|
||||
codecs/qeuckrcodec_p.h \
|
||||
codecs/qbig5codec_p.h
|
||||
codecs/qisciicodec_p.h \
|
||||
codecs/qtsciicodec_p.h
|
||||
|
||||
SOURCES += \
|
||||
codecs/qgb18030codec.cpp \
|
||||
codecs/qjpunicode.cpp \
|
||||
codecs/qeucjpcodec.cpp \
|
||||
codecs/qjiscodec.cpp \
|
||||
codecs/qsjiscodec.cpp \
|
||||
codecs/qeuckrcodec.cpp \
|
||||
codecs/qbig5codec.cpp
|
||||
codecs/qisciicodec.cpp \
|
||||
codecs/qtsciicodec.cpp
|
||||
}
|
||||
|
||||
qtConfig(iconv) {
|
||||
HEADERS += codecs/qiconvcodec_p.h
|
||||
SOURCES += codecs/qiconvcodec.cpp
|
||||
qtConfig(gnu-libiconv): \
|
||||
QMAKE_USE_PRIVATE += iconv
|
||||
}
|
||||
qtConfig(icu) {
|
||||
HEADERS += \
|
||||
codecs/qicucodec_p.h
|
||||
SOURCES += \
|
||||
codecs/qicucodec.cpp
|
||||
} else {
|
||||
qtConfig(big_codecs) {
|
||||
HEADERS += \
|
||||
codecs/qgb18030codec_p.h \
|
||||
codecs/qeucjpcodec_p.h \
|
||||
codecs/qjiscodec_p.h \
|
||||
codecs/qsjiscodec_p.h \
|
||||
codecs/qeuckrcodec_p.h \
|
||||
codecs/qbig5codec_p.h
|
||||
|
||||
win32 {
|
||||
SOURCES += codecs/qwindowscodec.cpp
|
||||
HEADERS += codecs/qwindowscodec_p.h
|
||||
SOURCES += \
|
||||
codecs/qgb18030codec.cpp \
|
||||
codecs/qjpunicode.cpp \
|
||||
codecs/qeucjpcodec.cpp \
|
||||
codecs/qjiscodec.cpp \
|
||||
codecs/qsjiscodec.cpp \
|
||||
codecs/qeuckrcodec.cpp \
|
||||
codecs/qbig5codec.cpp
|
||||
}
|
||||
|
||||
qtConfig(iconv) {
|
||||
HEADERS += codecs/qiconvcodec_p.h
|
||||
SOURCES += codecs/qiconvcodec.cpp
|
||||
qtConfig(gnu-libiconv): \
|
||||
QMAKE_USE_PRIVATE += iconv
|
||||
}
|
||||
|
||||
win32 {
|
||||
SOURCES += codecs/qwindowscodec.cpp
|
||||
HEADERS += codecs/qwindowscodec_p.h
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,8 +39,6 @@
|
||||
|
||||
#include <QtCore/private/qglobal_p.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(iconv);
|
||||
|
||||
#include "qiconvcodec_p.h"
|
||||
#include "qtextcodec_p.h"
|
||||
#include <qdebug.h>
|
||||
|
@ -39,8 +39,6 @@
|
||||
|
||||
#include "qicucodec_p.h"
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
|
||||
#include "qtextcodec_p.h"
|
||||
#include "qutfcodec_p.h"
|
||||
#include "qlatincodec_p.h"
|
||||
@ -698,5 +696,3 @@ int QIcuCodec::mibEnum() const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
|
@ -59,9 +59,9 @@ extern "C" {
|
||||
typedef struct UConverter UConverter;
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
QT_REQUIRE_CONFIG(textcodec);
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QIcuCodec : public QTextCodec
|
||||
{
|
||||
@ -90,8 +90,6 @@ private:
|
||||
const char *m_name;
|
||||
};
|
||||
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
@ -40,8 +40,6 @@
|
||||
#include "qlatincodec_p.h"
|
||||
#include "qlist.h"
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QLatin1Codec::~QLatin1Codec()
|
||||
@ -238,5 +236,3 @@ int QLatin15Codec::mibEnum() const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
|
@ -54,9 +54,9 @@
|
||||
#include <QtCore/private/qglobal_p.h>
|
||||
#include "QtCore/qtextcodec.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
QT_REQUIRE_CONFIG(textcodec);
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QLatin1Codec : public QTextCodec
|
||||
{
|
||||
@ -86,8 +86,6 @@ public:
|
||||
int mibEnum() const override;
|
||||
};
|
||||
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QLATINCODEC_P_H
|
||||
|
@ -40,8 +40,6 @@
|
||||
#include "qsimplecodec_p.h"
|
||||
#include "qlist.h"
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#define LAST_MIB 2004
|
||||
@ -724,5 +722,3 @@ int QSimpleTextCodec::mibEnum() const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
|
@ -54,9 +54,9 @@
|
||||
#include <QtCore/private/qglobal_p.h>
|
||||
#include "QtCore/qtextcodec.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
QT_REQUIRE_CONFIG(textcodec);
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
template <typename T> class QAtomicPointer;
|
||||
|
||||
@ -79,8 +79,6 @@ private:
|
||||
mutable QAtomicPointer<QByteArray> reverseMap;
|
||||
};
|
||||
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QSIMPLECODEC_P_H
|
||||
|
@ -39,14 +39,14 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qplatformdefs.h"
|
||||
|
||||
#include "qtextcodec.h"
|
||||
#include "qtextcodec_p.h"
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
|
||||
#include "qbytearraymatcher.h"
|
||||
#include "qlist.h"
|
||||
#include "qendian.h"
|
||||
#include "qfile.h"
|
||||
#include "qlist.h"
|
||||
#include "qstringlist.h"
|
||||
#include "qvarlengtharray.h"
|
||||
#if !defined(QT_BOOTSTRAPPED)
|
||||
@ -1164,41 +1164,50 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba)
|
||||
|
||||
Tries to detect the encoding of the provided snippet \a ba by
|
||||
using the BOM (Byte Order Mark) and returns a QTextCodec instance
|
||||
that is capable of decoding the text to unicode. If the codec
|
||||
cannot be detected from the content provided, \a defaultCodec is
|
||||
returned.
|
||||
that is capable of decoding the text to unicode. This function can
|
||||
detect one of the following codecs:
|
||||
|
||||
\list
|
||||
\li UTF-32 Little Endian
|
||||
\li UTF-32 Big Endian
|
||||
\li UTF-16 Little Endian
|
||||
\li UTF-16 Big Endian
|
||||
\li UTF-8
|
||||
\endlist
|
||||
|
||||
If the codec cannot be detected from the content provided, \a defaultCodec
|
||||
is returned.
|
||||
|
||||
\sa codecForHtml()
|
||||
*/
|
||||
QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba, QTextCodec *defaultCodec)
|
||||
{
|
||||
const int arraySize = ba.size();
|
||||
const uchar *buf = reinterpret_cast<const uchar *>(ba.constData());
|
||||
const uint bom = 0xfeff;
|
||||
|
||||
if (arraySize > 3) {
|
||||
if ((uchar)ba[0] == 0x00
|
||||
&& (uchar)ba[1] == 0x00
|
||||
&& (uchar)ba[2] == 0xFE
|
||||
&& (uchar)ba[3] == 0xFF)
|
||||
uint uc = qFromUnaligned<uint>(buf);
|
||||
if (uc == qToBigEndian(bom))
|
||||
return QTextCodec::codecForMib(1018); // utf-32 be
|
||||
else if ((uchar)ba[0] == 0xFF
|
||||
&& (uchar)ba[1] == 0xFE
|
||||
&& (uchar)ba[2] == 0x00
|
||||
&& (uchar)ba[3] == 0x00)
|
||||
else if (uc == qToLittleEndian(bom))
|
||||
return QTextCodec::codecForMib(1019); // utf-32 le
|
||||
}
|
||||
|
||||
if (arraySize < 2)
|
||||
return defaultCodec;
|
||||
if ((uchar)ba[0] == 0xfe && (uchar)ba[1] == 0xff)
|
||||
|
||||
ushort uc = qFromUnaligned<ushort>(buf);
|
||||
if (uc == qToBigEndian(ushort(bom)))
|
||||
return QTextCodec::codecForMib(1013); // utf16 be
|
||||
else if ((uchar)ba[0] == 0xff && (uchar)ba[1] == 0xfe)
|
||||
else if (uc == qToLittleEndian(ushort(bom)))
|
||||
return QTextCodec::codecForMib(1014); // utf16 le
|
||||
|
||||
if (arraySize < 3)
|
||||
return defaultCodec;
|
||||
if ((uchar)ba[0] == 0xef
|
||||
&& (uchar)ba[1] == 0xbb
|
||||
&& (uchar)ba[2] == 0xbf)
|
||||
|
||||
static const char utf8bom[] = "\xef\xbb\xbf";
|
||||
if (memcmp(buf, utf8bom, sizeof(utf8bom) - 1) == 0)
|
||||
return QTextCodec::codecForMib(106); // utf-8
|
||||
|
||||
return defaultCodec;
|
||||
@ -1209,8 +1218,19 @@ QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba, QTextCodec *defaul
|
||||
|
||||
Tries to detect the encoding of the provided snippet \a ba by
|
||||
using the BOM (Byte Order Mark) and returns a QTextCodec instance
|
||||
that is capable of decoding the text to unicode. If the codec
|
||||
cannot be detected, this overload returns a Latin-1 QTextCodec.
|
||||
that is capable of decoding the text to unicode. This function can
|
||||
detect one of the following codecs:
|
||||
|
||||
\list
|
||||
\li UTF-32 Little Endian
|
||||
\li UTF-32 Big Endian
|
||||
\li UTF-16 Little Endian
|
||||
\li UTF-16 Big Endian
|
||||
\li UTF-8
|
||||
\endlist
|
||||
|
||||
If the codec cannot be detected from the content provided, this overload
|
||||
returns a Latin-1 QTextCodec.
|
||||
|
||||
\sa codecForHtml()
|
||||
*/
|
||||
@ -1253,5 +1273,3 @@ bool QTextDecoder::needsMoreData() const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
|
@ -43,11 +43,10 @@
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qlist.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(textcodec);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
|
||||
class QTextCodec;
|
||||
class QIODevice;
|
||||
|
||||
@ -168,8 +167,6 @@ private:
|
||||
QTextCodec::ConverterState state;
|
||||
};
|
||||
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QTEXTCODEC_H
|
||||
|
@ -52,12 +52,13 @@
|
||||
//
|
||||
|
||||
#include <QtCore/private/qglobal_p.h>
|
||||
#include "qtextcodec.h"
|
||||
#include <string.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
|
||||
#include "qtextcodec.h"
|
||||
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) || defined(Q_OS_WASM)
|
||||
#define QT_LOCALE_IS_UTF8
|
||||
@ -82,7 +83,7 @@ struct QTextCodecUnalignedPointer
|
||||
|
||||
bool qTextCodecNameMatch(const char *a, const char *b);
|
||||
|
||||
#else
|
||||
#else // without textcodec:
|
||||
|
||||
class QTextCodec
|
||||
{
|
||||
@ -109,7 +110,7 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
#endif //QT_NO_TEXTCODEC
|
||||
#endif // textcodec
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -70,9 +70,14 @@ static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const
|
||||
{
|
||||
// do sixteen characters at a time
|
||||
for ( ; end - src >= 16; src += 16, dst += 16) {
|
||||
# ifdef __AVX2__
|
||||
__m256i data = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src));
|
||||
__m128i data1 = _mm256_castsi256_si128(data);
|
||||
__m128i data2 = _mm256_extracti128_si256(data, 1);
|
||||
# else
|
||||
__m128i data1 = _mm_loadu_si128((const __m128i*)src);
|
||||
__m128i data2 = _mm_loadu_si128(1+(const __m128i*)src);
|
||||
|
||||
# endif
|
||||
|
||||
// check if everything is ASCII
|
||||
// the highest ASCII value is U+007F
|
||||
@ -967,7 +972,7 @@ QString QUtf32::convertToUnicode(const char *chars, int len, QTextCodec::Convert
|
||||
}
|
||||
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
|
||||
QUtf8Codec::~QUtf8Codec()
|
||||
{
|
||||
@ -1121,6 +1126,6 @@ QList<QByteArray> QUtf32LECodec::aliases() const
|
||||
return list;
|
||||
}
|
||||
|
||||
#endif //QT_NO_TEXTCODEC
|
||||
#endif // textcodec
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -52,7 +52,13 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qlist.h>
|
||||
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include "QtCore/qtextcodec.h"
|
||||
#endif
|
||||
|
||||
#include "private/qtextcodec_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -311,7 +317,7 @@ struct QUtf32
|
||||
static QByteArray convertFromUnicode(const QChar *, int, QTextCodec::ConverterState *, DataEndianness = DetectEndianness);
|
||||
};
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
|
||||
class QUtf8Codec : public QTextCodec {
|
||||
public:
|
||||
@ -391,7 +397,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
#endif // textcodec
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -53,6 +53,8 @@
|
||||
#include <QtCore/private/qglobal_p.h>
|
||||
#include "qtextcodec.h"
|
||||
|
||||
QT_REQUIRE_CONFIG(textcodec);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWindowsLocalCodec: public QTextCodec
|
||||
|
@ -128,7 +128,6 @@
|
||||
#define QT_NO_COMPRESS
|
||||
#define QT_JSON_READONLY
|
||||
#define QT_NO_STANDARDPATHS
|
||||
#define QT_NO_TEXTCODEC
|
||||
#define QT_FEATURE_textcodec -1
|
||||
#else
|
||||
#define QT_FEATURE_codecs -1
|
||||
|
@ -66,5 +66,7 @@
|
||||
#include <qregexp.h>
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include <qtextcodec.h>
|
||||
#endif
|
||||
#endif
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <qplatformdefs.h>
|
||||
#include <qendian.h>
|
||||
#include "private/qabstractfileengine_p.h"
|
||||
#include "private/qnumeric_p.h"
|
||||
#include "private/qsimd_p.h"
|
||||
#include "private/qsystemerror_p.h"
|
||||
|
||||
@ -1502,7 +1503,9 @@ uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size, QFile::Memory
|
||||
{
|
||||
Q_Q(QResourceFileEngine);
|
||||
Q_UNUSED(flags);
|
||||
if (offset < 0 || size <= 0 || !resource.isValid() || offset + size > resource.size()) {
|
||||
qint64 end;
|
||||
if (offset < 0 || size <= 0 || !resource.isValid() ||
|
||||
add_overflow(offset, size, &end) || end > resource.size()) {
|
||||
q->setError(QFile::UnspecifiedError, QString());
|
||||
return 0;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include "qstandardpaths.h"
|
||||
#include <qdatastream.h>
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
# include "qtextcodec.h"
|
||||
#endif
|
||||
|
||||
@ -681,7 +681,7 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
|
||||
if (ch <= 0x1F || (ch >= 0x7F && !useCodec)) {
|
||||
result += "\\x" + QByteArray::number(ch, 16);
|
||||
escapeNextIfDigit = true;
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
} else if (useCodec) {
|
||||
// slow
|
||||
result += codec->fromUnicode(&unicode[i], 1);
|
||||
@ -834,7 +834,7 @@ StNormal:
|
||||
++j;
|
||||
}
|
||||
|
||||
#ifdef QT_NO_TEXTCODEC
|
||||
#if !QT_CONFIG(textcodec)
|
||||
Q_UNUSED(codec)
|
||||
#else
|
||||
if (codec) {
|
||||
@ -1679,7 +1679,7 @@ bool QConfFileSettingsPrivate::readIniFile(const QByteArray &data,
|
||||
int sectionPosition = 0;
|
||||
bool ok = true;
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
// detect utf8 BOM
|
||||
const uchar *dd = (const uchar *)data.constData();
|
||||
if (data.size() >= 3 && dd[0] == 0xef && dd[1] == 0xbb && dd[2] == 0xbf) {
|
||||
@ -2835,7 +2835,7 @@ QString QSettings::applicationName() const
|
||||
return d->applicationName;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
|
||||
/*!
|
||||
\since 4.5
|
||||
@ -2888,7 +2888,7 @@ QTextCodec *QSettings::iniCodec() const
|
||||
return d->iniCodec;
|
||||
}
|
||||
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
#endif // textcodec
|
||||
|
||||
/*!
|
||||
Returns a status code indicating the first error that was met by
|
||||
|
@ -178,7 +178,7 @@ public:
|
||||
QString organizationName() const;
|
||||
QString applicationName() const;
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
void setIniCodec(QTextCodec *codec);
|
||||
void setIniCodec(const char *codecName);
|
||||
QTextCodec *iniCodec() const;
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include <qmutex.h>
|
||||
#include <private/qloggingregistry_p.h>
|
||||
#include <qstandardpaths.h>
|
||||
#include <qtextcodec.h>
|
||||
#ifndef QT_NO_QOBJECT
|
||||
#include <qthread.h>
|
||||
#include <qthreadstorage.h>
|
||||
|
@ -38,7 +38,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qcoreglobaldata_p.h"
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include "qtextcodec.h"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -57,7 +57,9 @@
|
||||
#include "QtCore/qreadwritelock.h"
|
||||
#include "QtCore/qhash.h"
|
||||
#include "QtCore/qbytearray.h"
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include "QtCore/qtextcodec.h"
|
||||
#endif
|
||||
#include "QtCore/qmutex.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -42,7 +42,9 @@
|
||||
#include "private/qobject_p.h"
|
||||
#include "qurl.h"
|
||||
#include "qstringlist.h"
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include "qtextcodec.h"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -150,7 +152,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
||||
if (data.type() == QVariant::ByteArray) {
|
||||
// see if we can convert to the requested type
|
||||
switch(type) {
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
case QVariant::String: {
|
||||
const QByteArray ba = data.toByteArray();
|
||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||
@ -158,7 +160,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
||||
codec = QTextCodec::codecForHtml(ba, codec);
|
||||
return codec->toUnicode(ba);
|
||||
}
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
#endif // textcodec
|
||||
case QVariant::Color: {
|
||||
QVariant newData = data;
|
||||
newData.convert(QVariant::Color);
|
||||
|
@ -2514,22 +2514,21 @@ bool QObject::isSignalConnected(const QMetaMethod &signal) const
|
||||
signalIndex += QMetaObjectPrivate::signalOffset(signal.mobj);
|
||||
|
||||
QMutexLocker locker(signalSlotLock(this));
|
||||
if (!d->connectionLists)
|
||||
return false;
|
||||
if (d->connectionLists) {
|
||||
if (signalIndex < sizeof(d->connectedSignals) * 8 && !d->connectionLists->dirty)
|
||||
return d->isSignalConnected(signalIndex);
|
||||
|
||||
if (signalIndex < sizeof(d->connectedSignals) * 8 && !d->connectionLists->dirty)
|
||||
return d->isSignalConnected(signalIndex);
|
||||
|
||||
if (signalIndex < uint(d->connectionLists->count())) {
|
||||
const QObjectPrivate::Connection *c =
|
||||
d->connectionLists->at(signalIndex).first;
|
||||
while (c) {
|
||||
if (c->receiver)
|
||||
return true;
|
||||
c = c->nextConnectionList;
|
||||
if (signalIndex < uint(d->connectionLists->count())) {
|
||||
const QObjectPrivate::Connection *c =
|
||||
d->connectionLists->at(signalIndex).first;
|
||||
while (c) {
|
||||
if (c->receiver)
|
||||
return true;
|
||||
c = c->nextConnectionList;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return d->isDeclarativeSignalConnected(signalIndex);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -138,6 +138,16 @@ QDataStream &operator<<(QDataStream &ds, QCborSimpleType st);
|
||||
QDataStream &operator>>(QDataStream &ds, QCborSimpleType &st);
|
||||
#endif
|
||||
|
||||
inline uint qHash(QCborSimpleType tag, uint seed = 0)
|
||||
{
|
||||
return qHash(quint8(tag), seed);
|
||||
}
|
||||
|
||||
inline uint qHash(QCborTag tag, uint seed = 0)
|
||||
{
|
||||
return qHash(quint64(tag), seed);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Q_DECLARE_METATYPE(QCborTag)
|
||||
|
@ -1795,6 +1795,8 @@ public:
|
||||
preread();
|
||||
if (CborError err = cbor_parser_init_reader(nullptr, &parser, ¤tElement, this))
|
||||
handleError(err);
|
||||
else
|
||||
lastError = { QCborError::NoError };
|
||||
}
|
||||
|
||||
char *bufferPtr()
|
||||
|
@ -72,7 +72,7 @@ class QDataStream;
|
||||
struct QCborParserError
|
||||
{
|
||||
qint64 offset = 0;
|
||||
QCborError error = {};
|
||||
QCborError error = { QCborError::NoError };
|
||||
|
||||
QString errorString() const { return error.toString(); }
|
||||
};
|
||||
|
@ -326,7 +326,7 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr)
|
||||
:
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
readConverterSavedState(0),
|
||||
#endif
|
||||
readConverterSavedStateOffset(0),
|
||||
@ -347,12 +347,12 @@ QTextStreamPrivate::~QTextStreamPrivate()
|
||||
#endif
|
||||
delete device;
|
||||
}
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
delete readConverterSavedState;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
static void resetCodecConverterStateHelper(QTextCodec::ConverterState *state)
|
||||
{
|
||||
state->~ConverterState();
|
||||
@ -401,7 +401,7 @@ void QTextStreamPrivate::reset()
|
||||
readBufferStartDevicePos = 0;
|
||||
lastTokenSize = 0;
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
codec = QTextCodec::codecForLocale();
|
||||
resetCodecConverterStateHelper(&readConverterState);
|
||||
resetCodecConverterStateHelper(&writeConverterState);
|
||||
@ -461,7 +461,7 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
|
||||
if (bytesRead <= 0)
|
||||
return false;
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
// codec auto detection, explicitly defaults to locale encoding if the
|
||||
// codec has been set to 0.
|
||||
if (!codec || autoDetectUnicode) {
|
||||
@ -485,7 +485,7 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
|
||||
#endif
|
||||
|
||||
int oldReadBufferSize = readBuffer.size();
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
// convert to unicode
|
||||
readBuffer += Q_LIKELY(codec) ? codec->toUnicode(buf, bytesRead, &readConverterState)
|
||||
: QString::fromLatin1(buf, bytesRead);
|
||||
@ -567,7 +567,7 @@ void QTextStreamPrivate::flushWriteBuffer()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
if (!codec)
|
||||
codec = QTextCodec::codecForLocale();
|
||||
#if defined (QTEXTSTREAM_DEBUG)
|
||||
@ -786,7 +786,7 @@ inline void QTextStreamPrivate::consume(int size)
|
||||
*/
|
||||
inline void QTextStreamPrivate::saveConverterState(qint64 newPos)
|
||||
{
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
if (readConverterState.d) {
|
||||
// converter cannot be copied, so don't save anything
|
||||
// don't update readBufferStartDevicePos either
|
||||
@ -807,7 +807,7 @@ inline void QTextStreamPrivate::saveConverterState(qint64 newPos)
|
||||
*/
|
||||
inline void QTextStreamPrivate::restoreToSavedConverterState()
|
||||
{
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
if (readConverterSavedState) {
|
||||
// we have a saved state
|
||||
// that means the converter can be copied
|
||||
@ -1202,7 +1202,7 @@ bool QTextStream::seek(qint64 pos)
|
||||
return false;
|
||||
d->resetReadBuffer();
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
// Reset the codec converter states.
|
||||
resetCodecConverterStateHelper(&d->readConverterState);
|
||||
resetCodecConverterStateHelper(&d->writeConverterState);
|
||||
@ -1253,7 +1253,7 @@ qint64 QTextStream::pos() const
|
||||
QTextStreamPrivate *thatd = const_cast<QTextStreamPrivate *>(d);
|
||||
thatd->readBuffer.clear();
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
thatd->restoreToSavedConverterState();
|
||||
if (d->readBufferStartDevicePos == 0)
|
||||
thatd->autoDetectUnicode = true;
|
||||
@ -3036,7 +3036,7 @@ QTextStream &ws(QTextStream &stream)
|
||||
Equivalent to QTextStream::setRealNumberPrecision(\a precision).
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
/*!
|
||||
\relates QTextStream
|
||||
|
||||
@ -3111,15 +3111,15 @@ QTextCodec *QTextStream::codec() const
|
||||
}
|
||||
|
||||
/*!
|
||||
If \a enabled is true, QTextStream will attempt to detect Unicode
|
||||
encoding by peeking into the stream data to see if it can find the
|
||||
UTF-16 or UTF-32 BOM (Byte Order Mark). If this mark is found, QTextStream
|
||||
will replace the current codec with the UTF codec.
|
||||
If \a enabled is true, QTextStream will attempt to detect Unicode encoding
|
||||
by peeking into the stream data to see if it can find the UTF-8, UTF-16, or
|
||||
UTF-32 Byte Order Mark (BOM). If this mark is found, QTextStream will
|
||||
replace the current codec with the UTF codec.
|
||||
|
||||
This function can be used together with setCodec(). It is common
|
||||
to set the codec to UTF-8, and then enable UTF-16 detection.
|
||||
|
||||
\sa autoDetectUnicode(), setCodec()
|
||||
\sa autoDetectUnicode(), setCodec(), QTextCodec::codecForUtfText()
|
||||
*/
|
||||
void QTextStream::setAutoDetectUnicode(bool enabled)
|
||||
{
|
||||
@ -3131,7 +3131,7 @@ void QTextStream::setAutoDetectUnicode(bool enabled)
|
||||
Returns \c true if automatic Unicode detection is enabled, otherwise
|
||||
returns \c false. Automatic Unicode detection is enabled by default.
|
||||
|
||||
\sa setAutoDetectUnicode(), setCodec()
|
||||
\sa setAutoDetectUnicode(), setCodec(), QTextCodec::codecForUtfText()
|
||||
*/
|
||||
bool QTextStream::autoDetectUnicode() const
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
explicit QTextStream(const QByteArray &array, QIODevice::OpenMode openMode = QIODevice::ReadOnly);
|
||||
virtual ~QTextStream();
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
void setCodec(QTextCodec *codec);
|
||||
void setCodec(const char *codecName);
|
||||
QTextCodec *codec() const;
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
#include <QtCore/private/qglobal_p.h>
|
||||
#include "qtextstream.h"
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include "qtextcodec.h"
|
||||
#endif
|
||||
|
||||
@ -118,7 +118,7 @@ public:
|
||||
int stringOffset;
|
||||
QIODevice::OpenMode stringOpenMode;
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
// codec
|
||||
QTextCodec *codec;
|
||||
QTextCodec::ConverterState readConverterState;
|
||||
@ -141,7 +141,7 @@ public:
|
||||
|
||||
int lastTokenSize;
|
||||
bool deleteDevice;
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
bool autoDetectUnicode;
|
||||
#endif
|
||||
|
||||
|
@ -45,7 +45,9 @@
|
||||
#include <qdebug.h>
|
||||
#include <qfile.h>
|
||||
#include <stdio.h>
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include <qtextcodec.h>
|
||||
#endif
|
||||
#include <qstack.h>
|
||||
#include <qbuffer.h>
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
@ -420,7 +422,7 @@ QXmlStreamReader::QXmlStreamReader(const QString &data)
|
||||
: d_ptr(new QXmlStreamReaderPrivate(this))
|
||||
{
|
||||
Q_D(QXmlStreamReader);
|
||||
#ifdef QT_NO_TEXTCODEC
|
||||
#if !QT_CONFIG(textcodec)
|
||||
d->dataBuffer = data.toLatin1();
|
||||
#else
|
||||
d->dataBuffer = d->codec->fromUnicode(data);
|
||||
@ -515,7 +517,7 @@ void QXmlStreamReader::addData(const QString &data)
|
||||
{
|
||||
Q_D(QXmlStreamReader);
|
||||
d->lockEncoding = true;
|
||||
#ifdef QT_NO_TEXTCODEC
|
||||
#if !QT_CONFIG(textcodec)
|
||||
addData(data.toLatin1());
|
||||
#else
|
||||
addData(d->codec->fromUnicode(data));
|
||||
@ -792,7 +794,7 @@ QXmlStreamReaderPrivate::QXmlStreamReaderPrivate(QXmlStreamReader *q)
|
||||
{
|
||||
device = 0;
|
||||
deleteDevice = false;
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
decoder = 0;
|
||||
#endif
|
||||
stack_size = 64;
|
||||
@ -838,7 +840,7 @@ void QXmlStreamReaderPrivate::init()
|
||||
lineNumber = lastLineStart = characterOffset = 0;
|
||||
readBufferPos = 0;
|
||||
nbytesread = 0;
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
codec = QTextCodec::codecForMib(106); // utf8
|
||||
delete decoder;
|
||||
decoder = 0;
|
||||
@ -903,7 +905,7 @@ inline void QXmlStreamReaderPrivate::reallocateStack()
|
||||
|
||||
QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate()
|
||||
{
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
delete decoder;
|
||||
#endif
|
||||
free(sym_stack);
|
||||
@ -1482,7 +1484,7 @@ uint QXmlStreamReaderPrivate::getChar_helper()
|
||||
characterOffset += readBufferPos;
|
||||
readBufferPos = 0;
|
||||
readBuffer.resize(0);
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
if (decoder)
|
||||
#endif
|
||||
nbytesread = 0;
|
||||
@ -1503,7 +1505,7 @@ uint QXmlStreamReaderPrivate::getChar_helper()
|
||||
return StreamEOF;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
if (!decoder) {
|
||||
if (nbytesread < 4) { // the 4 is to cover 0xef 0xbb 0xbf plus
|
||||
// one extra for the utf8 codec
|
||||
@ -1545,7 +1547,7 @@ uint QXmlStreamReaderPrivate::getChar_helper()
|
||||
}
|
||||
#else
|
||||
readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread);
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
#endif // textcodec
|
||||
|
||||
readBuffer.reserve(1); // keep capacity when calling resize() next time
|
||||
|
||||
@ -1816,7 +1818,7 @@ void QXmlStreamReaderPrivate::startDocument()
|
||||
if (!QXmlUtils::isEncName(value))
|
||||
err = QXmlStream::tr("%1 is an invalid encoding name.").arg(value);
|
||||
else {
|
||||
#ifdef QT_NO_TEXTCODEC
|
||||
#if !QT_CONFIG(textcodec)
|
||||
readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread);
|
||||
#else
|
||||
QTextCodec *const newCodec = QTextCodec::codecForName(value.toLatin1());
|
||||
@ -1828,7 +1830,7 @@ void QXmlStreamReaderPrivate::startDocument()
|
||||
decoder = codec->makeDecoder();
|
||||
decoder->toUnicode(&readBuffer, rawReadBuffer.data(), nbytesread);
|
||||
}
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
#endif // textcodec
|
||||
}
|
||||
} else if (prefix.isEmpty() && key == QLatin1String("standalone")) {
|
||||
hasStandalone = true;
|
||||
@ -2966,7 +2968,7 @@ public:
|
||||
~QXmlStreamWriterPrivate() {
|
||||
if (deleteDevice)
|
||||
delete device;
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
delete encoder;
|
||||
#endif
|
||||
}
|
||||
@ -2993,7 +2995,7 @@ public:
|
||||
NamespaceDeclaration emptyNamespace;
|
||||
int lastNamespaceDeclaration;
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
QTextCodec *codec;
|
||||
QTextEncoder *encoder;
|
||||
#endif
|
||||
@ -3015,7 +3017,7 @@ QXmlStreamWriterPrivate::QXmlStreamWriterPrivate(QXmlStreamWriter *q)
|
||||
device = 0;
|
||||
stringDevice = 0;
|
||||
deleteDevice = false;
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
codec = QTextCodec::codecForMib(106); // utf8
|
||||
encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); // no byte order mark for utf8
|
||||
#endif
|
||||
@ -3032,7 +3034,7 @@ QXmlStreamWriterPrivate::QXmlStreamWriterPrivate(QXmlStreamWriter *q)
|
||||
|
||||
void QXmlStreamWriterPrivate::checkIfASCIICompatibleCodec()
|
||||
{
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
Q_ASSERT(encoder);
|
||||
// test ASCII-compatibility using the letter 'a'
|
||||
QChar letterA = QLatin1Char('a');
|
||||
@ -3052,7 +3054,7 @@ void QXmlStreamWriterPrivate::write(const QStringRef &s)
|
||||
if (device) {
|
||||
if (hasIoError)
|
||||
return;
|
||||
#ifdef QT_NO_TEXTCODEC
|
||||
#if !QT_CONFIG(textcodec)
|
||||
QByteArray bytes = s.toLatin1();
|
||||
#else
|
||||
QByteArray bytes = encoder->fromUnicode(s.constData(), s.size());
|
||||
@ -3075,7 +3077,7 @@ void QXmlStreamWriterPrivate::write(const QString &s)
|
||||
if (device) {
|
||||
if (hasIoError)
|
||||
return;
|
||||
#ifdef QT_NO_TEXTCODEC
|
||||
#if !QT_CONFIG(textcodec)
|
||||
QByteArray bytes = s.toLatin1();
|
||||
#else
|
||||
QByteArray bytes = encoder->fromUnicode(s);
|
||||
@ -3324,7 +3326,7 @@ QIODevice *QXmlStreamWriter::device() const
|
||||
}
|
||||
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
/*!
|
||||
Sets the codec for this stream to \a codec. The codec is used for
|
||||
encoding any data that is written. By default, QXmlStreamWriter
|
||||
@ -3382,7 +3384,7 @@ QTextCodec *QXmlStreamWriter::codec() const
|
||||
Q_D(const QXmlStreamWriter);
|
||||
return d->codec;
|
||||
}
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
#endif // textcodec
|
||||
|
||||
/*!
|
||||
\property QXmlStreamWriter::autoFormatting
|
||||
@ -3847,7 +3849,7 @@ void QXmlStreamWriter::writeStartDocument(const QString &version)
|
||||
d->write(version);
|
||||
if (d->device) { // stringDevice does not get any encoding
|
||||
d->write("\" encoding=\"");
|
||||
#ifdef QT_NO_TEXTCODEC
|
||||
#if !QT_CONFIG(textcodec)
|
||||
d->write("iso-8859-1");
|
||||
#else
|
||||
const QByteArray name = d->codec->name();
|
||||
@ -3871,7 +3873,7 @@ void QXmlStreamWriter::writeStartDocument(const QString &version, bool standalon
|
||||
d->write(version);
|
||||
if (d->device) { // stringDevice does not get any encoding
|
||||
d->write("\" encoding=\"");
|
||||
#ifdef QT_NO_TEXTCODEC
|
||||
#if !QT_CONFIG(textcodec)
|
||||
d->write("iso-8859-1");
|
||||
#else
|
||||
const QByteArray name = d->codec->name();
|
||||
|
@ -291,7 +291,7 @@ public:
|
||||
|
||||
QIODevice *device;
|
||||
bool deleteDevice;
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
QTextCodec *codec;
|
||||
QTextDecoder *decoder;
|
||||
#endif
|
||||
@ -584,7 +584,7 @@ bool QXmlStreamReaderPrivate::parse()
|
||||
lockEncoding = true;
|
||||
documentVersion.clear();
|
||||
documentEncoding.clear();
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
if (decoder && decoder->hasFailure()) {
|
||||
raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content."));
|
||||
readBuffer.clear();
|
||||
|
@ -478,7 +478,7 @@ public:
|
||||
void setDevice(QIODevice *device);
|
||||
QIODevice *device() const;
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
void setCodec(QTextCodec *codec);
|
||||
void setCodec(const char *codecName);
|
||||
QTextCodec *codec() const;
|
||||
|
@ -788,7 +788,7 @@ public:
|
||||
|
||||
QIODevice *device;
|
||||
bool deleteDevice;
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
QTextCodec *codec;
|
||||
QTextDecoder *decoder;
|
||||
#endif
|
||||
@ -1081,7 +1081,7 @@ bool QXmlStreamReaderPrivate::parse()
|
||||
lockEncoding = true;
|
||||
documentVersion.clear();
|
||||
documentEncoding.clear();
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
if (decoder && decoder->hasFailure()) {
|
||||
raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content."));
|
||||
readBuffer.clear();
|
||||
|
@ -92,7 +92,7 @@
|
||||
\note For the current keyboard input locale take a look at
|
||||
QInputMethod::locale().
|
||||
|
||||
QLocale's data is based on Common Locale Data Repository v33.1.
|
||||
QLocale's data is based on Common Locale Data Repository v34.
|
||||
|
||||
\sa QString::arg(), QString::toInt(), QString::toDouble(),
|
||||
QInputMethod::locale()
|
||||
|
@ -412,9 +412,10 @@ inline char QLocaleData::digitToCLocale(QChar in) const
|
||||
if (in == m_exponential || in == QChar::toUpper(m_exponential))
|
||||
return 'e';
|
||||
|
||||
// In several languages group() is the char 0xA0, which looks like a space.
|
||||
// People use a regular space instead of it and complain it doesn't work.
|
||||
if (m_group == 0xA0 && in.unicode() == ' ')
|
||||
// In several languages group() is a non-breaking space (U+00A0) or its thin
|
||||
// version (U+202f), which look like spaces. People (and thus some of our
|
||||
// tests) use a regular space instead and complain if it doesn't work.
|
||||
if ((m_group == 0xA0 || m_group == 0x202f) && in.unicode() == ' ')
|
||||
return ',';
|
||||
|
||||
return 0;
|
||||
|
@ -1384,6 +1384,9 @@ QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::ge
|
||||
x->strongref.store(-1);
|
||||
x->weakref.store(2); // the QWeakPointer that called us plus the QObject itself
|
||||
if (!d->sharedRefcount.testAndSetRelease(0, x)) {
|
||||
// ~ExternalRefCountData has a Q_ASSERT, so we use this trick to
|
||||
// only execute this if Q_ASSERTs are enabled
|
||||
Q_ASSERT((x->weakref.store(0), true));
|
||||
delete x;
|
||||
x = d->sharedRefcount.loadAcquire();
|
||||
x->weakref.ref();
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "qregularexpression.h"
|
||||
#endif
|
||||
#include "qunicodetables_p.h"
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include <qtextcodec.h>
|
||||
#endif
|
||||
#include <private/qutfcodec_p.h>
|
||||
@ -5277,11 +5277,11 @@ static QByteArray qt_convert_to_local_8bit(QStringView string)
|
||||
{
|
||||
if (string.isNull())
|
||||
return QByteArray();
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
QTextCodec *localeCodec = QTextCodec::codecForLocale();
|
||||
if (localeCodec)
|
||||
return localeCodec->fromUnicode(string);
|
||||
#endif // QT_NO_TEXTCODEC
|
||||
#endif // textcodec
|
||||
return qt_convert_to_latin1(string);
|
||||
}
|
||||
|
||||
@ -5475,13 +5475,13 @@ QString QString::fromLocal8Bit_helper(const char *str, int size)
|
||||
QStringDataPtr empty = { Data::allocate(0) };
|
||||
return QString(empty);
|
||||
}
|
||||
#if !defined(QT_NO_TEXTCODEC)
|
||||
#if QT_CONFIG(textcodec)
|
||||
if (size < 0)
|
||||
size = qstrlen(str);
|
||||
QTextCodec *codec = QTextCodec::codecForLocale();
|
||||
if (codec)
|
||||
return codec->toUnicode(str, size);
|
||||
#endif // !QT_NO_TEXTCODEC
|
||||
#endif // textcodec
|
||||
return fromLatin1(str, size);
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qstringbuilder.h"
|
||||
#include <QtCore/qtextcodec.h>
|
||||
#include <private/qutfcodec_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -20,13 +20,14 @@
|
||||
"Name": "Unicode Common Locale Data Repository (CLDR)",
|
||||
"QDocModule": "qtcore",
|
||||
"QtUsage": "Used in Qt Core (QTimeZone, QLocale).",
|
||||
"Files": "For update, see qtbase/util/local_database/cldr2qlocalexml.py",
|
||||
"Files": "qlocale_data_p.h qtimezoneprivate_data_p.h",
|
||||
|
||||
"Description": "The Unicode CLDR provides key building blocks for software to support the
|
||||
world's languages, with the largest and most extensive standard repository of locale data
|
||||
available.",
|
||||
"Homepage": "http://cldr.unicode.org/",
|
||||
"Version": "v33.1",
|
||||
"Version": "v34",
|
||||
"License": "// as specified in https://spdx.org/licenses/Unicode-DFS-2016.html",
|
||||
"License": "Unicode License Agreement - Data Files and Software (2016)",
|
||||
"LicenseId": "Unicode-DFS-2016",
|
||||
|
@ -118,21 +118,14 @@ QImageData::QImageData()
|
||||
QImageData * QImageData::create(const QSize &size, QImage::Format format)
|
||||
{
|
||||
if (!size.isValid() || format == QImage::Format_Invalid)
|
||||
return 0; // invalid parameter(s)
|
||||
return nullptr; // invalid parameter(s)
|
||||
|
||||
uint width = size.width();
|
||||
uint height = size.height();
|
||||
uint depth = qt_depthForFormat(format);
|
||||
|
||||
const int bytes_per_line = ((width * depth + 31) >> 5) << 2; // bytes per scanline (must be multiple of 4)
|
||||
|
||||
// sanity check for potential overflows
|
||||
if (std::numeric_limits<int>::max()/depth < width
|
||||
|| bytes_per_line <= 0
|
||||
|| height <= 0
|
||||
|| std::numeric_limits<qsizetype>::max()/uint(bytes_per_line) < height
|
||||
|| std::numeric_limits<int>::max()/sizeof(uchar *) < uint(height))
|
||||
return 0;
|
||||
int width = size.width();
|
||||
int height = size.height();
|
||||
int depth = qt_depthForFormat(format);
|
||||
auto params = calculateImageParameters(width, height, depth);
|
||||
if (params.bytesPerLine < 0)
|
||||
return nullptr;
|
||||
|
||||
QScopedPointer<QImageData> d(new QImageData);
|
||||
|
||||
@ -154,18 +147,15 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format)
|
||||
d->has_alpha_clut = false;
|
||||
d->is_cached = false;
|
||||
|
||||
d->bytes_per_line = bytes_per_line;
|
||||
|
||||
d->nbytes = d->bytes_per_line*height;
|
||||
d->bytes_per_line = params.bytesPerLine;
|
||||
d->nbytes = params.totalSize;
|
||||
d->data = (uchar *)malloc(d->nbytes);
|
||||
|
||||
if (!d->data) {
|
||||
return 0;
|
||||
}
|
||||
if (!d->data)
|
||||
return nullptr;
|
||||
|
||||
d->ref.ref();
|
||||
return d.take();
|
||||
|
||||
}
|
||||
|
||||
QImageData::~QImageData()
|
||||
@ -786,27 +776,27 @@ QImage::QImage(const QSize &size, Format format)
|
||||
|
||||
QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
|
||||
{
|
||||
QImageData *d = 0;
|
||||
|
||||
if (format == QImage::Format_Invalid)
|
||||
return d;
|
||||
if (width <= 0 || height <= 0 || !data || format == QImage::Format_Invalid)
|
||||
return nullptr;
|
||||
|
||||
const int depth = qt_depthForFormat(format);
|
||||
const int calc_bytes_per_line = ((width * depth + 31)/32) * 4;
|
||||
const int min_bytes_per_line = (width * depth + 7)/8;
|
||||
auto params = calculateImageParameters(width, height, depth);
|
||||
if (params.totalSize < 0)
|
||||
return nullptr;
|
||||
|
||||
if (bpl <= 0)
|
||||
bpl = calc_bytes_per_line;
|
||||
if (bpl > 0) {
|
||||
// can't overflow, because has calculateImageParameters already done this multiplication
|
||||
const int min_bytes_per_line = (width * depth + 7)/8;
|
||||
if (bpl < min_bytes_per_line)
|
||||
return nullptr;
|
||||
|
||||
if (width <= 0 || height <= 0 || !data
|
||||
|| INT_MAX/sizeof(uchar *) < uint(height)
|
||||
|| INT_MAX/uint(depth) < uint(width)
|
||||
|| bpl <= 0
|
||||
|| bpl < min_bytes_per_line
|
||||
|| INT_MAX/uint(bpl) < uint(height))
|
||||
return d; // invalid parameter(s)
|
||||
// recalculate the total with this value
|
||||
params.bytesPerLine = bpl;
|
||||
if (mul_overflow<qsizetype>(bpl, height, ¶ms.totalSize))
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
d = new QImageData;
|
||||
QImageData *d = new QImageData;
|
||||
d->ref.ref();
|
||||
|
||||
d->own_data = false;
|
||||
@ -817,8 +807,8 @@ QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QIm
|
||||
d->depth = depth;
|
||||
d->format = format;
|
||||
|
||||
d->bytes_per_line = bpl;
|
||||
d->nbytes = d->bytes_per_line * height;
|
||||
d->bytes_per_line = params.bytesPerLine;
|
||||
d->nbytes = params.totalSize;
|
||||
|
||||
d->cleanupFunction = cleanupFunction;
|
||||
d->cleanupInfo = cleanupInfo;
|
||||
|
@ -817,10 +817,10 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve
|
||||
Q_ASSERT(data->own_data);
|
||||
|
||||
const int depth = 32;
|
||||
|
||||
const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
|
||||
const qsizetype nbytes = dst_bytes_per_line * data->height;
|
||||
uchar *const newData = (uchar *)realloc(data->data, nbytes);
|
||||
auto params = QImageData::calculateImageParameters(data->width, data->height, depth);
|
||||
if (params.bytesPerLine < 0)
|
||||
return false;
|
||||
uchar *const newData = (uchar *)realloc(data->data, params.totalSize);
|
||||
if (!newData)
|
||||
return false;
|
||||
|
||||
@ -828,10 +828,10 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve
|
||||
|
||||
// start converting from the end because the end image is bigger than the source
|
||||
uchar *src_data = newData + data->nbytes; // end of src
|
||||
quint32 *dest_data = (quint32 *) (newData + nbytes); // end of dest > end of src
|
||||
quint32 *dest_data = (quint32 *) (newData + params.totalSize); // end of dest > end of src
|
||||
const int width = data->width;
|
||||
const int src_pad = data->bytes_per_line - width;
|
||||
const int dest_pad = (dst_bytes_per_line >> 2) - width;
|
||||
const int dest_pad = (params.bytesPerLine >> 2) - width;
|
||||
if (data->colortable.size() == 0) {
|
||||
data->colortable.resize(256);
|
||||
for (int i = 0; i < 256; ++i)
|
||||
@ -858,9 +858,9 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve
|
||||
|
||||
data->colortable = QVector<QRgb>();
|
||||
data->format = QImage::Format_ARGB32_Premultiplied;
|
||||
data->bytes_per_line = dst_bytes_per_line;
|
||||
data->bytes_per_line = params.bytesPerLine;
|
||||
data->depth = depth;
|
||||
data->nbytes = nbytes;
|
||||
data->nbytes = params.totalSize;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -871,10 +871,10 @@ static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversi
|
||||
Q_ASSERT(data->own_data);
|
||||
|
||||
const int depth = 32;
|
||||
|
||||
const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
|
||||
const qsizetype nbytes = dst_bytes_per_line * data->height;
|
||||
uchar *const newData = (uchar *)realloc(data->data, nbytes);
|
||||
auto params = QImageData::calculateImageParameters(data->width, data->height, depth);
|
||||
if (params.bytesPerLine < 0)
|
||||
return false;
|
||||
uchar *const newData = (uchar *)realloc(data->data, params.totalSize);
|
||||
if (!newData)
|
||||
return false;
|
||||
|
||||
@ -882,10 +882,10 @@ static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversi
|
||||
|
||||
// start converting from the end because the end image is bigger than the source
|
||||
uchar *src_data = newData + data->nbytes;
|
||||
quint32 *dest_data = (quint32 *) (newData + nbytes);
|
||||
quint32 *dest_data = (quint32 *) (newData + params.totalSize);
|
||||
const int width = data->width;
|
||||
const int src_pad = data->bytes_per_line - width;
|
||||
const int dest_pad = (dst_bytes_per_line >> 2) - width;
|
||||
const int dest_pad = (params.bytesPerLine >> 2) - width;
|
||||
if (data->colortable.size() == 0) {
|
||||
data->colortable.resize(256);
|
||||
for (int i = 0; i < 256; ++i)
|
||||
@ -909,9 +909,9 @@ static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversi
|
||||
|
||||
data->colortable = QVector<QRgb>();
|
||||
data->format = QImage::Format_ARGB32;
|
||||
data->bytes_per_line = dst_bytes_per_line;
|
||||
data->bytes_per_line = params.bytesPerLine;
|
||||
data->depth = depth;
|
||||
data->nbytes = nbytes;
|
||||
data->nbytes = params.totalSize;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -939,10 +939,10 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers
|
||||
Q_ASSERT(data->own_data);
|
||||
|
||||
const int depth = 16;
|
||||
|
||||
const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
|
||||
const qsizetype nbytes = dst_bytes_per_line * data->height;
|
||||
uchar *const newData = (uchar *)realloc(data->data, nbytes);
|
||||
auto params = QImageData::calculateImageParameters(data->width, data->height, depth);
|
||||
if (params.bytesPerLine < 0)
|
||||
return false;
|
||||
uchar *const newData = (uchar *)realloc(data->data, params.totalSize);
|
||||
if (!newData)
|
||||
return false;
|
||||
|
||||
@ -950,10 +950,10 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers
|
||||
|
||||
// start converting from the end because the end image is bigger than the source
|
||||
uchar *src_data = newData + data->nbytes;
|
||||
quint16 *dest_data = (quint16 *) (newData + nbytes);
|
||||
quint16 *dest_data = (quint16 *) (newData + params.totalSize);
|
||||
const int width = data->width;
|
||||
const int src_pad = data->bytes_per_line - width;
|
||||
const int dest_pad = (dst_bytes_per_line >> 1) - width;
|
||||
const int dest_pad = (params.bytesPerLine >> 1) - width;
|
||||
|
||||
quint16 colorTableRGB16[256];
|
||||
const int tableSize = data->colortable.size();
|
||||
@ -983,9 +983,9 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers
|
||||
}
|
||||
|
||||
data->format = QImage::Format_RGB16;
|
||||
data->bytes_per_line = dst_bytes_per_line;
|
||||
data->bytes_per_line = params.bytesPerLine;
|
||||
data->depth = depth;
|
||||
data->nbytes = nbytes;
|
||||
data->nbytes = params.totalSize;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -997,6 +997,7 @@ static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFl
|
||||
|
||||
const int depth = 16;
|
||||
|
||||
// cannot overflow, since we're shrinking the buffer
|
||||
const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
|
||||
const qsizetype src_bytes_per_line = data->bytes_per_line;
|
||||
quint32 *src_data = (quint32 *) data->data;
|
||||
@ -1013,12 +1014,11 @@ static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFl
|
||||
data->depth = depth;
|
||||
data->nbytes = dst_bytes_per_line * data->height;
|
||||
uchar *const newData = (uchar *)realloc(data->data, data->nbytes);
|
||||
if (newData) {
|
||||
if (newData)
|
||||
data->data = newData;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
// can't fail, since we're shrinking
|
||||
return true;
|
||||
}
|
||||
|
||||
static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src)
|
||||
|
@ -52,6 +52,7 @@
|
||||
//
|
||||
|
||||
#include <QtGui/private/qtguiglobal_p.h>
|
||||
#include <QtCore/private/qnumeric_p.h>
|
||||
|
||||
#include <QMap>
|
||||
#include <QVector>
|
||||
@ -104,8 +105,40 @@ struct Q_GUI_EXPORT QImageData { // internal image data
|
||||
bool doImageIO(const QImage *image, QImageWriter* io, int quality) const;
|
||||
|
||||
QPaintEngine *paintEngine;
|
||||
|
||||
struct ImageSizeParameters {
|
||||
qsizetype bytesPerLine;
|
||||
qsizetype totalSize;
|
||||
};
|
||||
static ImageSizeParameters calculateImageParameters(qsizetype width, qsizetype height, qsizetype depth);
|
||||
};
|
||||
|
||||
inline QImageData::ImageSizeParameters
|
||||
QImageData::calculateImageParameters(qsizetype width, qsizetype height, qsizetype depth)
|
||||
{
|
||||
ImageSizeParameters invalid = { -1, -1 };
|
||||
if (height <= 0)
|
||||
return invalid;
|
||||
|
||||
// calculate the size, taking care of overflows
|
||||
qsizetype bytes_per_line;
|
||||
if (mul_overflow(width, depth, &bytes_per_line))
|
||||
return invalid;
|
||||
if (add_overflow(bytes_per_line, qsizetype(31), &bytes_per_line))
|
||||
return invalid;
|
||||
// bytes per scanline (must be multiple of 4)
|
||||
bytes_per_line = (bytes_per_line >> 5) << 2; // can't overflow
|
||||
|
||||
qsizetype total_size;
|
||||
if (mul_overflow(height, bytes_per_line, &total_size))
|
||||
return invalid;
|
||||
qsizetype dummy;
|
||||
if (mul_overflow(height, qsizetype(sizeof(uchar *)), &dummy))
|
||||
return invalid; // why is this here?
|
||||
|
||||
return { bytes_per_line, total_size };
|
||||
}
|
||||
|
||||
typedef void (*Image_Converter)(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
|
||||
typedef bool (*InPlace_Image_Converter)(QImageData *data, Qt::ImageConversionFlags);
|
||||
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include <qiodevice.h>
|
||||
#include <qimage.h>
|
||||
#include <qlist.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <qvariant.h>
|
||||
#include <qvector.h>
|
||||
|
||||
|
@ -46,7 +46,9 @@
|
||||
#include "qvariant.h"
|
||||
#include "qbuffer.h"
|
||||
#include "qimage.h"
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include "qtextcodec.h"
|
||||
#endif
|
||||
|
||||
#include "private/qguiapplication_p.h"
|
||||
#include <qpa/qplatformintegration.h>
|
||||
@ -298,16 +300,16 @@ QString QClipboard::text(QString &subtype, Mode mode) const
|
||||
|
||||
const QByteArray rawData = data->data(QLatin1String("text/") + subtype);
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
QTextCodec* codec = QTextCodec::codecForMib(106); // utf-8 is default
|
||||
if (subtype == QLatin1String("html"))
|
||||
codec = QTextCodec::codecForHtml(rawData, codec);
|
||||
else
|
||||
codec = QTextCodec::codecForUtfText(rawData, codec);
|
||||
return codec->toUnicode(rawData);
|
||||
#else //QT_NO_TEXTCODEC
|
||||
#else // textcodec
|
||||
return rawData;
|
||||
#endif //QT_NO_TEXTCODEC
|
||||
#endif // textcodec
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -2533,6 +2533,7 @@ QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalP
|
||||
*/
|
||||
QTabletEvent::~QTabletEvent()
|
||||
{
|
||||
delete static_cast<QTabletEventPrivate *>(mExtra);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -803,7 +803,8 @@ static void updateBlockedStatusRecursion(QWindow *window, bool shouldBeBlocked)
|
||||
void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window)
|
||||
{
|
||||
bool shouldBeBlocked = false;
|
||||
if (!QWindowPrivate::get(window)->isPopup() && !self->modalWindowList.isEmpty())
|
||||
const bool popupType = (window->type() == Qt::ToolTip) || (window->type() == Qt::Popup);
|
||||
if (!popupType && !self->modalWindowList.isEmpty())
|
||||
shouldBeBlocked = self->isWindowBlocked(window);
|
||||
updateBlockedStatusRecursion(window, shouldBeBlocked);
|
||||
}
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "qpixmap.h"
|
||||
#include "qevent.h"
|
||||
#include "qfile.h"
|
||||
#include "qtextcodec.h"
|
||||
#include "qguiapplication.h"
|
||||
#include "qpoint.h"
|
||||
#include "qbuffer.h"
|
||||
|
@ -319,7 +319,8 @@ void QSurfaceFormat::setStereo(bool enable)
|
||||
|
||||
/*!
|
||||
Returns the number of samples per pixel when multisampling is
|
||||
enabled. By default, multisampling is disabled.
|
||||
enabled, or \c -1 when multisampling is disabled. The default
|
||||
return value is \c -1.
|
||||
|
||||
\sa setSamples()
|
||||
*/
|
||||
|
@ -63,7 +63,9 @@
|
||||
#include <qregexp.h>
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include <qtextcodec.h>
|
||||
#endif
|
||||
|
||||
#include <qguiapplication.h>
|
||||
#include <qbitmap.h>
|
||||
|
@ -394,6 +394,9 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong times
|
||||
Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
|
||||
Qt::MouseEventSource source)
|
||||
{
|
||||
Q_ASSERT_X(type != QEvent::MouseButtonDblClick && type != QEvent::NonClientAreaMouseButtonDblClick,
|
||||
"QWindowSystemInterface::handleMouseEvent",
|
||||
"QTBUG-71263: Native double clicks are not implemented.");
|
||||
auto localPos = QHighDpi::fromNativeLocalPosition(local, window);
|
||||
auto globalPos = QHighDpi::fromNativePixels(global, window);
|
||||
|
||||
|
@ -40,8 +40,10 @@
|
||||
#include "qopenglvertexarrayobject.h"
|
||||
|
||||
#include <QtCore/private/qobject_p.h>
|
||||
#include <QtCore/qthread.h>
|
||||
#include <QtGui/qopenglcontext.h>
|
||||
#include <QtGui/qoffscreensurface.h>
|
||||
#include <QtGui/qguiapplication.h>
|
||||
|
||||
#include <QtGui/qopenglfunctions_3_0.h>
|
||||
#include <QtGui/qopenglfunctions_3_2_core.h>
|
||||
@ -204,18 +206,25 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
|
||||
if (context && context != ctx) {
|
||||
oldContext = ctx;
|
||||
oldContextSurface = ctx ? ctx->surface() : 0;
|
||||
// Cannot just make the current surface current again with another context.
|
||||
// The format may be incompatible and some platforms (iOS) may impose
|
||||
// restrictions on using a window with different contexts. Create an
|
||||
// offscreen surface (a pbuffer or a hidden window) instead to be safe.
|
||||
offscreenSurface.reset(new QOffscreenSurface);
|
||||
offscreenSurface->setFormat(context->format());
|
||||
offscreenSurface->create();
|
||||
if (context->makeCurrent(offscreenSurface.data())) {
|
||||
ctx = context;
|
||||
} else {
|
||||
qWarning("QOpenGLVertexArrayObject::destroy() failed to make VAO's context current");
|
||||
// Before going through the effort of creating an offscreen surface
|
||||
// check that we are on the GUI thread because otherwise many platforms
|
||||
// will not able to create that offscreen surface.
|
||||
if (QThread::currentThread() != qGuiApp->thread()) {
|
||||
ctx = 0;
|
||||
} else {
|
||||
// Cannot just make the current surface current again with another context.
|
||||
// The format may be incompatible and some platforms (iOS) may impose
|
||||
// restrictions on using a window with different contexts. Create an
|
||||
// offscreen surface (a pbuffer or a hidden window) instead to be safe.
|
||||
offscreenSurface.reset(new QOffscreenSurface);
|
||||
offscreenSurface->setFormat(context->format());
|
||||
offscreenSurface->create();
|
||||
if (context->makeCurrent(offscreenSurface.data())) {
|
||||
ctx = context;
|
||||
} else {
|
||||
qWarning("QOpenGLVertexArrayObject::destroy() failed to make VAO's context current");
|
||||
ctx = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,7 +233,7 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
|
||||
context = 0;
|
||||
}
|
||||
|
||||
if (vao) {
|
||||
if (vao && ctx) {
|
||||
switch (vaoFuncsType) {
|
||||
#ifndef QT_OPENGL_ES_2
|
||||
case Core_3_2:
|
||||
|
@ -71,7 +71,7 @@
|
||||
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
|
||||
#endif
|
||||
|
||||
#ifndef GL_FRAMEBUFFER_SRB
|
||||
#ifndef GL_FRAMEBUFFER_SRGB
|
||||
#define GL_FRAMEBUFFER_SRGB 0x8DB9
|
||||
#endif
|
||||
#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE
|
||||
|
@ -157,14 +157,12 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
|
||||
|
||||
void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, int charsAdded)
|
||||
{
|
||||
if (!inReformatBlocks)
|
||||
if (!inReformatBlocks && !rehighlightPending)
|
||||
reformatBlocks(from, charsRemoved, charsAdded);
|
||||
}
|
||||
|
||||
void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int charsAdded)
|
||||
{
|
||||
rehighlightPending = false;
|
||||
|
||||
QTextBlock block = doc->findBlock(from);
|
||||
if (!block.isValid())
|
||||
return;
|
||||
@ -346,8 +344,10 @@ void QSyntaxHighlighter::setDocument(QTextDocument *doc)
|
||||
if (d->doc) {
|
||||
connect(d->doc, SIGNAL(contentsChange(int,int,int)),
|
||||
this, SLOT(_q_reformatBlocks(int,int,int)));
|
||||
d->rehighlightPending = true;
|
||||
QTimer::singleShot(0, this, SLOT(_q_delayedRehighlight()));
|
||||
if (!d->doc->isEmpty()) {
|
||||
d->rehighlightPending = true;
|
||||
QTimer::singleShot(0, this, SLOT(_q_delayedRehighlight()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,9 @@
|
||||
#include <qregularexpression.h>
|
||||
#endif
|
||||
#include <qvarlengtharray.h>
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include <qtextcodec.h>
|
||||
#endif
|
||||
#include <qthread.h>
|
||||
#include <qcoreapplication.h>
|
||||
#include <qmetaobject.h>
|
||||
@ -209,7 +211,7 @@ QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode)
|
||||
|
||||
This function is defined in the \c <QTextDocument> header file.
|
||||
*/
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
QTextCodec *Qt::codecForHtml(const QByteArray &ba)
|
||||
{
|
||||
return QTextCodec::codecForHtml(ba);
|
||||
|
@ -75,7 +75,7 @@ namespace Qt
|
||||
Q_GUI_EXPORT bool mightBeRichText(const QString&);
|
||||
Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode = WhiteSpacePre);
|
||||
|
||||
#if !defined(QT_NO_TEXTCODEC) || defined(Q_CLANG_QDOC)
|
||||
#if QT_CONFIG(textcodec) || defined(Q_CLANG_QDOC)
|
||||
Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba);
|
||||
#endif
|
||||
}
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "qtextlist.h"
|
||||
|
||||
#include <qdebug.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <qbytearray.h>
|
||||
#include <qdatastream.h>
|
||||
#include <qdatetime.h>
|
||||
|
@ -41,7 +41,9 @@
|
||||
#include <QtCore/qfile.h>
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qfileinfo.h>
|
||||
#if QT_CONFIG(textcodec)
|
||||
#include <QtCore/qtextcodec.h>
|
||||
#endif
|
||||
#include <QtCore/qtextstream.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
#include "qtextdocument.h"
|
||||
@ -63,7 +65,7 @@ public:
|
||||
QByteArray format;
|
||||
QIODevice *device;
|
||||
bool deleteDevice;
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
QTextCodec *codec;
|
||||
#endif
|
||||
|
||||
@ -104,7 +106,7 @@ public:
|
||||
QTextDocumentWriterPrivate::QTextDocumentWriterPrivate(QTextDocumentWriter *qq)
|
||||
: device(0),
|
||||
deleteDevice(false),
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
codec(QTextCodec::codecForName("utf-8")),
|
||||
#endif
|
||||
q(qq)
|
||||
@ -258,7 +260,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
|
||||
#ifndef QT_NO_TEXTODFWRITER
|
||||
if (format == "odf" || format == "opendocumentformat" || format == "odt") {
|
||||
QTextOdfWriter writer(*document, d->device);
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
writer.setCodec(d->codec);
|
||||
#endif
|
||||
return writer.writeAll();
|
||||
@ -272,7 +274,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
|
||||
return false;
|
||||
}
|
||||
QTextStream ts(d->device);
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
ts.setCodec(d->codec);
|
||||
ts << document->toHtml(d->codec->name());
|
||||
#endif
|
||||
@ -286,7 +288,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
|
||||
return false;
|
||||
}
|
||||
QTextStream ts(d->device);
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
ts.setCodec(d->codec);
|
||||
#endif
|
||||
ts << document->toPlainText();
|
||||
@ -317,7 +319,7 @@ bool QTextDocumentWriter::write(const QTextDocumentFragment &fragment)
|
||||
uses UTF-8.
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
void QTextDocumentWriter::setCodec(QTextCodec *codec)
|
||||
{
|
||||
if (codec == 0)
|
||||
@ -330,7 +332,7 @@ void QTextDocumentWriter::setCodec(QTextCodec *codec)
|
||||
/*!
|
||||
Returns the codec that is currently assigned to the writer.
|
||||
*/
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
QTextCodec *QTextDocumentWriter::codec() const
|
||||
{
|
||||
return d->codec;
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
bool write(const QTextDocument *document);
|
||||
bool write(const QTextDocumentFragment &fragment);
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
void setCodec(QTextCodec *codec);
|
||||
QTextCodec *codec() const;
|
||||
#endif
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "qtexthtmlparser_p.h"
|
||||
|
||||
#include <qbytearray.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <qstack.h>
|
||||
#include <qdebug.h>
|
||||
#include <qthread.h>
|
||||
|
@ -961,7 +961,7 @@ bool QTextOdfWriter::writeAll()
|
||||
return false;
|
||||
}
|
||||
QXmlStreamWriter writer(m_strategy->contentStream);
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
if (m_codec)
|
||||
writer.setCodec(m_codec);
|
||||
#endif
|
||||
|
@ -1383,23 +1383,6 @@ bool QSocks5SocketEngine::bind(const QHostAddress &addr, quint16 port)
|
||||
d->localAddress = QHostAddress();
|
||||
d->udpData->associatePort = d->localPort;
|
||||
d->localPort = 0;
|
||||
QUdpSocket dummy;
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
dummy.setProperty("_q_networksession", property("_q_networksession"));
|
||||
#endif
|
||||
dummy.setProxy(QNetworkProxy::NoProxy);
|
||||
if (!dummy.bind()
|
||||
|| writeDatagram(0,0, QIpPacketHeader(d->data->controlSocket->localAddress(), dummy.localPort())) != 0
|
||||
|| !dummy.waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed()))
|
||||
|| dummy.readDatagram(0,0, &d->localAddress, &d->localPort) != 0) {
|
||||
QSOCKS5_DEBUG << "udp actual address and port lookup failed";
|
||||
setState(QAbstractSocket::UnconnectedState);
|
||||
setError(dummy.error(), dummy.errorString());
|
||||
d->data->controlSocket->close();
|
||||
//### reset and error
|
||||
return false;
|
||||
}
|
||||
QSOCKS5_DEBUG << "udp actual address and port" << d->localAddress << ':' << d->localPort;
|
||||
return true;
|
||||
#endif // QT_NO_UDPSOCKET
|
||||
}
|
||||
|
@ -418,8 +418,10 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q
|
||||
QVariant ret;
|
||||
if (flavor == QLatin1String("public.utf8-plain-text")) {
|
||||
ret = QString::fromUtf8(firstData);
|
||||
#if QT_CONFIG(textcodec)
|
||||
} else if (flavor == QLatin1String("public.utf16-plain-text")) {
|
||||
ret = QTextCodec::codecForName("UTF-16")->toUnicode(firstData);
|
||||
#endif
|
||||
} else {
|
||||
qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
|
||||
}
|
||||
@ -432,8 +434,10 @@ QList<QByteArray> QMacPasteboardMimeUnicodeText::convertFromMime(const QString &
|
||||
QString string = data.toString();
|
||||
if (flavor == QLatin1String("public.utf8-plain-text"))
|
||||
ret.append(string.toUtf8());
|
||||
#if QT_CONFIG(textcodec)
|
||||
else if (flavor == QLatin1String("public.utf16-plain-text"))
|
||||
ret.append(QTextCodec::codecForName("UTF-16")->fromUnicode(string));
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,9 @@ QFbCursor::QFbCursor(QFbScreen *screen)
|
||||
mCursorImage(nullptr),
|
||||
mDeviceListener(nullptr)
|
||||
{
|
||||
QByteArray hideCursorVal = qgetenv("QT_QPA_FB_HIDECURSOR");
|
||||
if (!hideCursorVal.isEmpty())
|
||||
mVisible = hideCursorVal.toInt() == 0;
|
||||
const char *envVar = "QT_QPA_FB_HIDECURSOR";
|
||||
if (qEnvironmentVariableIsSet(envVar))
|
||||
mVisible = qEnvironmentVariableIntValue(envVar) == 0;
|
||||
if (!mVisible)
|
||||
return;
|
||||
|
||||
@ -83,7 +83,7 @@ QFbCursor::~QFbCursor()
|
||||
delete mDeviceListener;
|
||||
}
|
||||
|
||||
QRect QFbCursor::getCurrentRect()
|
||||
QRect QFbCursor::getCurrentRect() const
|
||||
{
|
||||
QRect rect = mCursorImage->image()->rect().translated(-mCursorImage->hotspot().x(),
|
||||
-mCursorImage->hotspot().y());
|
||||
@ -102,6 +102,8 @@ void QFbCursor::setPos(const QPoint &pos)
|
||||
{
|
||||
QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos);
|
||||
m_pos = pos;
|
||||
if (!mVisible)
|
||||
return;
|
||||
mCurrentRect = getCurrentRect();
|
||||
if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft())))
|
||||
setDirty();
|
||||
@ -112,6 +114,8 @@ void QFbCursor::pointerEvent(const QMouseEvent &e)
|
||||
if (e.type() != QEvent::MouseMove)
|
||||
return;
|
||||
m_pos = e.screenPos().toPoint();
|
||||
if (!mVisible)
|
||||
return;
|
||||
mCurrentRect = getCurrentRect();
|
||||
if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft())))
|
||||
setDirty();
|
||||
@ -149,23 +153,28 @@ QRect QFbCursor::dirtyRect()
|
||||
|
||||
void QFbCursor::setCursor(Qt::CursorShape shape)
|
||||
{
|
||||
mCursorImage->set(shape);
|
||||
if (mCursorImage)
|
||||
mCursorImage->set(shape);
|
||||
}
|
||||
|
||||
void QFbCursor::setCursor(const QImage &image, int hotx, int hoty)
|
||||
{
|
||||
mCursorImage->set(image, hotx, hoty);
|
||||
if (mCursorImage)
|
||||
mCursorImage->set(image, hotx, hoty);
|
||||
}
|
||||
|
||||
void QFbCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
|
||||
{
|
||||
mCursorImage->set(data, mask, width, height, hotX, hotY);
|
||||
if (mCursorImage)
|
||||
mCursorImage->set(data, mask, width, height, hotX, hotY);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_CURSOR
|
||||
void QFbCursor::changeCursor(QCursor * widgetCursor, QWindow *window)
|
||||
{
|
||||
Q_UNUSED(window);
|
||||
if (!mVisible)
|
||||
return;
|
||||
const Qt::CursorShape shape = widgetCursor ? widgetCursor->shape() : Qt::ArrowCursor;
|
||||
|
||||
if (shape == Qt::BitmapCursor) {
|
||||
@ -196,7 +205,7 @@ void QFbCursor::setDirty()
|
||||
|
||||
void QFbCursor::updateMouseStatus()
|
||||
{
|
||||
mVisible = mDeviceListener->hasMouse();
|
||||
mVisible = mDeviceListener ? mDeviceListener->hasMouse() : false;
|
||||
mScreen->setDirty(mVisible ? getCurrentRect() : lastPainted());
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ private:
|
||||
void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY);
|
||||
void setCursor(Qt::CursorShape shape);
|
||||
void setCursor(const QImage &image, int hotx, int hoty);
|
||||
QRect getCurrentRect();
|
||||
QRect getCurrentRect() const;
|
||||
|
||||
bool mVisible;
|
||||
QFbScreen *mScreen;
|
||||
|
@ -269,11 +269,11 @@ int QLibInputKeyboard::keysymToQtKey(xkb_keysym_t key) const
|
||||
int QLibInputKeyboard::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers *modifiers, const QString &text) const
|
||||
{
|
||||
int code = 0;
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
QTextCodec *systemCodec = QTextCodec::codecForLocale();
|
||||
#endif
|
||||
if (keysym < 128 || (keysym < 256
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
&& systemCodec->mibEnum() == 4
|
||||
#endif
|
||||
)) {
|
||||
|
@ -213,7 +213,7 @@ void QGIFFormat::disposePrevious(QImage *image)
|
||||
case RestoreImage: {
|
||||
if (frame >= 0) {
|
||||
for (int ln=t; ln<=b; ln++) {
|
||||
memcpy(image->scanLine(ln)+l,
|
||||
memcpy(image->scanLine(ln)+l*sizeof(QRgb),
|
||||
backingstore.constScanLine(ln-t),
|
||||
(r-l+1)*sizeof(QRgb));
|
||||
}
|
||||
@ -426,7 +426,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
|
||||
unsigned char *dest_data = backingstore.bits();
|
||||
for (int ln=0; ln<h; ln++) {
|
||||
memcpy(FAST_SCAN_LINE(dest_data, dest_bpl, ln),
|
||||
FAST_SCAN_LINE(bits, bpl, t+ln) + l, w*sizeof(QRgb));
|
||||
FAST_SCAN_LINE(bits, bpl, t+ln) + l*sizeof(QRgb), w*sizeof(QRgb));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include <qbuffer.h>
|
||||
#include <qdebug.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <qvarlengtharray.h>
|
||||
#include <stdlib.h>
|
||||
#include <qabstracteventdispatcher.h>
|
||||
|
@ -216,8 +216,13 @@ NSOpenGLPixelFormat *QCocoaGLContext::pixelFormatForSurfaceFormat(const QSurface
|
||||
<< NSOpenGLPFASamples << NSOpenGLPixelFormatAttribute(format.samples());
|
||||
}
|
||||
|
||||
// Allow rendering on GPUs without a connected display
|
||||
attrs << NSOpenGLPFAAllowOfflineRenderers;
|
||||
//Workaround for problems with Chromium and offline renderers on the lat 2013 MacPros.
|
||||
//FIXME: Think if this could be solved via QSurfaceFormat in the future.
|
||||
static bool offlineRenderersAllowed = qEnvironmentVariableIsEmpty("QT_MAC_PRO_WEBENGINE_WORKAROUND");
|
||||
if (offlineRenderersAllowed) {
|
||||
// Allow rendering on GPUs without a connected display
|
||||
attrs << NSOpenGLPFAAllowOfflineRenderers;
|
||||
}
|
||||
|
||||
// FIXME: Pull this information out of the NSView
|
||||
QByteArray useLayer = qgetenv("QT_MAC_WANTS_LAYER");
|
||||
|
@ -52,6 +52,7 @@
|
||||
//
|
||||
#include "qt_mac_p.h"
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <QtCore/qoperatingsystemversion.h>
|
||||
#include <QtGui/qpalette.h>
|
||||
#include <QtGui/qscreen.h>
|
||||
|
||||
@ -60,6 +61,8 @@
|
||||
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSView));
|
||||
|
||||
struct mach_header;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcQpaWindow)
|
||||
@ -173,6 +176,34 @@ T qt_mac_resolveOption(const T &fallback, QWindow *window, const QByteArray &pro
|
||||
return fallback;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
#if !defined(Q_PROCESSOR_X86_64)
|
||||
#error "32-bit builds are not supported"
|
||||
#endif
|
||||
|
||||
class QMacVersion
|
||||
{
|
||||
public:
|
||||
enum VersionTarget {
|
||||
ApplicationBinary,
|
||||
QtLibraries
|
||||
};
|
||||
|
||||
static QOperatingSystemVersion buildSDK(VersionTarget target = ApplicationBinary);
|
||||
static QOperatingSystemVersion deploymentTarget(VersionTarget target = ApplicationBinary);
|
||||
static QOperatingSystemVersion currentRuntime();
|
||||
|
||||
private:
|
||||
QMacVersion() = default;
|
||||
using VersionTuple = QPair<QOperatingSystemVersion, QOperatingSystemVersion>;
|
||||
static VersionTuple versionsForImage(const mach_header *machHeader);
|
||||
static VersionTuple applicationVersion();
|
||||
static VersionTuple libraryVersion();
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
// @compatibility_alias doesn't work with protocols
|
||||
|
@ -55,6 +55,9 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <mach-o/dyld.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window");
|
||||
@ -368,6 +371,85 @@ QString qt_mac_removeAmpersandEscapes(QString s)
|
||||
return QPlatformTheme::removeMnemonics(s).trimmed();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
#if !defined(Q_PROCESSOR_X86_64)
|
||||
#error "32-bit builds are not supported"
|
||||
#endif
|
||||
|
||||
QOperatingSystemVersion QMacVersion::buildSDK(VersionTarget target)
|
||||
{
|
||||
switch (target) {
|
||||
case ApplicationBinary: return applicationVersion().second;
|
||||
case QtLibraries: return libraryVersion().second;
|
||||
}
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
QOperatingSystemVersion QMacVersion::deploymentTarget(VersionTarget target)
|
||||
{
|
||||
switch (target) {
|
||||
case ApplicationBinary: return applicationVersion().first;
|
||||
case QtLibraries: return libraryVersion().first;
|
||||
}
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
QOperatingSystemVersion QMacVersion::currentRuntime()
|
||||
{
|
||||
return QOperatingSystemVersion::current();
|
||||
}
|
||||
|
||||
QMacVersion::VersionTuple QMacVersion::versionsForImage(const mach_header *machHeader)
|
||||
{
|
||||
auto commandCursor = uintptr_t(machHeader) + sizeof(mach_header_64);
|
||||
for (uint32_t i = 0; i < machHeader->ncmds; ++i) {
|
||||
load_command *loadCommand = reinterpret_cast<load_command *>(commandCursor);
|
||||
if (loadCommand->cmd == LC_VERSION_MIN_MACOSX) {
|
||||
auto versionCommand = reinterpret_cast<version_min_command *>(loadCommand);
|
||||
uint32_t dt = versionCommand->version; // Deployment target
|
||||
uint32_t sdk = versionCommand->sdk; // Build SDK
|
||||
return qMakePair(
|
||||
QOperatingSystemVersion(QOperatingSystemVersion::MacOS,
|
||||
dt >> 16 & 0xffff, dt >> 8 & 0xff, dt & 0xff),
|
||||
QOperatingSystemVersion(QOperatingSystemVersion::MacOS,
|
||||
sdk >> 16 & 0xffff, sdk >> 8 & 0xff, sdk & 0xff)
|
||||
);
|
||||
}
|
||||
commandCursor += loadCommand->cmdsize;
|
||||
}
|
||||
Q_ASSERT_X(false, "QCocoaIntegration", "Could not find version-min load command");
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
QMacVersion::VersionTuple QMacVersion::applicationVersion()
|
||||
{
|
||||
static VersionTuple version = []() {
|
||||
const mach_header *executableHeader = nullptr;
|
||||
for (uint32_t i = 0; i < _dyld_image_count(); ++i) {
|
||||
auto header = _dyld_get_image_header(i);
|
||||
if (header->filetype == MH_EXECUTE) {
|
||||
executableHeader = header;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Q_ASSERT_X(executableHeader, "QCocoaIntegration", "Failed to resolve Mach-O header of executable");
|
||||
return versionsForImage(executableHeader);
|
||||
}();
|
||||
return version;
|
||||
}
|
||||
|
||||
QMacVersion::VersionTuple QMacVersion::libraryVersion()
|
||||
{
|
||||
static VersionTuple version = []() {
|
||||
Dl_info cocoaPluginImage;
|
||||
dladdr((const void *)&QMacVersion::libraryVersion, &cocoaPluginImage);
|
||||
Q_ASSERT_X(cocoaPluginImage.dli_fbase, "QCocoaIntegration", "Failed to resolve Mach-O header of Cocoa plugin");
|
||||
return versionsForImage(static_cast<mach_header*>(cocoaPluginImage.dli_fbase));
|
||||
}();
|
||||
return version;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
/*! \internal
|
||||
|
@ -79,6 +79,32 @@ static void initResources()
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQpa, "qt.qpa", QtWarningMsg);
|
||||
|
||||
static void logVersionInformation()
|
||||
{
|
||||
if (!lcQpa().isInfoEnabled())
|
||||
return;
|
||||
|
||||
auto osVersion = QMacVersion::currentRuntime();
|
||||
auto qtBuildSDK = QMacVersion::buildSDK(QMacVersion::QtLibraries);
|
||||
auto qtDeploymentTarget = QMacVersion::deploymentTarget(QMacVersion::QtLibraries);
|
||||
auto appBuildSDK = QMacVersion::buildSDK(QMacVersion::ApplicationBinary);
|
||||
auto appDeploymentTarget = QMacVersion::deploymentTarget(QMacVersion::ApplicationBinary);
|
||||
|
||||
qCInfo(lcQpa, "Loading macOS (Cocoa) platform plugin for Qt " QT_VERSION_STR ", running on macOS %d.%d.%d\n\n" \
|
||||
" Component SDK version Deployment target \n" \
|
||||
" ------------- ------------- -------------------\n" \
|
||||
" Qt " QT_VERSION_STR " %d.%d.%d %d.%d.%d\n" \
|
||||
" Application %d.%d.%d %d.%d.%d\n",
|
||||
osVersion.majorVersion(), osVersion.minorVersion(), osVersion.microVersion(),
|
||||
qtBuildSDK.majorVersion(), qtBuildSDK.minorVersion(), qtBuildSDK.microVersion(),
|
||||
qtDeploymentTarget.majorVersion(), qtDeploymentTarget.minorVersion(), qtDeploymentTarget.microVersion(),
|
||||
appBuildSDK.majorVersion(), appBuildSDK.minorVersion(), appBuildSDK.microVersion(),
|
||||
appDeploymentTarget.majorVersion(), appDeploymentTarget.minorVersion(), appDeploymentTarget.microVersion());
|
||||
}
|
||||
|
||||
|
||||
class QCoreTextFontEngine;
|
||||
class QFontEngineFT;
|
||||
|
||||
@ -112,6 +138,8 @@ QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList)
|
||||
, mServices(new QCocoaServices)
|
||||
, mKeyboardMapper(new QCocoaKeyMapper)
|
||||
{
|
||||
logVersionInformation();
|
||||
|
||||
if (mInstance)
|
||||
qWarning("Creating multiple Cocoa platform integrations is not supported");
|
||||
mInstance = this;
|
||||
|
@ -542,6 +542,12 @@ void QCocoaWindow::setWindowZoomButton(Qt::WindowFlags flags)
|
||||
|
||||
void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
|
||||
{
|
||||
// Updating the window flags may affect the window's theme frame, which
|
||||
// in the process retains and then autoreleases the NSWindow. To make
|
||||
// sure this doesn't leave lingering releases when there is no pool in
|
||||
// place (e.g. during main(), before exec), we add one locally here.
|
||||
QMacAutoReleasePool pool;
|
||||
|
||||
if (!isContentView())
|
||||
return;
|
||||
|
||||
@ -1373,11 +1379,14 @@ void QCocoaWindow::recreateWindowIfNeeded()
|
||||
if (m_windowModality != window()->modality())
|
||||
recreateReason |= WindowModalityChanged;
|
||||
|
||||
const bool shouldBeContentView = !parentWindow && !isEmbeddedView;
|
||||
Qt::WindowType type = window()->type();
|
||||
|
||||
const bool shouldBeContentView = !parentWindow
|
||||
&& !((type & Qt::SubWindow) == Qt::SubWindow)
|
||||
&& !isEmbeddedView;
|
||||
if (isContentView() != shouldBeContentView)
|
||||
recreateReason |= ContentViewChanged;
|
||||
|
||||
Qt::WindowType type = window()->type();
|
||||
const bool isPanel = isContentView() && [m_view.window isKindOfClass:[QNSPanel class]];
|
||||
const bool shouldBePanel = shouldBeContentView &&
|
||||
((type & Qt::Popup) == Qt::Popup || (type & Qt::Dialog) == Qt::Dialog);
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include <private/qpaintengine_raster_p.h>
|
||||
#include <qprinter.h>
|
||||
#include <qstack.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <qwidget.h>
|
||||
#include <qvarlengtharray.h>
|
||||
#include <qdebug.h>
|
||||
|
@ -71,6 +71,7 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen)
|
||||
, m_bo(nullptr)
|
||||
, m_cursorImage(0, 0, 0, 0, 0, 0)
|
||||
, m_state(CursorPendingVisible)
|
||||
, m_deviceListener(nullptr)
|
||||
{
|
||||
QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR");
|
||||
if (!hideCursorVal.isEmpty() && hideCursorVal.toInt()) {
|
||||
|
@ -312,7 +312,7 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
|
||||
case AllGLFunctionsQueryable:
|
||||
return true;
|
||||
case SwitchableWidgetComposition:
|
||||
return true;
|
||||
return false; // QTBUG-68329 QTBUG-53515 QTBUG-54734
|
||||
default:
|
||||
return QPlatformIntegration::hasCapability(cap);
|
||||
}
|
||||
|
@ -51,6 +51,7 @@
|
||||
#undef register
|
||||
#include <GL/glx.h>
|
||||
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include <QtGui/QOpenGLContext>
|
||||
#include <QtGui/QOffscreenSurface>
|
||||
|
||||
@ -692,32 +693,6 @@ static const char *qglx_threadedgl_blacklist_renderer[] = {
|
||||
0
|
||||
};
|
||||
|
||||
// This disables threaded rendering on anything using mesa, e.g.
|
||||
// - nvidia/nouveau
|
||||
// - amd/gallium
|
||||
// - intel
|
||||
// - some software opengl implementations
|
||||
//
|
||||
// The client glx vendor string is used to identify those setups as that seems to show the least
|
||||
// variance between the bad configurations. It's always "Mesa Project and SGI". There are some
|
||||
// configurations which don't use mesa and which can do threaded rendering (amd and nvidia chips
|
||||
// with their own proprietary drivers).
|
||||
//
|
||||
// This, of course, is very broad and disables threaded rendering on a lot of devices which would
|
||||
// be able to use it. However, the bugs listed below don't follow any easily recognizable pattern
|
||||
// and we should rather be safe.
|
||||
//
|
||||
// http://cgit.freedesktop.org/xcb/libxcb/commit/?id=be0fe56c3bcad5124dcc6c47a2fad01acd16f71a will
|
||||
// fix some of the issues. Basically, the proprietary drivers seem to have a way of working around
|
||||
// a fundamental flaw with multithreaded access to xcb, but mesa doesn't. The blacklist should be
|
||||
// reevaluated once that patch is released in some version of xcb.
|
||||
static const char *qglx_threadedgl_blacklist_vendor[] = {
|
||||
"Mesa Project and SGI", // QTCREATORBUG-10875 (crash in creator)
|
||||
// QTBUG-34492 (flickering in fullscreen)
|
||||
// QTBUG-38221
|
||||
0
|
||||
};
|
||||
|
||||
void QGLXContext::queryDummyContext()
|
||||
{
|
||||
if (m_queriedDummyContext)
|
||||
@ -777,18 +752,33 @@ void QGLXContext::queryDummyContext()
|
||||
}
|
||||
}
|
||||
|
||||
if (glxvendor) {
|
||||
for (int i = 0; qglx_threadedgl_blacklist_vendor[i]; ++i) {
|
||||
if (strstr(glxvendor, qglx_threadedgl_blacklist_vendor[i]) != 0) {
|
||||
qCDebug(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: "
|
||||
"blacklisted vendor \""
|
||||
<< qglx_threadedgl_blacklist_vendor[i]
|
||||
<< "\"";
|
||||
if (glxvendor && m_supportsThreading) {
|
||||
// Blacklist Mesa drivers due to QTCREATORBUG-10875 (crash in creator),
|
||||
// QTBUG-34492 (flickering in fullscreen) and QTBUG-38221
|
||||
const char *mesaVersionStr = nullptr;
|
||||
if (strstr(glxvendor, "Mesa Project") != 0) {
|
||||
mesaVersionStr = (const char *) glGetString(GL_VERSION);
|
||||
m_supportsThreading = false;
|
||||
}
|
||||
|
||||
m_supportsThreading = false;
|
||||
break;
|
||||
if (mesaVersionStr) {
|
||||
// The issue was fixed in Xcb 1.11, but we can't check for that
|
||||
// at runtime, so instead assume it fixed with recent Mesa versions
|
||||
// released several years after the Xcb fix.
|
||||
QRegularExpression versionTest(QStringLiteral("Mesa (\\d+)"));
|
||||
QRegularExpressionMatch result = versionTest.match(QString::fromLatin1(mesaVersionStr));
|
||||
int versionNr = 0;
|
||||
if (result.hasMatch())
|
||||
versionNr = result.captured(1).toInt();
|
||||
if (versionNr >= 17) {
|
||||
// White-listed
|
||||
m_supportsThreading = true;
|
||||
}
|
||||
}
|
||||
if (!m_supportsThreading) {
|
||||
qCDebug(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: "
|
||||
"blacklisted vendor \"Mesa Project\"";
|
||||
}
|
||||
}
|
||||
|
||||
context.doneCurrent();
|
||||
|
@ -255,6 +255,7 @@ static const uint8_t * const cursor_bits20[] = {
|
||||
forbidden_bits, forbiddenm_bits
|
||||
};
|
||||
|
||||
// ### FIXME This mapping is incomplete - QTBUG-71423
|
||||
static const std::vector<const char *> cursorNames[] = {
|
||||
{ "left_ptr", "default", "top_left_arrow", "left_arrow" },
|
||||
{ "up_arrow" },
|
||||
@ -273,7 +274,7 @@ static const std::vector<const char *> cursorNames[] = {
|
||||
{ "forbidden", "not-allowed", "crossed_circle", "circle", "03b6e0fcb3499374a867c041f52298f0" },
|
||||
{ "whats_this", "help", "question_arrow", "5c6cd98b3f3ebcb1f9c7f1c204630408", "d9ce0ab605698f320427677b458ad60b" },
|
||||
{ "left_ptr_watch", "half-busy", "progress", "00000000000000020006000e7e9ffc3f", "08e8e1c95fe2fc01f976f1e063a24ccd" },
|
||||
{ "openhand", "fleur", "5aca4d189052212118709018842178c0", "9d800788f1b08800ae810202380a0822" },
|
||||
{ "openhand", "grab", "fleur", "5aca4d189052212118709018842178c0", "9d800788f1b08800ae810202380a0822" },
|
||||
{ "closedhand", "grabbing", "208530c400c041818281048008011002" },
|
||||
{ "dnd-copy", "copy" },
|
||||
{ "dnd-move", "move" },
|
||||
|
@ -168,7 +168,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
|
||||
if (!encoding.isEmpty()
|
||||
&& atomName == format + QLatin1String(";charset=") + QLatin1String(encoding)) {
|
||||
|
||||
#ifndef QT_NO_TEXTCODEC
|
||||
#if QT_CONFIG(textcodec)
|
||||
if (requestedType == QVariant::String) {
|
||||
QTextCodec *codec = QTextCodec::codecForName(encoding);
|
||||
if (codec)
|
||||
|
@ -112,13 +112,6 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t
|
||||
|
||||
xcb_depth_next(&depth_iterator);
|
||||
}
|
||||
|
||||
if (connection->hasXRandr()) {
|
||||
xcb_connection_t *conn = connection->xcb_connection();
|
||||
auto screen_info = Q_XCB_REPLY(xcb_randr_get_screen_info, conn, screen->root);
|
||||
if (screen_info)
|
||||
m_rotation = screen_info->rotation;
|
||||
}
|
||||
}
|
||||
|
||||
QXcbVirtualDesktop::~QXcbVirtualDesktop()
|
||||
|