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();
|
m_blitter.create();
|
||||||
|
|
||||||
int new_pbuf_size = m_pbuffer_size;
|
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;
|
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;
|
new_pbuf_size /= 2;
|
||||||
|
|
||||||
if (!m_fbo || new_pbuf_size != m_pbuffer_size) {
|
if (!m_fbo || new_pbuf_size != m_pbuffer_size) {
|
||||||
@ -372,6 +372,9 @@ void CompositionRenderer::paint(QPainter *painter)
|
|||||||
if (size() != m_previous_size) {
|
if (size() != m_previous_size) {
|
||||||
m_previous_size = size();
|
m_previous_size = size();
|
||||||
QPainter p(m_fbo.data());
|
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);
|
drawBase(p);
|
||||||
p.end();
|
p.end();
|
||||||
m_base_tex = m_fbo->takeTexture();
|
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_MACOSX_DEPLOYMENT_TARGET = 10.12
|
||||||
QMAKE_APPLE_DEVICE_ARCHS = x86_64
|
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.sdk = macosx
|
||||||
device.target = device
|
device.target = device
|
||||||
|
@ -24,5 +24,9 @@ QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy
|
|||||||
QMAKE_NM = $${CROSS_COMPILE}nm -P
|
QMAKE_NM = $${CROSS_COMPILE}nm -P
|
||||||
QMAKE_STRIP = $${CROSS_COMPILE}strip
|
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): \
|
contains(DISTRO_OPTS, deb-multi-arch): \
|
||||||
QMAKE_PKG_CONFIG = $${CROSS_COMPILE}pkg-config
|
QMAKE_PKG_CONFIG = $${CROSS_COMPILE}pkg-config
|
||||||
|
@ -3,25 +3,28 @@ load(default_post)
|
|||||||
contains(TEMPLATE, .*app) {
|
contains(TEMPLATE, .*app) {
|
||||||
!macx-xcode {
|
!macx-xcode {
|
||||||
# Detect changes to the platform SDK
|
# 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)
|
QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/sdk.mk)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect incompatible SDK versions
|
# Detect incompatible SDK versions
|
||||||
|
|
||||||
!versionAtLeast(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION): \
|
isEmpty(QT_MAC_SDK_VERSION_MIN): \
|
||||||
warning("Qt requires at least version $$QT_MAC_SDK_VERSION of the platform SDK," \
|
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.")
|
"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
|
# For Qt developers only
|
||||||
!isEmpty($$list($$(QT_MAC_SDK_NO_VERSION_CHECK))): \
|
!isEmpty($$list($$(QT_MAC_SDK_NO_VERSION_CHECK))): \
|
||||||
CONFIG += 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)
|
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) {
|
!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_TESTED_WITH"\
|
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}.")
|
"of the platform SDK, you're using $${QMAKE_MAC_SDK_MAJOR_MINOR_VERSION}.")
|
||||||
warning("This is an unsupported configuration. You may experience build issues," \
|
warning("This is an unsupported configuration. You may experience build issues," \
|
||||||
"and by using")
|
"and by using")
|
||||||
@ -29,7 +32,7 @@ contains(TEMPLATE, .*app) {
|
|||||||
"that Qt has not been prepared for.")
|
"that Qt has not been prepared for.")
|
||||||
|
|
||||||
warning("Please downgrade the SDK you use to build your app to version" \
|
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" \
|
warning("with CONFIG+=sdk_no_version_check when running qmake" \
|
||||||
"to silence this warning.")
|
"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))
|
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).)
|
$(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)
|
#qt code (please keep in order matching DEPEND_SRC)
|
||||||
QOBJS = \
|
QOBJS = \
|
||||||
qtextcodec.o qutfcodec.o \
|
qutfcodec.o \
|
||||||
qendian.o qglobal.o qlogging.o qmalloc.o qnumeric.o qoperatingsystemversion.o qrandom.o \
|
qendian.o qglobal.o qlogging.o qmalloc.o qnumeric.o qoperatingsystemversion.o qrandom.o \
|
||||||
qabstractfileengine.o qbuffer.o qdatastream.o qdebug.o \
|
qabstractfileengine.o qbuffer.o qdatastream.o qdebug.o \
|
||||||
qdir.o qdiriterator.o \
|
qdir.o qdiriterator.o \
|
||||||
@ -66,7 +66,6 @@ DEPEND_SRC = \
|
|||||||
$(QMKGENSRC)/win32/msvc_vcxproj.cpp \
|
$(QMKGENSRC)/win32/msvc_vcxproj.cpp \
|
||||||
$(QMKGENSRC)/win32/winmakefile.cpp \
|
$(QMKGENSRC)/win32/winmakefile.cpp \
|
||||||
$(QMKGENSRC)/xmloutput.cpp \
|
$(QMKGENSRC)/xmloutput.cpp \
|
||||||
$(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp \
|
|
||||||
$(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \
|
$(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \
|
||||||
$(SOURCE_PATH)/src/corelib/global/qendian.cpp \
|
$(SOURCE_PATH)/src/corelib/global/qendian.cpp \
|
||||||
$(SOURCE_PATH)/src/corelib/global/qglobal.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
|
qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
|
||||||
$(CXX) -c -o $@ $(CXXFLAGS) $<
|
$(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
|
qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp
|
||||||
$(CXX) -c -o $@ $(CXXFLAGS) $<
|
$(CXX) -c -o $@ $(CXXFLAGS) $<
|
||||||
|
|
||||||
|
@ -100,7 +100,6 @@ QTOBJS= \
|
|||||||
qoperatingsystemversion.obj \
|
qoperatingsystemversion.obj \
|
||||||
qoperatingsystemversion_win.obj \
|
qoperatingsystemversion_win.obj \
|
||||||
qregexp.obj \
|
qregexp.obj \
|
||||||
qtextcodec.obj \
|
|
||||||
qutfcodec.obj \
|
qutfcodec.obj \
|
||||||
qstring.obj \
|
qstring.obj \
|
||||||
qstring_compat.obj \
|
qstring_compat.obj \
|
||||||
|
@ -3038,6 +3038,7 @@
|
|||||||
|
|
||||||
\snippet code/doc_src_qmake-manual.pro 59
|
\snippet code/doc_src_qmake-manual.pro 59
|
||||||
|
|
||||||
|
\target qmake-cat
|
||||||
\section2 cat(filename[, mode])
|
\section2 cat(filename[, mode])
|
||||||
|
|
||||||
Returns the contents of \c filename. You can specify the following options
|
Returns the contents of \c filename. You can specify the following options
|
||||||
@ -3404,6 +3405,10 @@
|
|||||||
|
|
||||||
\snippet code/doc_src_qmake-manual.pro 72
|
\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
|
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
|
variable. If the command crashes, the status will be -1, otherwise a
|
||||||
non-negative exit code of the command's choosing. Usually, comparing
|
non-negative exit code of the command's choosing. Usually, comparing
|
||||||
|
@ -208,6 +208,16 @@ struct VcsolutionDepend {
|
|||||||
QStringList dependencies;
|
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)
|
QUuid VcprojGenerator::getProjectUUID(const QString &filename)
|
||||||
{
|
{
|
||||||
bool validUUID = true;
|
bool validUUID = true;
|
||||||
@ -239,6 +249,10 @@ QUuid VcprojGenerator::getProjectUUID(const QString &filename)
|
|||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
|
||||||
|
# pragma optimize( "g", on )
|
||||||
|
#endif
|
||||||
|
|
||||||
QUuid VcprojGenerator::increaseUUID(const QUuid &id)
|
QUuid VcprojGenerator::increaseUUID(const QUuid &id)
|
||||||
{
|
{
|
||||||
QUuid result(id);
|
QUuid result(id);
|
||||||
|
@ -35,7 +35,7 @@ using namespace QMakeInternal;
|
|||||||
#include <qfile.h>
|
#include <qfile.h>
|
||||||
#include <qfileinfo.h>
|
#include <qfileinfo.h>
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ QMakeVfs::QMakeVfs()
|
|||||||
, m_magicExisting(fL1S("existing"))
|
, m_magicExisting(fL1S("existing"))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
m_textCodec = 0;
|
m_textCodec = 0;
|
||||||
#endif
|
#endif
|
||||||
ref();
|
ref();
|
||||||
@ -236,7 +236,7 @@ QMakeVfs::ReadResult QMakeVfs::readFile(int id, QString *contents, QString *errS
|
|||||||
return ReadOtherError;
|
return ReadOtherError;
|
||||||
}
|
}
|
||||||
*contents =
|
*contents =
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
m_textCodec ? m_textCodec->toUnicode(bcont) :
|
m_textCodec ? m_textCodec->toUnicode(bcont) :
|
||||||
#endif
|
#endif
|
||||||
QString::fromLocal8Bit(bcont);
|
QString::fromLocal8Bit(bcont);
|
||||||
@ -290,7 +290,7 @@ void QMakeVfs::invalidateContents()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
void QMakeVfs::setTextCodec(const QTextCodec *textCodec)
|
void QMakeVfs::setTextCodec(const QTextCodec *textCodec)
|
||||||
{
|
{
|
||||||
m_textCodec = textCodec;
|
m_textCodec = textCodec;
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
# include <qmutex.h>
|
# include <qmutex.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
QT_FORWARD_DECLARE_CLASS(QTextCodec)
|
QT_FORWARD_DECLARE_CLASS(QTextCodec)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ public:
|
|||||||
void invalidateContents();
|
void invalidateContents();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
void setTextCodec(const QTextCodec *textCodec);
|
void setTextCodec(const QTextCodec *textCodec);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ private:
|
|||||||
QString m_magicMissing;
|
QString m_magicMissing;
|
||||||
QString m_magicExisting;
|
QString m_magicExisting;
|
||||||
#endif
|
#endif
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
const QTextCodec *m_textCodec;
|
const QTextCodec *m_textCodec;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -152,7 +152,6 @@ SOURCES += \
|
|||||||
qstringlist.cpp \
|
qstringlist.cpp \
|
||||||
qsystemerror.cpp \
|
qsystemerror.cpp \
|
||||||
qtemporaryfile.cpp \
|
qtemporaryfile.cpp \
|
||||||
qtextcodec.cpp \
|
|
||||||
qtextstream.cpp \
|
qtextstream.cpp \
|
||||||
qutfcodec.cpp \
|
qutfcodec.cpp \
|
||||||
quuid.cpp \
|
quuid.cpp \
|
||||||
@ -204,7 +203,6 @@ HEADERS += \
|
|||||||
qstringmatcher.h \
|
qstringmatcher.h \
|
||||||
qsystemerror_p.h \
|
qsystemerror_p.h \
|
||||||
qtemporaryfile.h \
|
qtemporaryfile.h \
|
||||||
qtextcodec.h \
|
|
||||||
qtextstream.h \
|
qtextstream.h \
|
||||||
qutfcodec.h \
|
qutfcodec.h \
|
||||||
quuid.h \
|
quuid.h \
|
||||||
|
@ -17,7 +17,7 @@ repositories {
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
@ -1,19 +1,24 @@
|
|||||||
# Qt core library codecs module
|
# Qt core library codecs module
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
codecs/qlatincodec_p.h \
|
|
||||||
codecs/qsimplecodec_p.h \
|
|
||||||
codecs/qtextcodec_p.h \
|
codecs/qtextcodec_p.h \
|
||||||
codecs/qtextcodec.h \
|
|
||||||
codecs/qutfcodec_p.h
|
codecs/qutfcodec_p.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
codecs/qlatincodec.cpp \
|
|
||||||
codecs/qsimplecodec.cpp \
|
|
||||||
codecs/qtextcodec.cpp \
|
|
||||||
codecs/qutfcodec.cpp
|
codecs/qutfcodec.cpp
|
||||||
|
|
||||||
qtConfig(codecs) {
|
qtConfig(textcodec) {
|
||||||
|
HEADERS += \
|
||||||
|
codecs/qlatincodec_p.h \
|
||||||
|
codecs/qsimplecodec_p.h \
|
||||||
|
codecs/qtextcodec.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
codecs/qlatincodec.cpp \
|
||||||
|
codecs/qsimplecodec.cpp \
|
||||||
|
codecs/qtextcodec.cpp
|
||||||
|
|
||||||
|
qtConfig(codecs) {
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
codecs/qisciicodec_p.h \
|
codecs/qisciicodec_p.h \
|
||||||
codecs/qtsciicodec_p.h
|
codecs/qtsciicodec_p.h
|
||||||
@ -21,14 +26,14 @@ qtConfig(codecs) {
|
|||||||
SOURCES += \
|
SOURCES += \
|
||||||
codecs/qisciicodec.cpp \
|
codecs/qisciicodec.cpp \
|
||||||
codecs/qtsciicodec.cpp
|
codecs/qtsciicodec.cpp
|
||||||
}
|
}
|
||||||
|
|
||||||
qtConfig(icu) {
|
qtConfig(icu) {
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
codecs/qicucodec_p.h
|
codecs/qicucodec_p.h
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
codecs/qicucodec.cpp
|
codecs/qicucodec.cpp
|
||||||
} else {
|
} else {
|
||||||
qtConfig(big_codecs) {
|
qtConfig(big_codecs) {
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
codecs/qgb18030codec_p.h \
|
codecs/qgb18030codec_p.h \
|
||||||
@ -59,4 +64,5 @@ qtConfig(icu) {
|
|||||||
SOURCES += codecs/qwindowscodec.cpp
|
SOURCES += codecs/qwindowscodec.cpp
|
||||||
HEADERS += codecs/qwindowscodec_p.h
|
HEADERS += codecs/qwindowscodec_p.h
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,6 @@
|
|||||||
|
|
||||||
#include <QtCore/private/qglobal_p.h>
|
#include <QtCore/private/qglobal_p.h>
|
||||||
|
|
||||||
QT_REQUIRE_CONFIG(iconv);
|
|
||||||
|
|
||||||
#include "qiconvcodec_p.h"
|
#include "qiconvcodec_p.h"
|
||||||
#include "qtextcodec_p.h"
|
#include "qtextcodec_p.h"
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
|
@ -39,8 +39,6 @@
|
|||||||
|
|
||||||
#include "qicucodec_p.h"
|
#include "qicucodec_p.h"
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
|
||||||
|
|
||||||
#include "qtextcodec_p.h"
|
#include "qtextcodec_p.h"
|
||||||
#include "qutfcodec_p.h"
|
#include "qutfcodec_p.h"
|
||||||
#include "qlatincodec_p.h"
|
#include "qlatincodec_p.h"
|
||||||
@ -698,5 +696,3 @@ int QIcuCodec::mibEnum() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QT_NO_TEXTCODEC
|
|
||||||
|
@ -59,9 +59,9 @@ extern "C" {
|
|||||||
typedef struct UConverter UConverter;
|
typedef struct UConverter UConverter;
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_REQUIRE_CONFIG(textcodec);
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QIcuCodec : public QTextCodec
|
class QIcuCodec : public QTextCodec
|
||||||
{
|
{
|
||||||
@ -90,8 +90,6 @@ private:
|
|||||||
const char *m_name;
|
const char *m_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_NO_TEXTCODEC
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,8 +40,6 @@
|
|||||||
#include "qlatincodec_p.h"
|
#include "qlatincodec_p.h"
|
||||||
#include "qlist.h"
|
#include "qlist.h"
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QLatin1Codec::~QLatin1Codec()
|
QLatin1Codec::~QLatin1Codec()
|
||||||
@ -238,5 +236,3 @@ int QLatin15Codec::mibEnum() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QT_NO_TEXTCODEC
|
|
||||||
|
@ -54,9 +54,9 @@
|
|||||||
#include <QtCore/private/qglobal_p.h>
|
#include <QtCore/private/qglobal_p.h>
|
||||||
#include "QtCore/qtextcodec.h"
|
#include "QtCore/qtextcodec.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_REQUIRE_CONFIG(textcodec);
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QLatin1Codec : public QTextCodec
|
class QLatin1Codec : public QTextCodec
|
||||||
{
|
{
|
||||||
@ -86,8 +86,6 @@ public:
|
|||||||
int mibEnum() const override;
|
int mibEnum() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_NO_TEXTCODEC
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QLATINCODEC_P_H
|
#endif // QLATINCODEC_P_H
|
||||||
|
@ -40,8 +40,6 @@
|
|||||||
#include "qsimplecodec_p.h"
|
#include "qsimplecodec_p.h"
|
||||||
#include "qlist.h"
|
#include "qlist.h"
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#define LAST_MIB 2004
|
#define LAST_MIB 2004
|
||||||
@ -724,5 +722,3 @@ int QSimpleTextCodec::mibEnum() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QT_NO_TEXTCODEC
|
|
||||||
|
@ -54,9 +54,9 @@
|
|||||||
#include <QtCore/private/qglobal_p.h>
|
#include <QtCore/private/qglobal_p.h>
|
||||||
#include "QtCore/qtextcodec.h"
|
#include "QtCore/qtextcodec.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_REQUIRE_CONFIG(textcodec);
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
template <typename T> class QAtomicPointer;
|
template <typename T> class QAtomicPointer;
|
||||||
|
|
||||||
@ -79,8 +79,6 @@ private:
|
|||||||
mutable QAtomicPointer<QByteArray> reverseMap;
|
mutable QAtomicPointer<QByteArray> reverseMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_NO_TEXTCODEC
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QSIMPLECODEC_P_H
|
#endif // QSIMPLECODEC_P_H
|
||||||
|
@ -39,14 +39,14 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qplatformdefs.h"
|
#include "qplatformdefs.h"
|
||||||
|
|
||||||
#include "qtextcodec.h"
|
#include "qtextcodec.h"
|
||||||
#include "qtextcodec_p.h"
|
#include "qtextcodec_p.h"
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
|
||||||
|
|
||||||
#include "qbytearraymatcher.h"
|
#include "qbytearraymatcher.h"
|
||||||
#include "qlist.h"
|
#include "qendian.h"
|
||||||
#include "qfile.h"
|
#include "qfile.h"
|
||||||
|
#include "qlist.h"
|
||||||
#include "qstringlist.h"
|
#include "qstringlist.h"
|
||||||
#include "qvarlengtharray.h"
|
#include "qvarlengtharray.h"
|
||||||
#if !defined(QT_BOOTSTRAPPED)
|
#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
|
Tries to detect the encoding of the provided snippet \a ba by
|
||||||
using the BOM (Byte Order Mark) and returns a QTextCodec instance
|
using the BOM (Byte Order Mark) and returns a QTextCodec instance
|
||||||
that is capable of decoding the text to unicode. If the codec
|
that is capable of decoding the text to unicode. This function can
|
||||||
cannot be detected from the content provided, \a defaultCodec is
|
detect one of the following codecs:
|
||||||
returned.
|
|
||||||
|
\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()
|
\sa codecForHtml()
|
||||||
*/
|
*/
|
||||||
QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba, QTextCodec *defaultCodec)
|
QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba, QTextCodec *defaultCodec)
|
||||||
{
|
{
|
||||||
const int arraySize = ba.size();
|
const int arraySize = ba.size();
|
||||||
|
const uchar *buf = reinterpret_cast<const uchar *>(ba.constData());
|
||||||
|
const uint bom = 0xfeff;
|
||||||
|
|
||||||
if (arraySize > 3) {
|
if (arraySize > 3) {
|
||||||
if ((uchar)ba[0] == 0x00
|
uint uc = qFromUnaligned<uint>(buf);
|
||||||
&& (uchar)ba[1] == 0x00
|
if (uc == qToBigEndian(bom))
|
||||||
&& (uchar)ba[2] == 0xFE
|
|
||||||
&& (uchar)ba[3] == 0xFF)
|
|
||||||
return QTextCodec::codecForMib(1018); // utf-32 be
|
return QTextCodec::codecForMib(1018); // utf-32 be
|
||||||
else if ((uchar)ba[0] == 0xFF
|
else if (uc == qToLittleEndian(bom))
|
||||||
&& (uchar)ba[1] == 0xFE
|
|
||||||
&& (uchar)ba[2] == 0x00
|
|
||||||
&& (uchar)ba[3] == 0x00)
|
|
||||||
return QTextCodec::codecForMib(1019); // utf-32 le
|
return QTextCodec::codecForMib(1019); // utf-32 le
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arraySize < 2)
|
if (arraySize < 2)
|
||||||
return defaultCodec;
|
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
|
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
|
return QTextCodec::codecForMib(1014); // utf16 le
|
||||||
|
|
||||||
if (arraySize < 3)
|
if (arraySize < 3)
|
||||||
return defaultCodec;
|
return defaultCodec;
|
||||||
if ((uchar)ba[0] == 0xef
|
|
||||||
&& (uchar)ba[1] == 0xbb
|
static const char utf8bom[] = "\xef\xbb\xbf";
|
||||||
&& (uchar)ba[2] == 0xbf)
|
if (memcmp(buf, utf8bom, sizeof(utf8bom) - 1) == 0)
|
||||||
return QTextCodec::codecForMib(106); // utf-8
|
return QTextCodec::codecForMib(106); // utf-8
|
||||||
|
|
||||||
return defaultCodec;
|
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
|
Tries to detect the encoding of the provided snippet \a ba by
|
||||||
using the BOM (Byte Order Mark) and returns a QTextCodec instance
|
using the BOM (Byte Order Mark) and returns a QTextCodec instance
|
||||||
that is capable of decoding the text to unicode. If the codec
|
that is capable of decoding the text to unicode. This function can
|
||||||
cannot be detected, this overload returns a Latin-1 QTextCodec.
|
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()
|
\sa codecForHtml()
|
||||||
*/
|
*/
|
||||||
@ -1253,5 +1273,3 @@ bool QTextDecoder::needsMoreData() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QT_NO_TEXTCODEC
|
|
||||||
|
@ -43,11 +43,10 @@
|
|||||||
#include <QtCore/qstring.h>
|
#include <QtCore/qstring.h>
|
||||||
#include <QtCore/qlist.h>
|
#include <QtCore/qlist.h>
|
||||||
|
|
||||||
|
QT_REQUIRE_CONFIG(textcodec);
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
|
||||||
|
|
||||||
class QTextCodec;
|
class QTextCodec;
|
||||||
class QIODevice;
|
class QIODevice;
|
||||||
|
|
||||||
@ -168,8 +167,6 @@ private:
|
|||||||
QTextCodec::ConverterState state;
|
QTextCodec::ConverterState state;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_NO_TEXTCODEC
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QTEXTCODEC_H
|
#endif // QTEXTCODEC_H
|
||||||
|
@ -52,12 +52,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <QtCore/private/qglobal_p.h>
|
#include <QtCore/private/qglobal_p.h>
|
||||||
#include "qtextcodec.h"
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
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)
|
#if defined(Q_OS_MAC) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) || defined(Q_OS_WASM)
|
||||||
#define QT_LOCALE_IS_UTF8
|
#define QT_LOCALE_IS_UTF8
|
||||||
@ -82,7 +83,7 @@ struct QTextCodecUnalignedPointer
|
|||||||
|
|
||||||
bool qTextCodecNameMatch(const char *a, const char *b);
|
bool qTextCodecNameMatch(const char *a, const char *b);
|
||||||
|
|
||||||
#else
|
#else // without textcodec:
|
||||||
|
|
||||||
class QTextCodec
|
class QTextCodec
|
||||||
{
|
{
|
||||||
@ -109,7 +110,7 @@ public:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //QT_NO_TEXTCODEC
|
#endif // textcodec
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
@ -70,9 +70,14 @@ static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const
|
|||||||
{
|
{
|
||||||
// do sixteen characters at a time
|
// do sixteen characters at a time
|
||||||
for ( ; end - src >= 16; src += 16, dst += 16) {
|
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 data1 = _mm_loadu_si128((const __m128i*)src);
|
||||||
__m128i data2 = _mm_loadu_si128(1+(const __m128i*)src);
|
__m128i data2 = _mm_loadu_si128(1+(const __m128i*)src);
|
||||||
|
# endif
|
||||||
|
|
||||||
// check if everything is ASCII
|
// check if everything is ASCII
|
||||||
// the highest ASCII value is U+007F
|
// 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()
|
QUtf8Codec::~QUtf8Codec()
|
||||||
{
|
{
|
||||||
@ -1121,6 +1126,6 @@ QList<QByteArray> QUtf32LECodec::aliases() const
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //QT_NO_TEXTCODEC
|
#endif // textcodec
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -52,7 +52,13 @@
|
|||||||
// We mean it.
|
// We mean it.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <QtCore/qstring.h>
|
||||||
|
#include <QtCore/qlist.h>
|
||||||
|
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
#include "QtCore/qtextcodec.h"
|
#include "QtCore/qtextcodec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "private/qtextcodec_p.h"
|
#include "private/qtextcodec_p.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -311,7 +317,7 @@ struct QUtf32
|
|||||||
static QByteArray convertFromUnicode(const QChar *, int, QTextCodec::ConverterState *, DataEndianness = DetectEndianness);
|
static QByteArray convertFromUnicode(const QChar *, int, QTextCodec::ConverterState *, DataEndianness = DetectEndianness);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
|
|
||||||
class QUtf8Codec : public QTextCodec {
|
class QUtf8Codec : public QTextCodec {
|
||||||
public:
|
public:
|
||||||
@ -391,7 +397,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // QT_NO_TEXTCODEC
|
#endif // textcodec
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@
|
|||||||
#include <QtCore/private/qglobal_p.h>
|
#include <QtCore/private/qglobal_p.h>
|
||||||
#include "qtextcodec.h"
|
#include "qtextcodec.h"
|
||||||
|
|
||||||
|
QT_REQUIRE_CONFIG(textcodec);
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QWindowsLocalCodec: public QTextCodec
|
class QWindowsLocalCodec: public QTextCodec
|
||||||
|
@ -128,7 +128,6 @@
|
|||||||
#define QT_NO_COMPRESS
|
#define QT_NO_COMPRESS
|
||||||
#define QT_JSON_READONLY
|
#define QT_JSON_READONLY
|
||||||
#define QT_NO_STANDARDPATHS
|
#define QT_NO_STANDARDPATHS
|
||||||
#define QT_NO_TEXTCODEC
|
|
||||||
#define QT_FEATURE_textcodec -1
|
#define QT_FEATURE_textcodec -1
|
||||||
#else
|
#else
|
||||||
#define QT_FEATURE_codecs -1
|
#define QT_FEATURE_codecs -1
|
||||||
|
@ -66,5 +66,7 @@
|
|||||||
#include <qregexp.h>
|
#include <qregexp.h>
|
||||||
#include <qstring.h>
|
#include <qstring.h>
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
#include <qplatformdefs.h>
|
#include <qplatformdefs.h>
|
||||||
#include <qendian.h>
|
#include <qendian.h>
|
||||||
#include "private/qabstractfileengine_p.h"
|
#include "private/qabstractfileengine_p.h"
|
||||||
|
#include "private/qnumeric_p.h"
|
||||||
#include "private/qsimd_p.h"
|
#include "private/qsimd_p.h"
|
||||||
#include "private/qsystemerror_p.h"
|
#include "private/qsystemerror_p.h"
|
||||||
|
|
||||||
@ -1502,7 +1503,9 @@ uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size, QFile::Memory
|
|||||||
{
|
{
|
||||||
Q_Q(QResourceFileEngine);
|
Q_Q(QResourceFileEngine);
|
||||||
Q_UNUSED(flags);
|
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());
|
q->setError(QFile::UnspecifiedError, QString());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
#include "qstandardpaths.h"
|
#include "qstandardpaths.h"
|
||||||
#include <qdatastream.h>
|
#include <qdatastream.h>
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
# include "qtextcodec.h"
|
# include "qtextcodec.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -681,7 +681,7 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
|
|||||||
if (ch <= 0x1F || (ch >= 0x7F && !useCodec)) {
|
if (ch <= 0x1F || (ch >= 0x7F && !useCodec)) {
|
||||||
result += "\\x" + QByteArray::number(ch, 16);
|
result += "\\x" + QByteArray::number(ch, 16);
|
||||||
escapeNextIfDigit = true;
|
escapeNextIfDigit = true;
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
} else if (useCodec) {
|
} else if (useCodec) {
|
||||||
// slow
|
// slow
|
||||||
result += codec->fromUnicode(&unicode[i], 1);
|
result += codec->fromUnicode(&unicode[i], 1);
|
||||||
@ -834,7 +834,7 @@ StNormal:
|
|||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QT_NO_TEXTCODEC
|
#if !QT_CONFIG(textcodec)
|
||||||
Q_UNUSED(codec)
|
Q_UNUSED(codec)
|
||||||
#else
|
#else
|
||||||
if (codec) {
|
if (codec) {
|
||||||
@ -1679,7 +1679,7 @@ bool QConfFileSettingsPrivate::readIniFile(const QByteArray &data,
|
|||||||
int sectionPosition = 0;
|
int sectionPosition = 0;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
// detect utf8 BOM
|
// detect utf8 BOM
|
||||||
const uchar *dd = (const uchar *)data.constData();
|
const uchar *dd = (const uchar *)data.constData();
|
||||||
if (data.size() >= 3 && dd[0] == 0xef && dd[1] == 0xbb && dd[2] == 0xbf) {
|
if (data.size() >= 3 && dd[0] == 0xef && dd[1] == 0xbb && dd[2] == 0xbf) {
|
||||||
@ -2835,7 +2835,7 @@ QString QSettings::applicationName() const
|
|||||||
return d->applicationName;
|
return d->applicationName;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\since 4.5
|
\since 4.5
|
||||||
@ -2888,7 +2888,7 @@ QTextCodec *QSettings::iniCodec() const
|
|||||||
return d->iniCodec;
|
return d->iniCodec;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // QT_NO_TEXTCODEC
|
#endif // textcodec
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns a status code indicating the first error that was met by
|
Returns a status code indicating the first error that was met by
|
||||||
|
@ -178,7 +178,7 @@ public:
|
|||||||
QString organizationName() const;
|
QString organizationName() const;
|
||||||
QString applicationName() const;
|
QString applicationName() const;
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
void setIniCodec(QTextCodec *codec);
|
void setIniCodec(QTextCodec *codec);
|
||||||
void setIniCodec(const char *codecName);
|
void setIniCodec(const char *codecName);
|
||||||
QTextCodec *iniCodec() const;
|
QTextCodec *iniCodec() const;
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
#include <qmutex.h>
|
#include <qmutex.h>
|
||||||
#include <private/qloggingregistry_p.h>
|
#include <private/qloggingregistry_p.h>
|
||||||
#include <qstandardpaths.h>
|
#include <qstandardpaths.h>
|
||||||
#include <qtextcodec.h>
|
|
||||||
#ifndef QT_NO_QOBJECT
|
#ifndef QT_NO_QOBJECT
|
||||||
#include <qthread.h>
|
#include <qthread.h>
|
||||||
#include <qthreadstorage.h>
|
#include <qthreadstorage.h>
|
||||||
|
@ -38,7 +38,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qcoreglobaldata_p.h"
|
#include "qcoreglobaldata_p.h"
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
#include "qtextcodec.h"
|
#include "qtextcodec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
@ -57,7 +57,9 @@
|
|||||||
#include "QtCore/qreadwritelock.h"
|
#include "QtCore/qreadwritelock.h"
|
||||||
#include "QtCore/qhash.h"
|
#include "QtCore/qhash.h"
|
||||||
#include "QtCore/qbytearray.h"
|
#include "QtCore/qbytearray.h"
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
#include "QtCore/qtextcodec.h"
|
#include "QtCore/qtextcodec.h"
|
||||||
|
#endif
|
||||||
#include "QtCore/qmutex.h"
|
#include "QtCore/qmutex.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
@ -42,7 +42,9 @@
|
|||||||
#include "private/qobject_p.h"
|
#include "private/qobject_p.h"
|
||||||
#include "qurl.h"
|
#include "qurl.h"
|
||||||
#include "qstringlist.h"
|
#include "qstringlist.h"
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
#include "qtextcodec.h"
|
#include "qtextcodec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -150,7 +152,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
|||||||
if (data.type() == QVariant::ByteArray) {
|
if (data.type() == QVariant::ByteArray) {
|
||||||
// see if we can convert to the requested type
|
// see if we can convert to the requested type
|
||||||
switch(type) {
|
switch(type) {
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
case QVariant::String: {
|
case QVariant::String: {
|
||||||
const QByteArray ba = data.toByteArray();
|
const QByteArray ba = data.toByteArray();
|
||||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||||
@ -158,7 +160,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
|||||||
codec = QTextCodec::codecForHtml(ba, codec);
|
codec = QTextCodec::codecForHtml(ba, codec);
|
||||||
return codec->toUnicode(ba);
|
return codec->toUnicode(ba);
|
||||||
}
|
}
|
||||||
#endif // QT_NO_TEXTCODEC
|
#endif // textcodec
|
||||||
case QVariant::Color: {
|
case QVariant::Color: {
|
||||||
QVariant newData = data;
|
QVariant newData = data;
|
||||||
newData.convert(QVariant::Color);
|
newData.convert(QVariant::Color);
|
||||||
|
@ -2514,9 +2514,7 @@ bool QObject::isSignalConnected(const QMetaMethod &signal) const
|
|||||||
signalIndex += QMetaObjectPrivate::signalOffset(signal.mobj);
|
signalIndex += QMetaObjectPrivate::signalOffset(signal.mobj);
|
||||||
|
|
||||||
QMutexLocker locker(signalSlotLock(this));
|
QMutexLocker locker(signalSlotLock(this));
|
||||||
if (!d->connectionLists)
|
if (d->connectionLists) {
|
||||||
return false;
|
|
||||||
|
|
||||||
if (signalIndex < sizeof(d->connectedSignals) * 8 && !d->connectionLists->dirty)
|
if (signalIndex < sizeof(d->connectedSignals) * 8 && !d->connectionLists->dirty)
|
||||||
return d->isSignalConnected(signalIndex);
|
return d->isSignalConnected(signalIndex);
|
||||||
|
|
||||||
@ -2529,7 +2527,8 @@ bool QObject::isSignalConnected(const QMetaMethod &signal) const
|
|||||||
c = c->nextConnectionList;
|
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);
|
QDataStream &operator>>(QDataStream &ds, QCborSimpleType &st);
|
||||||
#endif
|
#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
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QCborTag)
|
Q_DECLARE_METATYPE(QCborTag)
|
||||||
|
@ -1795,6 +1795,8 @@ public:
|
|||||||
preread();
|
preread();
|
||||||
if (CborError err = cbor_parser_init_reader(nullptr, &parser, ¤tElement, this))
|
if (CborError err = cbor_parser_init_reader(nullptr, &parser, ¤tElement, this))
|
||||||
handleError(err);
|
handleError(err);
|
||||||
|
else
|
||||||
|
lastError = { QCborError::NoError };
|
||||||
}
|
}
|
||||||
|
|
||||||
char *bufferPtr()
|
char *bufferPtr()
|
||||||
|
@ -72,7 +72,7 @@ class QDataStream;
|
|||||||
struct QCborParserError
|
struct QCborParserError
|
||||||
{
|
{
|
||||||
qint64 offset = 0;
|
qint64 offset = 0;
|
||||||
QCborError error = {};
|
QCborError error = { QCborError::NoError };
|
||||||
|
|
||||||
QString errorString() const { return error.toString(); }
|
QString errorString() const { return error.toString(); }
|
||||||
};
|
};
|
||||||
|
@ -326,7 +326,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
*/
|
*/
|
||||||
QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr)
|
QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr)
|
||||||
:
|
:
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
readConverterSavedState(0),
|
readConverterSavedState(0),
|
||||||
#endif
|
#endif
|
||||||
readConverterSavedStateOffset(0),
|
readConverterSavedStateOffset(0),
|
||||||
@ -347,12 +347,12 @@ QTextStreamPrivate::~QTextStreamPrivate()
|
|||||||
#endif
|
#endif
|
||||||
delete device;
|
delete device;
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
delete readConverterSavedState;
|
delete readConverterSavedState;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
static void resetCodecConverterStateHelper(QTextCodec::ConverterState *state)
|
static void resetCodecConverterStateHelper(QTextCodec::ConverterState *state)
|
||||||
{
|
{
|
||||||
state->~ConverterState();
|
state->~ConverterState();
|
||||||
@ -401,7 +401,7 @@ void QTextStreamPrivate::reset()
|
|||||||
readBufferStartDevicePos = 0;
|
readBufferStartDevicePos = 0;
|
||||||
lastTokenSize = 0;
|
lastTokenSize = 0;
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
codec = QTextCodec::codecForLocale();
|
codec = QTextCodec::codecForLocale();
|
||||||
resetCodecConverterStateHelper(&readConverterState);
|
resetCodecConverterStateHelper(&readConverterState);
|
||||||
resetCodecConverterStateHelper(&writeConverterState);
|
resetCodecConverterStateHelper(&writeConverterState);
|
||||||
@ -461,7 +461,7 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
|
|||||||
if (bytesRead <= 0)
|
if (bytesRead <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
// codec auto detection, explicitly defaults to locale encoding if the
|
// codec auto detection, explicitly defaults to locale encoding if the
|
||||||
// codec has been set to 0.
|
// codec has been set to 0.
|
||||||
if (!codec || autoDetectUnicode) {
|
if (!codec || autoDetectUnicode) {
|
||||||
@ -485,7 +485,7 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int oldReadBufferSize = readBuffer.size();
|
int oldReadBufferSize = readBuffer.size();
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
// convert to unicode
|
// convert to unicode
|
||||||
readBuffer += Q_LIKELY(codec) ? codec->toUnicode(buf, bytesRead, &readConverterState)
|
readBuffer += Q_LIKELY(codec) ? codec->toUnicode(buf, bytesRead, &readConverterState)
|
||||||
: QString::fromLatin1(buf, bytesRead);
|
: QString::fromLatin1(buf, bytesRead);
|
||||||
@ -567,7 +567,7 @@ void QTextStreamPrivate::flushWriteBuffer()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
if (!codec)
|
if (!codec)
|
||||||
codec = QTextCodec::codecForLocale();
|
codec = QTextCodec::codecForLocale();
|
||||||
#if defined (QTEXTSTREAM_DEBUG)
|
#if defined (QTEXTSTREAM_DEBUG)
|
||||||
@ -786,7 +786,7 @@ inline void QTextStreamPrivate::consume(int size)
|
|||||||
*/
|
*/
|
||||||
inline void QTextStreamPrivate::saveConverterState(qint64 newPos)
|
inline void QTextStreamPrivate::saveConverterState(qint64 newPos)
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
if (readConverterState.d) {
|
if (readConverterState.d) {
|
||||||
// converter cannot be copied, so don't save anything
|
// converter cannot be copied, so don't save anything
|
||||||
// don't update readBufferStartDevicePos either
|
// don't update readBufferStartDevicePos either
|
||||||
@ -807,7 +807,7 @@ inline void QTextStreamPrivate::saveConverterState(qint64 newPos)
|
|||||||
*/
|
*/
|
||||||
inline void QTextStreamPrivate::restoreToSavedConverterState()
|
inline void QTextStreamPrivate::restoreToSavedConverterState()
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
if (readConverterSavedState) {
|
if (readConverterSavedState) {
|
||||||
// we have a saved state
|
// we have a saved state
|
||||||
// that means the converter can be copied
|
// that means the converter can be copied
|
||||||
@ -1202,7 +1202,7 @@ bool QTextStream::seek(qint64 pos)
|
|||||||
return false;
|
return false;
|
||||||
d->resetReadBuffer();
|
d->resetReadBuffer();
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
// Reset the codec converter states.
|
// Reset the codec converter states.
|
||||||
resetCodecConverterStateHelper(&d->readConverterState);
|
resetCodecConverterStateHelper(&d->readConverterState);
|
||||||
resetCodecConverterStateHelper(&d->writeConverterState);
|
resetCodecConverterStateHelper(&d->writeConverterState);
|
||||||
@ -1253,7 +1253,7 @@ qint64 QTextStream::pos() const
|
|||||||
QTextStreamPrivate *thatd = const_cast<QTextStreamPrivate *>(d);
|
QTextStreamPrivate *thatd = const_cast<QTextStreamPrivate *>(d);
|
||||||
thatd->readBuffer.clear();
|
thatd->readBuffer.clear();
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
thatd->restoreToSavedConverterState();
|
thatd->restoreToSavedConverterState();
|
||||||
if (d->readBufferStartDevicePos == 0)
|
if (d->readBufferStartDevicePos == 0)
|
||||||
thatd->autoDetectUnicode = true;
|
thatd->autoDetectUnicode = true;
|
||||||
@ -3036,7 +3036,7 @@ QTextStream &ws(QTextStream &stream)
|
|||||||
Equivalent to QTextStream::setRealNumberPrecision(\a precision).
|
Equivalent to QTextStream::setRealNumberPrecision(\a precision).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
/*!
|
/*!
|
||||||
\relates QTextStream
|
\relates QTextStream
|
||||||
|
|
||||||
@ -3111,15 +3111,15 @@ QTextCodec *QTextStream::codec() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
If \a enabled is true, QTextStream will attempt to detect Unicode
|
If \a enabled is true, QTextStream will attempt to detect Unicode encoding
|
||||||
encoding by peeking into the stream data to see if it can find the
|
by peeking into the stream data to see if it can find the UTF-8, UTF-16, or
|
||||||
UTF-16 or UTF-32 BOM (Byte Order Mark). If this mark is found, QTextStream
|
UTF-32 Byte Order Mark (BOM). If this mark is found, QTextStream will
|
||||||
will replace the current codec with the UTF codec.
|
replace the current codec with the UTF codec.
|
||||||
|
|
||||||
This function can be used together with setCodec(). It is common
|
This function can be used together with setCodec(). It is common
|
||||||
to set the codec to UTF-8, and then enable UTF-16 detection.
|
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)
|
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 true if automatic Unicode detection is enabled, otherwise
|
||||||
returns \c false. Automatic Unicode detection is enabled by default.
|
returns \c false. Automatic Unicode detection is enabled by default.
|
||||||
|
|
||||||
\sa setAutoDetectUnicode(), setCodec()
|
\sa setAutoDetectUnicode(), setCodec(), QTextCodec::codecForUtfText()
|
||||||
*/
|
*/
|
||||||
bool QTextStream::autoDetectUnicode() const
|
bool QTextStream::autoDetectUnicode() const
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ public:
|
|||||||
explicit QTextStream(const QByteArray &array, QIODevice::OpenMode openMode = QIODevice::ReadOnly);
|
explicit QTextStream(const QByteArray &array, QIODevice::OpenMode openMode = QIODevice::ReadOnly);
|
||||||
virtual ~QTextStream();
|
virtual ~QTextStream();
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
void setCodec(QTextCodec *codec);
|
void setCodec(QTextCodec *codec);
|
||||||
void setCodec(const char *codecName);
|
void setCodec(const char *codecName);
|
||||||
QTextCodec *codec() const;
|
QTextCodec *codec() const;
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
#include <QtCore/private/qglobal_p.h>
|
#include <QtCore/private/qglobal_p.h>
|
||||||
#include "qtextstream.h"
|
#include "qtextstream.h"
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
#include "qtextcodec.h"
|
#include "qtextcodec.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ public:
|
|||||||
int stringOffset;
|
int stringOffset;
|
||||||
QIODevice::OpenMode stringOpenMode;
|
QIODevice::OpenMode stringOpenMode;
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
// codec
|
// codec
|
||||||
QTextCodec *codec;
|
QTextCodec *codec;
|
||||||
QTextCodec::ConverterState readConverterState;
|
QTextCodec::ConverterState readConverterState;
|
||||||
@ -141,7 +141,7 @@ public:
|
|||||||
|
|
||||||
int lastTokenSize;
|
int lastTokenSize;
|
||||||
bool deleteDevice;
|
bool deleteDevice;
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
bool autoDetectUnicode;
|
bool autoDetectUnicode;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -45,7 +45,9 @@
|
|||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include <qfile.h>
|
#include <qfile.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
|
#endif
|
||||||
#include <qstack.h>
|
#include <qstack.h>
|
||||||
#include <qbuffer.h>
|
#include <qbuffer.h>
|
||||||
#ifndef QT_BOOTSTRAPPED
|
#ifndef QT_BOOTSTRAPPED
|
||||||
@ -420,7 +422,7 @@ QXmlStreamReader::QXmlStreamReader(const QString &data)
|
|||||||
: d_ptr(new QXmlStreamReaderPrivate(this))
|
: d_ptr(new QXmlStreamReaderPrivate(this))
|
||||||
{
|
{
|
||||||
Q_D(QXmlStreamReader);
|
Q_D(QXmlStreamReader);
|
||||||
#ifdef QT_NO_TEXTCODEC
|
#if !QT_CONFIG(textcodec)
|
||||||
d->dataBuffer = data.toLatin1();
|
d->dataBuffer = data.toLatin1();
|
||||||
#else
|
#else
|
||||||
d->dataBuffer = d->codec->fromUnicode(data);
|
d->dataBuffer = d->codec->fromUnicode(data);
|
||||||
@ -515,7 +517,7 @@ void QXmlStreamReader::addData(const QString &data)
|
|||||||
{
|
{
|
||||||
Q_D(QXmlStreamReader);
|
Q_D(QXmlStreamReader);
|
||||||
d->lockEncoding = true;
|
d->lockEncoding = true;
|
||||||
#ifdef QT_NO_TEXTCODEC
|
#if !QT_CONFIG(textcodec)
|
||||||
addData(data.toLatin1());
|
addData(data.toLatin1());
|
||||||
#else
|
#else
|
||||||
addData(d->codec->fromUnicode(data));
|
addData(d->codec->fromUnicode(data));
|
||||||
@ -792,7 +794,7 @@ QXmlStreamReaderPrivate::QXmlStreamReaderPrivate(QXmlStreamReader *q)
|
|||||||
{
|
{
|
||||||
device = 0;
|
device = 0;
|
||||||
deleteDevice = false;
|
deleteDevice = false;
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
decoder = 0;
|
decoder = 0;
|
||||||
#endif
|
#endif
|
||||||
stack_size = 64;
|
stack_size = 64;
|
||||||
@ -838,7 +840,7 @@ void QXmlStreamReaderPrivate::init()
|
|||||||
lineNumber = lastLineStart = characterOffset = 0;
|
lineNumber = lastLineStart = characterOffset = 0;
|
||||||
readBufferPos = 0;
|
readBufferPos = 0;
|
||||||
nbytesread = 0;
|
nbytesread = 0;
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
codec = QTextCodec::codecForMib(106); // utf8
|
codec = QTextCodec::codecForMib(106); // utf8
|
||||||
delete decoder;
|
delete decoder;
|
||||||
decoder = 0;
|
decoder = 0;
|
||||||
@ -903,7 +905,7 @@ inline void QXmlStreamReaderPrivate::reallocateStack()
|
|||||||
|
|
||||||
QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate()
|
QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate()
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
delete decoder;
|
delete decoder;
|
||||||
#endif
|
#endif
|
||||||
free(sym_stack);
|
free(sym_stack);
|
||||||
@ -1482,7 +1484,7 @@ uint QXmlStreamReaderPrivate::getChar_helper()
|
|||||||
characterOffset += readBufferPos;
|
characterOffset += readBufferPos;
|
||||||
readBufferPos = 0;
|
readBufferPos = 0;
|
||||||
readBuffer.resize(0);
|
readBuffer.resize(0);
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
if (decoder)
|
if (decoder)
|
||||||
#endif
|
#endif
|
||||||
nbytesread = 0;
|
nbytesread = 0;
|
||||||
@ -1503,7 +1505,7 @@ uint QXmlStreamReaderPrivate::getChar_helper()
|
|||||||
return StreamEOF;
|
return StreamEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
if (!decoder) {
|
if (!decoder) {
|
||||||
if (nbytesread < 4) { // the 4 is to cover 0xef 0xbb 0xbf plus
|
if (nbytesread < 4) { // the 4 is to cover 0xef 0xbb 0xbf plus
|
||||||
// one extra for the utf8 codec
|
// one extra for the utf8 codec
|
||||||
@ -1545,7 +1547,7 @@ uint QXmlStreamReaderPrivate::getChar_helper()
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread);
|
readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread);
|
||||||
#endif // QT_NO_TEXTCODEC
|
#endif // textcodec
|
||||||
|
|
||||||
readBuffer.reserve(1); // keep capacity when calling resize() next time
|
readBuffer.reserve(1); // keep capacity when calling resize() next time
|
||||||
|
|
||||||
@ -1816,7 +1818,7 @@ void QXmlStreamReaderPrivate::startDocument()
|
|||||||
if (!QXmlUtils::isEncName(value))
|
if (!QXmlUtils::isEncName(value))
|
||||||
err = QXmlStream::tr("%1 is an invalid encoding name.").arg(value);
|
err = QXmlStream::tr("%1 is an invalid encoding name.").arg(value);
|
||||||
else {
|
else {
|
||||||
#ifdef QT_NO_TEXTCODEC
|
#if !QT_CONFIG(textcodec)
|
||||||
readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread);
|
readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread);
|
||||||
#else
|
#else
|
||||||
QTextCodec *const newCodec = QTextCodec::codecForName(value.toLatin1());
|
QTextCodec *const newCodec = QTextCodec::codecForName(value.toLatin1());
|
||||||
@ -1828,7 +1830,7 @@ void QXmlStreamReaderPrivate::startDocument()
|
|||||||
decoder = codec->makeDecoder();
|
decoder = codec->makeDecoder();
|
||||||
decoder->toUnicode(&readBuffer, rawReadBuffer.data(), nbytesread);
|
decoder->toUnicode(&readBuffer, rawReadBuffer.data(), nbytesread);
|
||||||
}
|
}
|
||||||
#endif // QT_NO_TEXTCODEC
|
#endif // textcodec
|
||||||
}
|
}
|
||||||
} else if (prefix.isEmpty() && key == QLatin1String("standalone")) {
|
} else if (prefix.isEmpty() && key == QLatin1String("standalone")) {
|
||||||
hasStandalone = true;
|
hasStandalone = true;
|
||||||
@ -2966,7 +2968,7 @@ public:
|
|||||||
~QXmlStreamWriterPrivate() {
|
~QXmlStreamWriterPrivate() {
|
||||||
if (deleteDevice)
|
if (deleteDevice)
|
||||||
delete device;
|
delete device;
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
delete encoder;
|
delete encoder;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -2993,7 +2995,7 @@ public:
|
|||||||
NamespaceDeclaration emptyNamespace;
|
NamespaceDeclaration emptyNamespace;
|
||||||
int lastNamespaceDeclaration;
|
int lastNamespaceDeclaration;
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
QTextCodec *codec;
|
QTextCodec *codec;
|
||||||
QTextEncoder *encoder;
|
QTextEncoder *encoder;
|
||||||
#endif
|
#endif
|
||||||
@ -3015,7 +3017,7 @@ QXmlStreamWriterPrivate::QXmlStreamWriterPrivate(QXmlStreamWriter *q)
|
|||||||
device = 0;
|
device = 0;
|
||||||
stringDevice = 0;
|
stringDevice = 0;
|
||||||
deleteDevice = false;
|
deleteDevice = false;
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
codec = QTextCodec::codecForMib(106); // utf8
|
codec = QTextCodec::codecForMib(106); // utf8
|
||||||
encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); // no byte order mark for utf8
|
encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); // no byte order mark for utf8
|
||||||
#endif
|
#endif
|
||||||
@ -3032,7 +3034,7 @@ QXmlStreamWriterPrivate::QXmlStreamWriterPrivate(QXmlStreamWriter *q)
|
|||||||
|
|
||||||
void QXmlStreamWriterPrivate::checkIfASCIICompatibleCodec()
|
void QXmlStreamWriterPrivate::checkIfASCIICompatibleCodec()
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
Q_ASSERT(encoder);
|
Q_ASSERT(encoder);
|
||||||
// test ASCII-compatibility using the letter 'a'
|
// test ASCII-compatibility using the letter 'a'
|
||||||
QChar letterA = QLatin1Char('a');
|
QChar letterA = QLatin1Char('a');
|
||||||
@ -3052,7 +3054,7 @@ void QXmlStreamWriterPrivate::write(const QStringRef &s)
|
|||||||
if (device) {
|
if (device) {
|
||||||
if (hasIoError)
|
if (hasIoError)
|
||||||
return;
|
return;
|
||||||
#ifdef QT_NO_TEXTCODEC
|
#if !QT_CONFIG(textcodec)
|
||||||
QByteArray bytes = s.toLatin1();
|
QByteArray bytes = s.toLatin1();
|
||||||
#else
|
#else
|
||||||
QByteArray bytes = encoder->fromUnicode(s.constData(), s.size());
|
QByteArray bytes = encoder->fromUnicode(s.constData(), s.size());
|
||||||
@ -3075,7 +3077,7 @@ void QXmlStreamWriterPrivate::write(const QString &s)
|
|||||||
if (device) {
|
if (device) {
|
||||||
if (hasIoError)
|
if (hasIoError)
|
||||||
return;
|
return;
|
||||||
#ifdef QT_NO_TEXTCODEC
|
#if !QT_CONFIG(textcodec)
|
||||||
QByteArray bytes = s.toLatin1();
|
QByteArray bytes = s.toLatin1();
|
||||||
#else
|
#else
|
||||||
QByteArray bytes = encoder->fromUnicode(s);
|
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
|
Sets the codec for this stream to \a codec. The codec is used for
|
||||||
encoding any data that is written. By default, QXmlStreamWriter
|
encoding any data that is written. By default, QXmlStreamWriter
|
||||||
@ -3382,7 +3384,7 @@ QTextCodec *QXmlStreamWriter::codec() const
|
|||||||
Q_D(const QXmlStreamWriter);
|
Q_D(const QXmlStreamWriter);
|
||||||
return d->codec;
|
return d->codec;
|
||||||
}
|
}
|
||||||
#endif // QT_NO_TEXTCODEC
|
#endif // textcodec
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\property QXmlStreamWriter::autoFormatting
|
\property QXmlStreamWriter::autoFormatting
|
||||||
@ -3847,7 +3849,7 @@ void QXmlStreamWriter::writeStartDocument(const QString &version)
|
|||||||
d->write(version);
|
d->write(version);
|
||||||
if (d->device) { // stringDevice does not get any encoding
|
if (d->device) { // stringDevice does not get any encoding
|
||||||
d->write("\" encoding=\"");
|
d->write("\" encoding=\"");
|
||||||
#ifdef QT_NO_TEXTCODEC
|
#if !QT_CONFIG(textcodec)
|
||||||
d->write("iso-8859-1");
|
d->write("iso-8859-1");
|
||||||
#else
|
#else
|
||||||
const QByteArray name = d->codec->name();
|
const QByteArray name = d->codec->name();
|
||||||
@ -3871,7 +3873,7 @@ void QXmlStreamWriter::writeStartDocument(const QString &version, bool standalon
|
|||||||
d->write(version);
|
d->write(version);
|
||||||
if (d->device) { // stringDevice does not get any encoding
|
if (d->device) { // stringDevice does not get any encoding
|
||||||
d->write("\" encoding=\"");
|
d->write("\" encoding=\"");
|
||||||
#ifdef QT_NO_TEXTCODEC
|
#if !QT_CONFIG(textcodec)
|
||||||
d->write("iso-8859-1");
|
d->write("iso-8859-1");
|
||||||
#else
|
#else
|
||||||
const QByteArray name = d->codec->name();
|
const QByteArray name = d->codec->name();
|
||||||
|
@ -291,7 +291,7 @@ public:
|
|||||||
|
|
||||||
QIODevice *device;
|
QIODevice *device;
|
||||||
bool deleteDevice;
|
bool deleteDevice;
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
QTextCodec *codec;
|
QTextCodec *codec;
|
||||||
QTextDecoder *decoder;
|
QTextDecoder *decoder;
|
||||||
#endif
|
#endif
|
||||||
@ -584,7 +584,7 @@ bool QXmlStreamReaderPrivate::parse()
|
|||||||
lockEncoding = true;
|
lockEncoding = true;
|
||||||
documentVersion.clear();
|
documentVersion.clear();
|
||||||
documentEncoding.clear();
|
documentEncoding.clear();
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
if (decoder && decoder->hasFailure()) {
|
if (decoder && decoder->hasFailure()) {
|
||||||
raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content."));
|
raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content."));
|
||||||
readBuffer.clear();
|
readBuffer.clear();
|
||||||
|
@ -478,7 +478,7 @@ public:
|
|||||||
void setDevice(QIODevice *device);
|
void setDevice(QIODevice *device);
|
||||||
QIODevice *device() const;
|
QIODevice *device() const;
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
void setCodec(QTextCodec *codec);
|
void setCodec(QTextCodec *codec);
|
||||||
void setCodec(const char *codecName);
|
void setCodec(const char *codecName);
|
||||||
QTextCodec *codec() const;
|
QTextCodec *codec() const;
|
||||||
|
@ -788,7 +788,7 @@ public:
|
|||||||
|
|
||||||
QIODevice *device;
|
QIODevice *device;
|
||||||
bool deleteDevice;
|
bool deleteDevice;
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
QTextCodec *codec;
|
QTextCodec *codec;
|
||||||
QTextDecoder *decoder;
|
QTextDecoder *decoder;
|
||||||
#endif
|
#endif
|
||||||
@ -1081,7 +1081,7 @@ bool QXmlStreamReaderPrivate::parse()
|
|||||||
lockEncoding = true;
|
lockEncoding = true;
|
||||||
documentVersion.clear();
|
documentVersion.clear();
|
||||||
documentEncoding.clear();
|
documentEncoding.clear();
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
if (decoder && decoder->hasFailure()) {
|
if (decoder && decoder->hasFailure()) {
|
||||||
raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content."));
|
raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content."));
|
||||||
readBuffer.clear();
|
readBuffer.clear();
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
\note For the current keyboard input locale take a look at
|
\note For the current keyboard input locale take a look at
|
||||||
QInputMethod::locale().
|
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(),
|
\sa QString::arg(), QString::toInt(), QString::toDouble(),
|
||||||
QInputMethod::locale()
|
QInputMethod::locale()
|
||||||
|
@ -412,9 +412,10 @@ inline char QLocaleData::digitToCLocale(QChar in) const
|
|||||||
if (in == m_exponential || in == QChar::toUpper(m_exponential))
|
if (in == m_exponential || in == QChar::toUpper(m_exponential))
|
||||||
return 'e';
|
return 'e';
|
||||||
|
|
||||||
// In several languages group() is the char 0xA0, which looks like a space.
|
// In several languages group() is a non-breaking space (U+00A0) or its thin
|
||||||
// People use a regular space instead of it and complain it doesn't work.
|
// version (U+202f), which look like spaces. People (and thus some of our
|
||||||
if (m_group == 0xA0 && in.unicode() == ' ')
|
// tests) use a regular space instead and complain if it doesn't work.
|
||||||
|
if ((m_group == 0xA0 || m_group == 0x202f) && in.unicode() == ' ')
|
||||||
return ',';
|
return ',';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1384,6 +1384,9 @@ QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::ge
|
|||||||
x->strongref.store(-1);
|
x->strongref.store(-1);
|
||||||
x->weakref.store(2); // the QWeakPointer that called us plus the QObject itself
|
x->weakref.store(2); // the QWeakPointer that called us plus the QObject itself
|
||||||
if (!d->sharedRefcount.testAndSetRelease(0, x)) {
|
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;
|
delete x;
|
||||||
x = d->sharedRefcount.loadAcquire();
|
x = d->sharedRefcount.loadAcquire();
|
||||||
x->weakref.ref();
|
x->weakref.ref();
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "qregularexpression.h"
|
#include "qregularexpression.h"
|
||||||
#endif
|
#endif
|
||||||
#include "qunicodetables_p.h"
|
#include "qunicodetables_p.h"
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
#endif
|
#endif
|
||||||
#include <private/qutfcodec_p.h>
|
#include <private/qutfcodec_p.h>
|
||||||
@ -5277,11 +5277,11 @@ static QByteArray qt_convert_to_local_8bit(QStringView string)
|
|||||||
{
|
{
|
||||||
if (string.isNull())
|
if (string.isNull())
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
QTextCodec *localeCodec = QTextCodec::codecForLocale();
|
QTextCodec *localeCodec = QTextCodec::codecForLocale();
|
||||||
if (localeCodec)
|
if (localeCodec)
|
||||||
return localeCodec->fromUnicode(string);
|
return localeCodec->fromUnicode(string);
|
||||||
#endif // QT_NO_TEXTCODEC
|
#endif // textcodec
|
||||||
return qt_convert_to_latin1(string);
|
return qt_convert_to_latin1(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5475,13 +5475,13 @@ QString QString::fromLocal8Bit_helper(const char *str, int size)
|
|||||||
QStringDataPtr empty = { Data::allocate(0) };
|
QStringDataPtr empty = { Data::allocate(0) };
|
||||||
return QString(empty);
|
return QString(empty);
|
||||||
}
|
}
|
||||||
#if !defined(QT_NO_TEXTCODEC)
|
#if QT_CONFIG(textcodec)
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
size = qstrlen(str);
|
size = qstrlen(str);
|
||||||
QTextCodec *codec = QTextCodec::codecForLocale();
|
QTextCodec *codec = QTextCodec::codecForLocale();
|
||||||
if (codec)
|
if (codec)
|
||||||
return codec->toUnicode(str, size);
|
return codec->toUnicode(str, size);
|
||||||
#endif // !QT_NO_TEXTCODEC
|
#endif // textcodec
|
||||||
return fromLatin1(str, size);
|
return fromLatin1(str, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qstringbuilder.h"
|
#include "qstringbuilder.h"
|
||||||
#include <QtCore/qtextcodec.h>
|
|
||||||
#include <private/qutfcodec_p.h>
|
#include <private/qutfcodec_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
@ -20,13 +20,14 @@
|
|||||||
"Name": "Unicode Common Locale Data Repository (CLDR)",
|
"Name": "Unicode Common Locale Data Repository (CLDR)",
|
||||||
"QDocModule": "qtcore",
|
"QDocModule": "qtcore",
|
||||||
"QtUsage": "Used in Qt Core (QTimeZone, QLocale).",
|
"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",
|
"Files": "qlocale_data_p.h qtimezoneprivate_data_p.h",
|
||||||
|
|
||||||
"Description": "The Unicode CLDR provides key building blocks for software to support the
|
"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
|
world's languages, with the largest and most extensive standard repository of locale data
|
||||||
available.",
|
available.",
|
||||||
"Homepage": "http://cldr.unicode.org/",
|
"Homepage": "http://cldr.unicode.org/",
|
||||||
"Version": "v33.1",
|
"Version": "v34",
|
||||||
"License": "// as specified in https://spdx.org/licenses/Unicode-DFS-2016.html",
|
"License": "// as specified in https://spdx.org/licenses/Unicode-DFS-2016.html",
|
||||||
"License": "Unicode License Agreement - Data Files and Software (2016)",
|
"License": "Unicode License Agreement - Data Files and Software (2016)",
|
||||||
"LicenseId": "Unicode-DFS-2016",
|
"LicenseId": "Unicode-DFS-2016",
|
||||||
|
@ -118,21 +118,14 @@ QImageData::QImageData()
|
|||||||
QImageData * QImageData::create(const QSize &size, QImage::Format format)
|
QImageData * QImageData::create(const QSize &size, QImage::Format format)
|
||||||
{
|
{
|
||||||
if (!size.isValid() || format == QImage::Format_Invalid)
|
if (!size.isValid() || format == QImage::Format_Invalid)
|
||||||
return 0; // invalid parameter(s)
|
return nullptr; // invalid parameter(s)
|
||||||
|
|
||||||
uint width = size.width();
|
int width = size.width();
|
||||||
uint height = size.height();
|
int height = size.height();
|
||||||
uint depth = qt_depthForFormat(format);
|
int depth = qt_depthForFormat(format);
|
||||||
|
auto params = calculateImageParameters(width, height, depth);
|
||||||
const int bytes_per_line = ((width * depth + 31) >> 5) << 2; // bytes per scanline (must be multiple of 4)
|
if (params.bytesPerLine < 0)
|
||||||
|
return nullptr;
|
||||||
// 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;
|
|
||||||
|
|
||||||
QScopedPointer<QImageData> d(new QImageData);
|
QScopedPointer<QImageData> d(new QImageData);
|
||||||
|
|
||||||
@ -154,18 +147,15 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format)
|
|||||||
d->has_alpha_clut = false;
|
d->has_alpha_clut = false;
|
||||||
d->is_cached = false;
|
d->is_cached = false;
|
||||||
|
|
||||||
d->bytes_per_line = bytes_per_line;
|
d->bytes_per_line = params.bytesPerLine;
|
||||||
|
d->nbytes = params.totalSize;
|
||||||
d->nbytes = d->bytes_per_line*height;
|
|
||||||
d->data = (uchar *)malloc(d->nbytes);
|
d->data = (uchar *)malloc(d->nbytes);
|
||||||
|
|
||||||
if (!d->data) {
|
if (!d->data)
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
d->ref.ref();
|
d->ref.ref();
|
||||||
return d.take();
|
return d.take();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QImageData::~QImageData()
|
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 *QImageData::create(uchar *data, int width, int height, int bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction, void *cleanupInfo)
|
||||||
{
|
{
|
||||||
QImageData *d = 0;
|
if (width <= 0 || height <= 0 || !data || format == QImage::Format_Invalid)
|
||||||
|
return nullptr;
|
||||||
if (format == QImage::Format_Invalid)
|
|
||||||
return d;
|
|
||||||
|
|
||||||
const int depth = qt_depthForFormat(format);
|
const int depth = qt_depthForFormat(format);
|
||||||
const int calc_bytes_per_line = ((width * depth + 31)/32) * 4;
|
auto params = calculateImageParameters(width, height, depth);
|
||||||
|
if (params.totalSize < 0)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if (bpl > 0) {
|
||||||
|
// can't overflow, because has calculateImageParameters already done this multiplication
|
||||||
const int min_bytes_per_line = (width * depth + 7)/8;
|
const int min_bytes_per_line = (width * depth + 7)/8;
|
||||||
|
if (bpl < min_bytes_per_line)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
if (bpl <= 0)
|
// recalculate the total with this value
|
||||||
bpl = calc_bytes_per_line;
|
params.bytesPerLine = bpl;
|
||||||
|
if (mul_overflow<qsizetype>(bpl, height, ¶ms.totalSize))
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (width <= 0 || height <= 0 || !data
|
QImageData *d = new QImageData;
|
||||||
|| 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)
|
|
||||||
|
|
||||||
d = new QImageData;
|
|
||||||
d->ref.ref();
|
d->ref.ref();
|
||||||
|
|
||||||
d->own_data = false;
|
d->own_data = false;
|
||||||
@ -817,8 +807,8 @@ QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QIm
|
|||||||
d->depth = depth;
|
d->depth = depth;
|
||||||
d->format = format;
|
d->format = format;
|
||||||
|
|
||||||
d->bytes_per_line = bpl;
|
d->bytes_per_line = params.bytesPerLine;
|
||||||
d->nbytes = d->bytes_per_line * height;
|
d->nbytes = params.totalSize;
|
||||||
|
|
||||||
d->cleanupFunction = cleanupFunction;
|
d->cleanupFunction = cleanupFunction;
|
||||||
d->cleanupInfo = cleanupInfo;
|
d->cleanupInfo = cleanupInfo;
|
||||||
|
@ -817,10 +817,10 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve
|
|||||||
Q_ASSERT(data->own_data);
|
Q_ASSERT(data->own_data);
|
||||||
|
|
||||||
const int depth = 32;
|
const int depth = 32;
|
||||||
|
auto params = QImageData::calculateImageParameters(data->width, data->height, depth);
|
||||||
const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
|
if (params.bytesPerLine < 0)
|
||||||
const qsizetype nbytes = dst_bytes_per_line * data->height;
|
return false;
|
||||||
uchar *const newData = (uchar *)realloc(data->data, nbytes);
|
uchar *const newData = (uchar *)realloc(data->data, params.totalSize);
|
||||||
if (!newData)
|
if (!newData)
|
||||||
return false;
|
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
|
// start converting from the end because the end image is bigger than the source
|
||||||
uchar *src_data = newData + data->nbytes; // end of src
|
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 width = data->width;
|
||||||
const int src_pad = data->bytes_per_line - 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) {
|
if (data->colortable.size() == 0) {
|
||||||
data->colortable.resize(256);
|
data->colortable.resize(256);
|
||||||
for (int i = 0; i < 256; ++i)
|
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->colortable = QVector<QRgb>();
|
||||||
data->format = QImage::Format_ARGB32_Premultiplied;
|
data->format = QImage::Format_ARGB32_Premultiplied;
|
||||||
data->bytes_per_line = dst_bytes_per_line;
|
data->bytes_per_line = params.bytesPerLine;
|
||||||
data->depth = depth;
|
data->depth = depth;
|
||||||
data->nbytes = nbytes;
|
data->nbytes = params.totalSize;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -871,10 +871,10 @@ static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversi
|
|||||||
Q_ASSERT(data->own_data);
|
Q_ASSERT(data->own_data);
|
||||||
|
|
||||||
const int depth = 32;
|
const int depth = 32;
|
||||||
|
auto params = QImageData::calculateImageParameters(data->width, data->height, depth);
|
||||||
const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
|
if (params.bytesPerLine < 0)
|
||||||
const qsizetype nbytes = dst_bytes_per_line * data->height;
|
return false;
|
||||||
uchar *const newData = (uchar *)realloc(data->data, nbytes);
|
uchar *const newData = (uchar *)realloc(data->data, params.totalSize);
|
||||||
if (!newData)
|
if (!newData)
|
||||||
return false;
|
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
|
// start converting from the end because the end image is bigger than the source
|
||||||
uchar *src_data = newData + data->nbytes;
|
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 width = data->width;
|
||||||
const int src_pad = data->bytes_per_line - 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) {
|
if (data->colortable.size() == 0) {
|
||||||
data->colortable.resize(256);
|
data->colortable.resize(256);
|
||||||
for (int i = 0; i < 256; ++i)
|
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->colortable = QVector<QRgb>();
|
||||||
data->format = QImage::Format_ARGB32;
|
data->format = QImage::Format_ARGB32;
|
||||||
data->bytes_per_line = dst_bytes_per_line;
|
data->bytes_per_line = params.bytesPerLine;
|
||||||
data->depth = depth;
|
data->depth = depth;
|
||||||
data->nbytes = nbytes;
|
data->nbytes = params.totalSize;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -939,10 +939,10 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers
|
|||||||
Q_ASSERT(data->own_data);
|
Q_ASSERT(data->own_data);
|
||||||
|
|
||||||
const int depth = 16;
|
const int depth = 16;
|
||||||
|
auto params = QImageData::calculateImageParameters(data->width, data->height, depth);
|
||||||
const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
|
if (params.bytesPerLine < 0)
|
||||||
const qsizetype nbytes = dst_bytes_per_line * data->height;
|
return false;
|
||||||
uchar *const newData = (uchar *)realloc(data->data, nbytes);
|
uchar *const newData = (uchar *)realloc(data->data, params.totalSize);
|
||||||
if (!newData)
|
if (!newData)
|
||||||
return false;
|
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
|
// start converting from the end because the end image is bigger than the source
|
||||||
uchar *src_data = newData + data->nbytes;
|
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 width = data->width;
|
||||||
const int src_pad = data->bytes_per_line - 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];
|
quint16 colorTableRGB16[256];
|
||||||
const int tableSize = data->colortable.size();
|
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->format = QImage::Format_RGB16;
|
||||||
data->bytes_per_line = dst_bytes_per_line;
|
data->bytes_per_line = params.bytesPerLine;
|
||||||
data->depth = depth;
|
data->depth = depth;
|
||||||
data->nbytes = nbytes;
|
data->nbytes = params.totalSize;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -997,6 +997,7 @@ static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFl
|
|||||||
|
|
||||||
const int depth = 16;
|
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 dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
|
||||||
const qsizetype src_bytes_per_line = data->bytes_per_line;
|
const qsizetype src_bytes_per_line = data->bytes_per_line;
|
||||||
quint32 *src_data = (quint32 *) data->data;
|
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->depth = depth;
|
||||||
data->nbytes = dst_bytes_per_line * data->height;
|
data->nbytes = dst_bytes_per_line * data->height;
|
||||||
uchar *const newData = (uchar *)realloc(data->data, data->nbytes);
|
uchar *const newData = (uchar *)realloc(data->data, data->nbytes);
|
||||||
if (newData) {
|
if (newData)
|
||||||
data->data = newData;
|
data->data = newData;
|
||||||
|
|
||||||
|
// can't fail, since we're shrinking
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src)
|
static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src)
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <QtGui/private/qtguiglobal_p.h>
|
#include <QtGui/private/qtguiglobal_p.h>
|
||||||
|
#include <QtCore/private/qnumeric_p.h>
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
@ -104,8 +105,40 @@ struct Q_GUI_EXPORT QImageData { // internal image data
|
|||||||
bool doImageIO(const QImage *image, QImageWriter* io, int quality) const;
|
bool doImageIO(const QImage *image, QImageWriter* io, int quality) const;
|
||||||
|
|
||||||
QPaintEngine *paintEngine;
|
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 void (*Image_Converter)(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
|
||||||
typedef bool (*InPlace_Image_Converter)(QImageData *data, Qt::ImageConversionFlags);
|
typedef bool (*InPlace_Image_Converter)(QImageData *data, Qt::ImageConversionFlags);
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
#include <qiodevice.h>
|
#include <qiodevice.h>
|
||||||
#include <qimage.h>
|
#include <qimage.h>
|
||||||
#include <qlist.h>
|
#include <qlist.h>
|
||||||
#include <qtextcodec.h>
|
|
||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
#include <qvector.h>
|
#include <qvector.h>
|
||||||
|
|
||||||
|
@ -46,7 +46,9 @@
|
|||||||
#include "qvariant.h"
|
#include "qvariant.h"
|
||||||
#include "qbuffer.h"
|
#include "qbuffer.h"
|
||||||
#include "qimage.h"
|
#include "qimage.h"
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
#include "qtextcodec.h"
|
#include "qtextcodec.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "private/qguiapplication_p.h"
|
#include "private/qguiapplication_p.h"
|
||||||
#include <qpa/qplatformintegration.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);
|
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
|
QTextCodec* codec = QTextCodec::codecForMib(106); // utf-8 is default
|
||||||
if (subtype == QLatin1String("html"))
|
if (subtype == QLatin1String("html"))
|
||||||
codec = QTextCodec::codecForHtml(rawData, codec);
|
codec = QTextCodec::codecForHtml(rawData, codec);
|
||||||
else
|
else
|
||||||
codec = QTextCodec::codecForUtfText(rawData, codec);
|
codec = QTextCodec::codecForUtfText(rawData, codec);
|
||||||
return codec->toUnicode(rawData);
|
return codec->toUnicode(rawData);
|
||||||
#else //QT_NO_TEXTCODEC
|
#else // textcodec
|
||||||
return rawData;
|
return rawData;
|
||||||
#endif //QT_NO_TEXTCODEC
|
#endif // textcodec
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -2533,6 +2533,7 @@ QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalP
|
|||||||
*/
|
*/
|
||||||
QTabletEvent::~QTabletEvent()
|
QTabletEvent::~QTabletEvent()
|
||||||
{
|
{
|
||||||
|
delete static_cast<QTabletEventPrivate *>(mExtra);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -803,7 +803,8 @@ static void updateBlockedStatusRecursion(QWindow *window, bool shouldBeBlocked)
|
|||||||
void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window)
|
void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window)
|
||||||
{
|
{
|
||||||
bool shouldBeBlocked = false;
|
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);
|
shouldBeBlocked = self->isWindowBlocked(window);
|
||||||
updateBlockedStatusRecursion(window, shouldBeBlocked);
|
updateBlockedStatusRecursion(window, shouldBeBlocked);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
#include "qpixmap.h"
|
#include "qpixmap.h"
|
||||||
#include "qevent.h"
|
#include "qevent.h"
|
||||||
#include "qfile.h"
|
#include "qfile.h"
|
||||||
#include "qtextcodec.h"
|
|
||||||
#include "qguiapplication.h"
|
#include "qguiapplication.h"
|
||||||
#include "qpoint.h"
|
#include "qpoint.h"
|
||||||
#include "qbuffer.h"
|
#include "qbuffer.h"
|
||||||
|
@ -319,7 +319,8 @@ void QSurfaceFormat::setStereo(bool enable)
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the number of samples per pixel when multisampling is
|
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()
|
\sa setSamples()
|
||||||
*/
|
*/
|
||||||
|
@ -63,7 +63,9 @@
|
|||||||
#include <qregexp.h>
|
#include <qregexp.h>
|
||||||
#include <qstring.h>
|
#include <qstring.h>
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <qguiapplication.h>
|
#include <qguiapplication.h>
|
||||||
#include <qbitmap.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::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
|
||||||
Qt::MouseEventSource source)
|
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 localPos = QHighDpi::fromNativeLocalPosition(local, window);
|
||||||
auto globalPos = QHighDpi::fromNativePixels(global, window);
|
auto globalPos = QHighDpi::fromNativePixels(global, window);
|
||||||
|
|
||||||
|
@ -40,8 +40,10 @@
|
|||||||
#include "qopenglvertexarrayobject.h"
|
#include "qopenglvertexarrayobject.h"
|
||||||
|
|
||||||
#include <QtCore/private/qobject_p.h>
|
#include <QtCore/private/qobject_p.h>
|
||||||
|
#include <QtCore/qthread.h>
|
||||||
#include <QtGui/qopenglcontext.h>
|
#include <QtGui/qopenglcontext.h>
|
||||||
#include <QtGui/qoffscreensurface.h>
|
#include <QtGui/qoffscreensurface.h>
|
||||||
|
#include <QtGui/qguiapplication.h>
|
||||||
|
|
||||||
#include <QtGui/qopenglfunctions_3_0.h>
|
#include <QtGui/qopenglfunctions_3_0.h>
|
||||||
#include <QtGui/qopenglfunctions_3_2_core.h>
|
#include <QtGui/qopenglfunctions_3_2_core.h>
|
||||||
@ -204,6 +206,12 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
|
|||||||
if (context && context != ctx) {
|
if (context && context != ctx) {
|
||||||
oldContext = ctx;
|
oldContext = ctx;
|
||||||
oldContextSurface = ctx ? ctx->surface() : 0;
|
oldContextSurface = ctx ? ctx->surface() : 0;
|
||||||
|
// 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.
|
// Cannot just make the current surface current again with another context.
|
||||||
// The format may be incompatible and some platforms (iOS) may impose
|
// The format may be incompatible and some platforms (iOS) may impose
|
||||||
// restrictions on using a window with different contexts. Create an
|
// restrictions on using a window with different contexts. Create an
|
||||||
@ -218,13 +226,14 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
|
|||||||
ctx = 0;
|
ctx = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (context) {
|
if (context) {
|
||||||
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
|
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
|
||||||
context = 0;
|
context = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vao) {
|
if (vao && ctx) {
|
||||||
switch (vaoFuncsType) {
|
switch (vaoFuncsType) {
|
||||||
#ifndef QT_OPENGL_ES_2
|
#ifndef QT_OPENGL_ES_2
|
||||||
case Core_3_2:
|
case Core_3_2:
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
|
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GL_FRAMEBUFFER_SRB
|
#ifndef GL_FRAMEBUFFER_SRGB
|
||||||
#define GL_FRAMEBUFFER_SRGB 0x8DB9
|
#define GL_FRAMEBUFFER_SRGB 0x8DB9
|
||||||
#endif
|
#endif
|
||||||
#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE
|
#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE
|
||||||
|
@ -157,14 +157,12 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
|
|||||||
|
|
||||||
void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, int charsAdded)
|
void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, int charsAdded)
|
||||||
{
|
{
|
||||||
if (!inReformatBlocks)
|
if (!inReformatBlocks && !rehighlightPending)
|
||||||
reformatBlocks(from, charsRemoved, charsAdded);
|
reformatBlocks(from, charsRemoved, charsAdded);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int charsAdded)
|
void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int charsAdded)
|
||||||
{
|
{
|
||||||
rehighlightPending = false;
|
|
||||||
|
|
||||||
QTextBlock block = doc->findBlock(from);
|
QTextBlock block = doc->findBlock(from);
|
||||||
if (!block.isValid())
|
if (!block.isValid())
|
||||||
return;
|
return;
|
||||||
@ -346,9 +344,11 @@ void QSyntaxHighlighter::setDocument(QTextDocument *doc)
|
|||||||
if (d->doc) {
|
if (d->doc) {
|
||||||
connect(d->doc, SIGNAL(contentsChange(int,int,int)),
|
connect(d->doc, SIGNAL(contentsChange(int,int,int)),
|
||||||
this, SLOT(_q_reformatBlocks(int,int,int)));
|
this, SLOT(_q_reformatBlocks(int,int,int)));
|
||||||
|
if (!d->doc->isEmpty()) {
|
||||||
d->rehighlightPending = true;
|
d->rehighlightPending = true;
|
||||||
QTimer::singleShot(0, this, SLOT(_q_delayedRehighlight()));
|
QTimer::singleShot(0, this, SLOT(_q_delayedRehighlight()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -51,7 +51,9 @@
|
|||||||
#include <qregularexpression.h>
|
#include <qregularexpression.h>
|
||||||
#endif
|
#endif
|
||||||
#include <qvarlengtharray.h>
|
#include <qvarlengtharray.h>
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
|
#endif
|
||||||
#include <qthread.h>
|
#include <qthread.h>
|
||||||
#include <qcoreapplication.h>
|
#include <qcoreapplication.h>
|
||||||
#include <qmetaobject.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.
|
This function is defined in the \c <QTextDocument> header file.
|
||||||
*/
|
*/
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
QTextCodec *Qt::codecForHtml(const QByteArray &ba)
|
QTextCodec *Qt::codecForHtml(const QByteArray &ba)
|
||||||
{
|
{
|
||||||
return QTextCodec::codecForHtml(ba);
|
return QTextCodec::codecForHtml(ba);
|
||||||
|
@ -75,7 +75,7 @@ namespace Qt
|
|||||||
Q_GUI_EXPORT bool mightBeRichText(const QString&);
|
Q_GUI_EXPORT bool mightBeRichText(const QString&);
|
||||||
Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode = WhiteSpacePre);
|
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);
|
Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#include "qtextlist.h"
|
#include "qtextlist.h"
|
||||||
|
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include <qtextcodec.h>
|
|
||||||
#include <qbytearray.h>
|
#include <qbytearray.h>
|
||||||
#include <qdatastream.h>
|
#include <qdatastream.h>
|
||||||
#include <qdatetime.h>
|
#include <qdatetime.h>
|
||||||
|
@ -41,7 +41,9 @@
|
|||||||
#include <QtCore/qfile.h>
|
#include <QtCore/qfile.h>
|
||||||
#include <QtCore/qbytearray.h>
|
#include <QtCore/qbytearray.h>
|
||||||
#include <QtCore/qfileinfo.h>
|
#include <QtCore/qfileinfo.h>
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
#include <QtCore/qtextcodec.h>
|
#include <QtCore/qtextcodec.h>
|
||||||
|
#endif
|
||||||
#include <QtCore/qtextstream.h>
|
#include <QtCore/qtextstream.h>
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
#include "qtextdocument.h"
|
#include "qtextdocument.h"
|
||||||
@ -63,7 +65,7 @@ public:
|
|||||||
QByteArray format;
|
QByteArray format;
|
||||||
QIODevice *device;
|
QIODevice *device;
|
||||||
bool deleteDevice;
|
bool deleteDevice;
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
QTextCodec *codec;
|
QTextCodec *codec;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -104,7 +106,7 @@ public:
|
|||||||
QTextDocumentWriterPrivate::QTextDocumentWriterPrivate(QTextDocumentWriter *qq)
|
QTextDocumentWriterPrivate::QTextDocumentWriterPrivate(QTextDocumentWriter *qq)
|
||||||
: device(0),
|
: device(0),
|
||||||
deleteDevice(false),
|
deleteDevice(false),
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
codec(QTextCodec::codecForName("utf-8")),
|
codec(QTextCodec::codecForName("utf-8")),
|
||||||
#endif
|
#endif
|
||||||
q(qq)
|
q(qq)
|
||||||
@ -258,7 +260,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
|
|||||||
#ifndef QT_NO_TEXTODFWRITER
|
#ifndef QT_NO_TEXTODFWRITER
|
||||||
if (format == "odf" || format == "opendocumentformat" || format == "odt") {
|
if (format == "odf" || format == "opendocumentformat" || format == "odt") {
|
||||||
QTextOdfWriter writer(*document, d->device);
|
QTextOdfWriter writer(*document, d->device);
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
writer.setCodec(d->codec);
|
writer.setCodec(d->codec);
|
||||||
#endif
|
#endif
|
||||||
return writer.writeAll();
|
return writer.writeAll();
|
||||||
@ -272,7 +274,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QTextStream ts(d->device);
|
QTextStream ts(d->device);
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
ts.setCodec(d->codec);
|
ts.setCodec(d->codec);
|
||||||
ts << document->toHtml(d->codec->name());
|
ts << document->toHtml(d->codec->name());
|
||||||
#endif
|
#endif
|
||||||
@ -286,7 +288,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QTextStream ts(d->device);
|
QTextStream ts(d->device);
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
ts.setCodec(d->codec);
|
ts.setCodec(d->codec);
|
||||||
#endif
|
#endif
|
||||||
ts << document->toPlainText();
|
ts << document->toPlainText();
|
||||||
@ -317,7 +319,7 @@ bool QTextDocumentWriter::write(const QTextDocumentFragment &fragment)
|
|||||||
uses UTF-8.
|
uses UTF-8.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
void QTextDocumentWriter::setCodec(QTextCodec *codec)
|
void QTextDocumentWriter::setCodec(QTextCodec *codec)
|
||||||
{
|
{
|
||||||
if (codec == 0)
|
if (codec == 0)
|
||||||
@ -330,7 +332,7 @@ void QTextDocumentWriter::setCodec(QTextCodec *codec)
|
|||||||
/*!
|
/*!
|
||||||
Returns the codec that is currently assigned to the writer.
|
Returns the codec that is currently assigned to the writer.
|
||||||
*/
|
*/
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
QTextCodec *QTextDocumentWriter::codec() const
|
QTextCodec *QTextDocumentWriter::codec() const
|
||||||
{
|
{
|
||||||
return d->codec;
|
return d->codec;
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
bool write(const QTextDocument *document);
|
bool write(const QTextDocument *document);
|
||||||
bool write(const QTextDocumentFragment &fragment);
|
bool write(const QTextDocumentFragment &fragment);
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
void setCodec(QTextCodec *codec);
|
void setCodec(QTextCodec *codec);
|
||||||
QTextCodec *codec() const;
|
QTextCodec *codec() const;
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
#include "qtexthtmlparser_p.h"
|
#include "qtexthtmlparser_p.h"
|
||||||
|
|
||||||
#include <qbytearray.h>
|
#include <qbytearray.h>
|
||||||
#include <qtextcodec.h>
|
|
||||||
#include <qstack.h>
|
#include <qstack.h>
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include <qthread.h>
|
#include <qthread.h>
|
||||||
|
@ -961,7 +961,7 @@ bool QTextOdfWriter::writeAll()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QXmlStreamWriter writer(m_strategy->contentStream);
|
QXmlStreamWriter writer(m_strategy->contentStream);
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
if (m_codec)
|
if (m_codec)
|
||||||
writer.setCodec(m_codec);
|
writer.setCodec(m_codec);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1383,23 +1383,6 @@ bool QSocks5SocketEngine::bind(const QHostAddress &addr, quint16 port)
|
|||||||
d->localAddress = QHostAddress();
|
d->localAddress = QHostAddress();
|
||||||
d->udpData->associatePort = d->localPort;
|
d->udpData->associatePort = d->localPort;
|
||||||
d->localPort = 0;
|
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;
|
return true;
|
||||||
#endif // QT_NO_UDPSOCKET
|
#endif // QT_NO_UDPSOCKET
|
||||||
}
|
}
|
||||||
|
@ -418,8 +418,10 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q
|
|||||||
QVariant ret;
|
QVariant ret;
|
||||||
if (flavor == QLatin1String("public.utf8-plain-text")) {
|
if (flavor == QLatin1String("public.utf8-plain-text")) {
|
||||||
ret = QString::fromUtf8(firstData);
|
ret = QString::fromUtf8(firstData);
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
} else if (flavor == QLatin1String("public.utf16-plain-text")) {
|
} else if (flavor == QLatin1String("public.utf16-plain-text")) {
|
||||||
ret = QTextCodec::codecForName("UTF-16")->toUnicode(firstData);
|
ret = QTextCodec::codecForName("UTF-16")->toUnicode(firstData);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
|
qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
|
||||||
}
|
}
|
||||||
@ -432,8 +434,10 @@ QList<QByteArray> QMacPasteboardMimeUnicodeText::convertFromMime(const QString &
|
|||||||
QString string = data.toString();
|
QString string = data.toString();
|
||||||
if (flavor == QLatin1String("public.utf8-plain-text"))
|
if (flavor == QLatin1String("public.utf8-plain-text"))
|
||||||
ret.append(string.toUtf8());
|
ret.append(string.toUtf8());
|
||||||
|
#if QT_CONFIG(textcodec)
|
||||||
else if (flavor == QLatin1String("public.utf16-plain-text"))
|
else if (flavor == QLatin1String("public.utf16-plain-text"))
|
||||||
ret.append(QTextCodec::codecForName("UTF-16")->fromUnicode(string));
|
ret.append(QTextCodec::codecForName("UTF-16")->fromUnicode(string));
|
||||||
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,9 +63,9 @@ QFbCursor::QFbCursor(QFbScreen *screen)
|
|||||||
mCursorImage(nullptr),
|
mCursorImage(nullptr),
|
||||||
mDeviceListener(nullptr)
|
mDeviceListener(nullptr)
|
||||||
{
|
{
|
||||||
QByteArray hideCursorVal = qgetenv("QT_QPA_FB_HIDECURSOR");
|
const char *envVar = "QT_QPA_FB_HIDECURSOR";
|
||||||
if (!hideCursorVal.isEmpty())
|
if (qEnvironmentVariableIsSet(envVar))
|
||||||
mVisible = hideCursorVal.toInt() == 0;
|
mVisible = qEnvironmentVariableIntValue(envVar) == 0;
|
||||||
if (!mVisible)
|
if (!mVisible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ QFbCursor::~QFbCursor()
|
|||||||
delete mDeviceListener;
|
delete mDeviceListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect QFbCursor::getCurrentRect()
|
QRect QFbCursor::getCurrentRect() const
|
||||||
{
|
{
|
||||||
QRect rect = mCursorImage->image()->rect().translated(-mCursorImage->hotspot().x(),
|
QRect rect = mCursorImage->image()->rect().translated(-mCursorImage->hotspot().x(),
|
||||||
-mCursorImage->hotspot().y());
|
-mCursorImage->hotspot().y());
|
||||||
@ -102,6 +102,8 @@ void QFbCursor::setPos(const QPoint &pos)
|
|||||||
{
|
{
|
||||||
QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos);
|
QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos);
|
||||||
m_pos = pos;
|
m_pos = pos;
|
||||||
|
if (!mVisible)
|
||||||
|
return;
|
||||||
mCurrentRect = getCurrentRect();
|
mCurrentRect = getCurrentRect();
|
||||||
if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft())))
|
if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft())))
|
||||||
setDirty();
|
setDirty();
|
||||||
@ -112,6 +114,8 @@ void QFbCursor::pointerEvent(const QMouseEvent &e)
|
|||||||
if (e.type() != QEvent::MouseMove)
|
if (e.type() != QEvent::MouseMove)
|
||||||
return;
|
return;
|
||||||
m_pos = e.screenPos().toPoint();
|
m_pos = e.screenPos().toPoint();
|
||||||
|
if (!mVisible)
|
||||||
|
return;
|
||||||
mCurrentRect = getCurrentRect();
|
mCurrentRect = getCurrentRect();
|
||||||
if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft())))
|
if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft())))
|
||||||
setDirty();
|
setDirty();
|
||||||
@ -149,16 +153,19 @@ QRect QFbCursor::dirtyRect()
|
|||||||
|
|
||||||
void QFbCursor::setCursor(Qt::CursorShape shape)
|
void QFbCursor::setCursor(Qt::CursorShape shape)
|
||||||
{
|
{
|
||||||
|
if (mCursorImage)
|
||||||
mCursorImage->set(shape);
|
mCursorImage->set(shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFbCursor::setCursor(const QImage &image, int hotx, int hoty)
|
void QFbCursor::setCursor(const QImage &image, int hotx, int hoty)
|
||||||
{
|
{
|
||||||
|
if (mCursorImage)
|
||||||
mCursorImage->set(image, hotx, hoty);
|
mCursorImage->set(image, hotx, hoty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFbCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
|
void QFbCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
|
||||||
{
|
{
|
||||||
|
if (mCursorImage)
|
||||||
mCursorImage->set(data, mask, width, height, hotX, hotY);
|
mCursorImage->set(data, mask, width, height, hotX, hotY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,6 +173,8 @@ void QFbCursor::setCursor(const uchar *data, const uchar *mask, int width, int h
|
|||||||
void QFbCursor::changeCursor(QCursor * widgetCursor, QWindow *window)
|
void QFbCursor::changeCursor(QCursor * widgetCursor, QWindow *window)
|
||||||
{
|
{
|
||||||
Q_UNUSED(window);
|
Q_UNUSED(window);
|
||||||
|
if (!mVisible)
|
||||||
|
return;
|
||||||
const Qt::CursorShape shape = widgetCursor ? widgetCursor->shape() : Qt::ArrowCursor;
|
const Qt::CursorShape shape = widgetCursor ? widgetCursor->shape() : Qt::ArrowCursor;
|
||||||
|
|
||||||
if (shape == Qt::BitmapCursor) {
|
if (shape == Qt::BitmapCursor) {
|
||||||
@ -196,7 +205,7 @@ void QFbCursor::setDirty()
|
|||||||
|
|
||||||
void QFbCursor::updateMouseStatus()
|
void QFbCursor::updateMouseStatus()
|
||||||
{
|
{
|
||||||
mVisible = mDeviceListener->hasMouse();
|
mVisible = mDeviceListener ? mDeviceListener->hasMouse() : false;
|
||||||
mScreen->setDirty(mVisible ? getCurrentRect() : lastPainted());
|
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(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY);
|
||||||
void setCursor(Qt::CursorShape shape);
|
void setCursor(Qt::CursorShape shape);
|
||||||
void setCursor(const QImage &image, int hotx, int hoty);
|
void setCursor(const QImage &image, int hotx, int hoty);
|
||||||
QRect getCurrentRect();
|
QRect getCurrentRect() const;
|
||||||
|
|
||||||
bool mVisible;
|
bool mVisible;
|
||||||
QFbScreen *mScreen;
|
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 QLibInputKeyboard::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers *modifiers, const QString &text) const
|
||||||
{
|
{
|
||||||
int code = 0;
|
int code = 0;
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
QTextCodec *systemCodec = QTextCodec::codecForLocale();
|
QTextCodec *systemCodec = QTextCodec::codecForLocale();
|
||||||
#endif
|
#endif
|
||||||
if (keysym < 128 || (keysym < 256
|
if (keysym < 128 || (keysym < 256
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
&& systemCodec->mibEnum() == 4
|
&& systemCodec->mibEnum() == 4
|
||||||
#endif
|
#endif
|
||||||
)) {
|
)) {
|
||||||
|
@ -213,7 +213,7 @@ void QGIFFormat::disposePrevious(QImage *image)
|
|||||||
case RestoreImage: {
|
case RestoreImage: {
|
||||||
if (frame >= 0) {
|
if (frame >= 0) {
|
||||||
for (int ln=t; ln<=b; ln++) {
|
for (int ln=t; ln<=b; ln++) {
|
||||||
memcpy(image->scanLine(ln)+l,
|
memcpy(image->scanLine(ln)+l*sizeof(QRgb),
|
||||||
backingstore.constScanLine(ln-t),
|
backingstore.constScanLine(ln-t),
|
||||||
(r-l+1)*sizeof(QRgb));
|
(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();
|
unsigned char *dest_data = backingstore.bits();
|
||||||
for (int ln=0; ln<h; ln++) {
|
for (int ln=0; ln<h; ln++) {
|
||||||
memcpy(FAST_SCAN_LINE(dest_data, dest_bpl, 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 <qbuffer.h>
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
#include <qtextcodec.h>
|
|
||||||
#include <qvarlengtharray.h>
|
#include <qvarlengtharray.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <qabstracteventdispatcher.h>
|
#include <qabstracteventdispatcher.h>
|
||||||
|
@ -216,8 +216,13 @@ NSOpenGLPixelFormat *QCocoaGLContext::pixelFormatForSurfaceFormat(const QSurface
|
|||||||
<< NSOpenGLPFASamples << NSOpenGLPixelFormatAttribute(format.samples());
|
<< NSOpenGLPFASamples << NSOpenGLPixelFormatAttribute(format.samples());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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
|
// Allow rendering on GPUs without a connected display
|
||||||
attrs << NSOpenGLPFAAllowOfflineRenderers;
|
attrs << NSOpenGLPFAAllowOfflineRenderers;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: Pull this information out of the NSView
|
// FIXME: Pull this information out of the NSView
|
||||||
QByteArray useLayer = qgetenv("QT_MAC_WANTS_LAYER");
|
QByteArray useLayer = qgetenv("QT_MAC_WANTS_LAYER");
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
//
|
//
|
||||||
#include "qt_mac_p.h"
|
#include "qt_mac_p.h"
|
||||||
#include <private/qguiapplication_p.h>
|
#include <private/qguiapplication_p.h>
|
||||||
|
#include <QtCore/qoperatingsystemversion.h>
|
||||||
#include <QtGui/qpalette.h>
|
#include <QtGui/qpalette.h>
|
||||||
#include <QtGui/qscreen.h>
|
#include <QtGui/qscreen.h>
|
||||||
|
|
||||||
@ -60,6 +61,8 @@
|
|||||||
|
|
||||||
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSView));
|
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSView));
|
||||||
|
|
||||||
|
struct mach_header;
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
Q_DECLARE_LOGGING_CATEGORY(lcQpaWindow)
|
Q_DECLARE_LOGGING_CATEGORY(lcQpaWindow)
|
||||||
@ -173,6 +176,34 @@ T qt_mac_resolveOption(const T &fallback, QWindow *window, const QByteArray &pro
|
|||||||
return fallback;
|
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
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
// @compatibility_alias doesn't work with protocols
|
// @compatibility_alias doesn't work with protocols
|
||||||
|
@ -55,6 +55,9 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window");
|
Q_LOGGING_CATEGORY(lcQpaWindow, "qt.qpa.window");
|
||||||
@ -368,6 +371,85 @@ QString qt_mac_removeAmpersandEscapes(QString s)
|
|||||||
return QPlatformTheme::removeMnemonics(s).trimmed();
|
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
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
|
@ -79,6 +79,32 @@ static void initResources()
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
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 QCoreTextFontEngine;
|
||||||
class QFontEngineFT;
|
class QFontEngineFT;
|
||||||
|
|
||||||
@ -112,6 +138,8 @@ QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList)
|
|||||||
, mServices(new QCocoaServices)
|
, mServices(new QCocoaServices)
|
||||||
, mKeyboardMapper(new QCocoaKeyMapper)
|
, mKeyboardMapper(new QCocoaKeyMapper)
|
||||||
{
|
{
|
||||||
|
logVersionInformation();
|
||||||
|
|
||||||
if (mInstance)
|
if (mInstance)
|
||||||
qWarning("Creating multiple Cocoa platform integrations is not supported");
|
qWarning("Creating multiple Cocoa platform integrations is not supported");
|
||||||
mInstance = this;
|
mInstance = this;
|
||||||
|
@ -542,6 +542,12 @@ void QCocoaWindow::setWindowZoomButton(Qt::WindowFlags flags)
|
|||||||
|
|
||||||
void QCocoaWindow::setWindowFlags(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())
|
if (!isContentView())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1373,11 +1379,14 @@ void QCocoaWindow::recreateWindowIfNeeded()
|
|||||||
if (m_windowModality != window()->modality())
|
if (m_windowModality != window()->modality())
|
||||||
recreateReason |= WindowModalityChanged;
|
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)
|
if (isContentView() != shouldBeContentView)
|
||||||
recreateReason |= ContentViewChanged;
|
recreateReason |= ContentViewChanged;
|
||||||
|
|
||||||
Qt::WindowType type = window()->type();
|
|
||||||
const bool isPanel = isContentView() && [m_view.window isKindOfClass:[QNSPanel class]];
|
const bool isPanel = isContentView() && [m_view.window isKindOfClass:[QNSPanel class]];
|
||||||
const bool shouldBePanel = shouldBeContentView &&
|
const bool shouldBePanel = shouldBeContentView &&
|
||||||
((type & Qt::Popup) == Qt::Popup || (type & Qt::Dialog) == Qt::Dialog);
|
((type & Qt::Popup) == Qt::Popup || (type & Qt::Dialog) == Qt::Dialog);
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
#include <private/qpaintengine_raster_p.h>
|
#include <private/qpaintengine_raster_p.h>
|
||||||
#include <qprinter.h>
|
#include <qprinter.h>
|
||||||
#include <qstack.h>
|
#include <qstack.h>
|
||||||
#include <qtextcodec.h>
|
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
#include <qvarlengtharray.h>
|
#include <qvarlengtharray.h>
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
|
@ -71,6 +71,7 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen)
|
|||||||
, m_bo(nullptr)
|
, m_bo(nullptr)
|
||||||
, m_cursorImage(0, 0, 0, 0, 0, 0)
|
, m_cursorImage(0, 0, 0, 0, 0, 0)
|
||||||
, m_state(CursorPendingVisible)
|
, m_state(CursorPendingVisible)
|
||||||
|
, m_deviceListener(nullptr)
|
||||||
{
|
{
|
||||||
QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR");
|
QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR");
|
||||||
if (!hideCursorVal.isEmpty() && hideCursorVal.toInt()) {
|
if (!hideCursorVal.isEmpty() && hideCursorVal.toInt()) {
|
||||||
|
@ -312,7 +312,7 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
|
|||||||
case AllGLFunctionsQueryable:
|
case AllGLFunctionsQueryable:
|
||||||
return true;
|
return true;
|
||||||
case SwitchableWidgetComposition:
|
case SwitchableWidgetComposition:
|
||||||
return true;
|
return false; // QTBUG-68329 QTBUG-53515 QTBUG-54734
|
||||||
default:
|
default:
|
||||||
return QPlatformIntegration::hasCapability(cap);
|
return QPlatformIntegration::hasCapability(cap);
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#undef register
|
#undef register
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
|
|
||||||
|
#include <QtCore/QRegularExpression>
|
||||||
#include <QtGui/QOpenGLContext>
|
#include <QtGui/QOpenGLContext>
|
||||||
#include <QtGui/QOffscreenSurface>
|
#include <QtGui/QOffscreenSurface>
|
||||||
|
|
||||||
@ -692,32 +693,6 @@ static const char *qglx_threadedgl_blacklist_renderer[] = {
|
|||||||
0
|
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()
|
void QGLXContext::queryDummyContext()
|
||||||
{
|
{
|
||||||
if (m_queriedDummyContext)
|
if (m_queriedDummyContext)
|
||||||
@ -777,17 +752,32 @@ void QGLXContext::queryDummyContext()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glxvendor) {
|
if (glxvendor && m_supportsThreading) {
|
||||||
for (int i = 0; qglx_threadedgl_blacklist_vendor[i]; ++i) {
|
// Blacklist Mesa drivers due to QTCREATORBUG-10875 (crash in creator),
|
||||||
if (strstr(glxvendor, qglx_threadedgl_blacklist_vendor[i]) != 0) {
|
// QTBUG-34492 (flickering in fullscreen) and QTBUG-38221
|
||||||
qCDebug(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: "
|
const char *mesaVersionStr = nullptr;
|
||||||
"blacklisted vendor \""
|
if (strstr(glxvendor, "Mesa Project") != 0) {
|
||||||
<< qglx_threadedgl_blacklist_vendor[i]
|
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\"";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,6 +255,7 @@ static const uint8_t * const cursor_bits20[] = {
|
|||||||
forbidden_bits, forbiddenm_bits
|
forbidden_bits, forbiddenm_bits
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ### FIXME This mapping is incomplete - QTBUG-71423
|
||||||
static const std::vector<const char *> cursorNames[] = {
|
static const std::vector<const char *> cursorNames[] = {
|
||||||
{ "left_ptr", "default", "top_left_arrow", "left_arrow" },
|
{ "left_ptr", "default", "top_left_arrow", "left_arrow" },
|
||||||
{ "up_arrow" },
|
{ "up_arrow" },
|
||||||
@ -273,7 +274,7 @@ static const std::vector<const char *> cursorNames[] = {
|
|||||||
{ "forbidden", "not-allowed", "crossed_circle", "circle", "03b6e0fcb3499374a867c041f52298f0" },
|
{ "forbidden", "not-allowed", "crossed_circle", "circle", "03b6e0fcb3499374a867c041f52298f0" },
|
||||||
{ "whats_this", "help", "question_arrow", "5c6cd98b3f3ebcb1f9c7f1c204630408", "d9ce0ab605698f320427677b458ad60b" },
|
{ "whats_this", "help", "question_arrow", "5c6cd98b3f3ebcb1f9c7f1c204630408", "d9ce0ab605698f320427677b458ad60b" },
|
||||||
{ "left_ptr_watch", "half-busy", "progress", "00000000000000020006000e7e9ffc3f", "08e8e1c95fe2fc01f976f1e063a24ccd" },
|
{ "left_ptr_watch", "half-busy", "progress", "00000000000000020006000e7e9ffc3f", "08e8e1c95fe2fc01f976f1e063a24ccd" },
|
||||||
{ "openhand", "fleur", "5aca4d189052212118709018842178c0", "9d800788f1b08800ae810202380a0822" },
|
{ "openhand", "grab", "fleur", "5aca4d189052212118709018842178c0", "9d800788f1b08800ae810202380a0822" },
|
||||||
{ "closedhand", "grabbing", "208530c400c041818281048008011002" },
|
{ "closedhand", "grabbing", "208530c400c041818281048008011002" },
|
||||||
{ "dnd-copy", "copy" },
|
{ "dnd-copy", "copy" },
|
||||||
{ "dnd-move", "move" },
|
{ "dnd-move", "move" },
|
||||||
|
@ -168,7 +168,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
|
|||||||
if (!encoding.isEmpty()
|
if (!encoding.isEmpty()
|
||||||
&& atomName == format + QLatin1String(";charset=") + QLatin1String(encoding)) {
|
&& atomName == format + QLatin1String(";charset=") + QLatin1String(encoding)) {
|
||||||
|
|
||||||
#ifndef QT_NO_TEXTCODEC
|
#if QT_CONFIG(textcodec)
|
||||||
if (requestedType == QVariant::String) {
|
if (requestedType == QVariant::String) {
|
||||||
QTextCodec *codec = QTextCodec::codecForName(encoding);
|
QTextCodec *codec = QTextCodec::codecForName(encoding);
|
||||||
if (codec)
|
if (codec)
|
||||||
|
@ -112,13 +112,6 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t
|
|||||||
|
|
||||||
xcb_depth_next(&depth_iterator);
|
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()
|
QXcbVirtualDesktop::~QXcbVirtualDesktop()
|
||||||
|