Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev

This commit is contained in:
Simon Hausmann 2014-05-22 14:24:28 +02:00 committed by The Qt Project
commit 2064bf6155
87 changed files with 1002 additions and 312 deletions

9
configure vendored
View File

@ -3663,9 +3663,9 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
echo "########################################################################" >> "$mkfile"
EXTRA_OBJS=
EXTRA_SRCS=
EXTRA_CFLAGS="\$(QMAKE_CFLAGS)"
EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS)"
EXTRA_LFLAGS="\$(QMAKE_LFLAGS)"
EXTRA_CFLAGS="\$(QMAKE_CFLAGS) \$(QMAKE_CFLAGS_SPLIT_SECTIONS)"
EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)"
EXTRA_LFLAGS="\$(QMAKE_LFLAGS) \$(QMAKE_LFLAGS_GCSECTIONS)"
if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then
EXTRA_LFLAGS="$EXTRA_LFLAGS -lm"
@ -3675,8 +3675,11 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
setBootstrapVariable QMAKE_CC CC "$CC_TRANSFORM"
setBootstrapVariable QMAKE_CXX CXX "$CC_TRANSFORM"
setBootstrapVariable QMAKE_CFLAGS
setBootstrapVariable QMAKE_CFLAGS_SPLIT_SECTIONS
setBootstrapVariable QMAKE_CXXFLAGS
setBootstrapVariable QMAKE_CXXFLAGS_SPLIT_SECTIONS
setBootstrapVariable QMAKE_LFLAGS
setBootstrapVariable QMAKE_LFLAGS_GCSECTIONS
if [ "$CFG_RELEASE_QMAKE" = "yes" ]; then
setBootstrapVariable QMAKE_CFLAGS_RELEASE

View File

@ -47,6 +47,7 @@ QMAKE_CFLAGS_ISYSTEM = -isystem
QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses
QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden
QMAKE_CFLAGS_EXCEPTIONS_OFF += -fno-exceptions
QMAKE_CFLAGS_SPLIT_SECTIONS += -ffunction-sections
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS
QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS
@ -60,6 +61,7 @@ QMAKE_CXXFLAGS_APP += $$QMAKE_CFLAGS_APP
QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC
QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
QMAKE_CXXFLAGS_EXCEPTIONS_OFF += $$QMAKE_CFLAGS_EXCEPTIONS_OFF
QMAKE_CXXFLAGS_SPLIT_SECTIONS += $$QMAKE_CFLAGS_SPLIT_SECTIONS
QMAKE_LFLAGS +=
QMAKE_LFLAGS_DEBUG +=

View File

@ -6,6 +6,7 @@ QMAKE_PLATFORM += linux
QMAKE_CFLAGS_THREAD += -D_REENTRANT
QMAKE_CXXFLAGS_THREAD += $$QMAKE_CFLAGS_THREAD
QMAKE_LFLAGS_GCSECTIONS = -Wl,--gc-sections
QMAKE_INCDIR =
QMAKE_LIBDIR =

View File

@ -18,6 +18,7 @@ QMAKE_INCDIR_OPENGL = \
QMAKE_FIX_RPATH = install_name_tool -id
QMAKE_LFLAGS_RPATH =
QMAKE_LFLAGS_GCSECTIONS = -Wl,-dead_strip
QMAKE_LIBS_DYNLOAD =
QMAKE_LIBS_OPENGL = -framework OpenGL -framework AGL

View File

@ -16,6 +16,9 @@ DESTDIR = $$MODULE_BASE_OUTDIR/bin
isEmpty(QMAKE_INFO_PLIST): CONFIG -= app_bundle
# This decreases the binary size for tools if statically linked
QMAKE_LFLAGS += $$QMAKE_LFLAGS_GCSECTIONS
host_build: QT -= gui # no host tool will ever use gui
host_build:force_bootstrap {
!build_pass: CONFIG += release

View File

@ -34,8 +34,12 @@ QMAKE_DIR_REPLACE_SANE = PRECOMPILED_DIR OBJECTS_DIR MOC_DIR RCC_DIR UI_DIR
!build_pass:!isEmpty(_QMAKE_SUPER_CACHE_):force_independent {
# When doing a -prefix build of top-level qt5/qt.pro, we need to announce
# this repo's module pris' location to the other repos.
isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$shadowed($$dirname(_QMAKE_CONF_))
# this repo's output dir to the other repos.
MODULE_BASE_OUTDIR = $$shadowed($$dirname(_QMAKE_CONF_))
!contains(QTREPOS, $$MODULE_BASE_OUTDIR): \
cache(QTREPOS, add super, MODULE_BASE_OUTDIR)
# This repo's module pris' location needs to be made known to qmake.
isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$MODULE_BASE_OUTDIR
modpath = $$MODULE_QMAKE_OUTDIR/mkspecs/modules
!contains(QMAKEMODULES, $$modpath): \
cache(QMAKEMODULES, add super, modpath)

View File

@ -23,8 +23,9 @@ QDOC += -outputdir $$QMAKE_DOCS_OUTPUTDIR
!build_online_docs: \
QDOC += -installdir $$[QT_INSTALL_DOCS]
DOC_INDEXES =
for(qmod, QMAKEMODULES): \
DOC_INDEXES += -indexdir $$section(qmod, /, 0, -3)/doc
for(qrep, QTREPOS): \
exists($$qrep/doc): \
DOC_INDEXES += -indexdir $$qrep/doc
qtver.name = QT_VERSION
qtver.value = $$VERSION
isEmpty(qtver.value): qtver.value = $$MODULE_VERSION

View File

@ -20,8 +20,8 @@ contains(QT_CONFIG, build_all): CONFIG += build_all
DESTDIR = $$MODULE_BASE_OUTDIR/lib
DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin
# Static builds always need to be installed, as the convenience libraries
# are not linked to the final library in this case.
installed|static: load(qt_installs)
# In static builds of Qt, convenience libraries must be installed,
# as in this case they are not linked to the final library/plugin.
installed|contains(QT_CONFIG, static): load(qt_installs)
TARGET = $$qtLibraryTarget($$TARGET)

View File

@ -29,6 +29,8 @@ host_build|staticlib: CONFIG += static
host_build {
QT -= gui # no host module will ever use gui
QMAKE_CFLAGS += $$QMAKE_CFLAGS_SPLIT_SECTIONS
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_SPLIT_SECTIONS
force_bootstrap {
!build_pass: CONFIG += release
contains(QT, core(-private)?|xml) {

View File

@ -23,6 +23,7 @@ QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CFLAGS_YACC =
QMAKE_CFLAGS_ISYSTEM = -isystem
QMAKE_CFLAGS_THREAD = -D_REENTRANT
QMAKE_CFLAGS_SPLIT_SECTIONS = -ffunction-sections
QMAKE_CFLAGS_SSE2 += -xSSE2
QMAKE_CFLAGS_SSE3 += -xSSE3
@ -44,6 +45,7 @@ QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CXXFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_STATIC_LIB
QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
QMAKE_CXXFLAGS_SPLIT_SECTIONS = $$QMAKE_CFLAGS_SPLIT_SECTIONS
# Disabling exceptions disabled - workaround for QTBUG-36577
#QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -fno-exceptions
QMAKE_CXXFLAGS_CXX11 = -std=c++0x

View File

@ -22,6 +22,7 @@ QMAKE_CFLAGS_SHLIB = -fPIC -fno-jump-tables
QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
QMAKE_CFLAGS_THREAD =
QMAKE_CFLAGS_SPLIT_SECTIONS = -ffunction-sections
QMAKE_CFLAGS_SSE2 += -xSSE2
QMAKE_CFLAGS_SSE3 += -xSSE3
@ -51,6 +52,7 @@ QMAKE_CXXFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_STATIC_LIB
QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
QMAKE_CXXFLAGS_CXX11 = -std=c++11
QMAKE_CXXFLAGS_SPLIT_SECTIONS = $$QMAKE_CFLAGS_SPLIT_SECTIONS
QMAKE_LINK = icpc
QMAKE_LINK_SHLIB = icpc

View File

@ -32,6 +32,7 @@ QMAKE_CFLAGS_WARN_OFF = -w
QMAKE_CFLAGS_RELEASE = -O2
QMAKE_CFLAGS_DEBUG = -g
QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
QMAKE_CFLAGS_SPLIT_SECTIONS = -ffunction-sections
QMAKE_CFLAGS_SSE2 = -msse2 -mstackrealign
QMAKE_CFLAGS_SSE3 = -msse3
QMAKE_CFLAGS_SSSE3 = -mssse3
@ -56,6 +57,7 @@ QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -fno-exceptions
QMAKE_CXXFLAGS_CXX11 = -std=c++0x
QMAKE_CXXFLAGS_SPLIT_SECTIONS = $$QMAKE_CFLAGS_SPLIT_SECTIONS
QMAKE_INCDIR =
@ -75,6 +77,7 @@ QMAKE_LFLAGS_CONSOLE = -Wl,-subsystem,console
QMAKE_LFLAGS_WINDOWS = -Wl,-subsystem,windows
QMAKE_LFLAGS_DLL = -shared
QMAKE_LFLAGS_CXX11 =
QMAKE_LFLAGS_GCSECTIONS = -Wl,--gc-sections
QMAKE_LINK_OBJECT_MAX = 10
QMAKE_LINK_OBJECT_SCRIPT = object_script
QMAKE_PREFIX_STATICLIB = lib

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake application of the Qt Toolkit.
@ -1386,9 +1386,13 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") &&
project->isActiveConfig("lib_bundle"))) {
QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString(), Option::output_dir, input_dir);
if (plist.isEmpty())
if (!plist.isEmpty()) {
if (exists(plist))
t << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", plist) << ";\n";
else
warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", plist.toLatin1().constData());
} else {
plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
if (exists(plist)) {
QFile plist_in_file(plist);
if (plist_in_file.open(QIODevice::ReadOnly)) {
QTextStream plist_in(&plist_in_file);
@ -1418,8 +1422,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", "Info.plist") << ";\n";
}
}
} else {
warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", plist.toLatin1().constData());
}
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake application of the Qt Toolkit.
@ -732,6 +732,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
//copy the plist
QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString())),
info_plist_out = escapeFilePath(project->first("QMAKE_INFO_PLIST_OUT").toQString());
if (info_plist.isEmpty())
info_plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
bundledFiles << info_plist_out;
QString destdir = info_plist_out.section(Option::dir_sep, 0, -2);
t << info_plist_out << ": \n\t";
@ -1269,8 +1271,6 @@ void UnixMakefileGenerator::init2()
if(plist.isEmpty())
plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
if(exists(Option::fixPathToLocalOS(plist))) {
if(project->isEmpty("QMAKE_INFO_PLIST"))
project->values("QMAKE_INFO_PLIST").append(plist);
project->values("QMAKE_INFO_PLIST_OUT").append(project->first("DESTDIR") +
project->first("QMAKE_BUNDLE") +
"/Contents/Info.plist");

View File

@ -3,7 +3,7 @@ TARGET = qtharfbuzzng
CONFIG += \
static \
hide_symbols \
exceptions_off rtti_off
exceptions_off rtti_off warn_off
load(qt_helper_lib)

View File

@ -4,7 +4,6 @@
#define HAVE_OT
#define HAVE_ATEXIT
#define HB_NO_MT
#define HB_NO_UNICODE_FUNCS
#define HB_DISABLE_DEPRECATED

View File

@ -0,0 +1,19 @@
diff --git a/src/3rdparty/xkbcommon/src/x11/util.c b/src/3rdparty/xkbcommon/src/x11/util.c
index 92ff2e6..7659c71 100644
--- a/src/3rdparty/xkbcommon/src/x11/util.c
+++ b/src/3rdparty/xkbcommon/src/x11/util.c
@@ -198,8 +198,12 @@ adopt_atoms(struct xkb_context *ctx, xcb_connection_t *conn,
* sit there waiting. Sad.
*/
err_discard:
- for (size_t j = i + 1; j < stop; j++)
- xcb_discard_reply(conn, cookies[j].sequence);
+ for (size_t j = i + 1; j < stop; j++) {
+ if (from[j] != XCB_ATOM_NONE) {
+ reply = xcb_get_atom_name_reply(conn, cookies[j % SIZE], NULL);
+ free(reply);
+ }
+ }
return false;
}
}

View File

@ -198,8 +198,12 @@ adopt_atoms(struct xkb_context *ctx, xcb_connection_t *conn,
* sit there waiting. Sad.
*/
err_discard:
for (size_t j = i + 1; j < stop; j++)
xcb_discard_reply(conn, cookies[j].sequence);
for (size_t j = i + 1; j < stop; j++) {
if (from[j] != XCB_ATOM_NONE) {
reply = xcb_get_atom_name_reply(conn, cookies[j % SIZE], NULL);
free(reply);
}
}
return false;
}
}

View File

@ -240,8 +240,12 @@ public class QtAccessibilityDelegate extends View.AccessibilityDelegate
node.setClassName(m_view.getClass().getName() + DEFAULT_CLASS_NAME);
node.setPackageName(m_view.getContext().getPackageName());
if (!QtNativeAccessibility.populateNode(virtualViewId, node))
return node;
// set only if valid, otherwise we return a node that is invalid and will crash when accessed
node.setSource(m_view, virtualViewId);
QtNativeAccessibility.populateNode(virtualViewId, node);
if (TextUtils.isEmpty(node.getText()) && TextUtils.isEmpty(node.getContentDescription()))
Log.w(TAG, "AccessibilityNodeInfo with empty contentDescription: " + virtualViewId);

View File

@ -54,5 +54,5 @@ class QtNativeAccessibility
static native int hitTest(float x, float y);
static native boolean clickAction(int objectId);
static native void populateNode(int objectId, AccessibilityNodeInfo node);
static native boolean populateNode(int objectId, AccessibilityNodeInfo node);
}

View File

@ -170,6 +170,13 @@ public class QtActivityDelegate
m_layout.requestLayout();
}
public void updateFullScreen()
{
if (m_fullScreen) {
m_fullScreen = false;
setFullScreen(true);
}
}
// input method hints - must be kept in sync with QTDIR/src/corelib/global/qnamespace.h
private final int ImhHiddenText = 0x1;
@ -213,6 +220,10 @@ public class QtActivityDelegate
return false;
m_keyboardIsVisible = visibility;
QtNative.keyboardVisibilityChanged(m_keyboardIsVisible);
if (visibility == false)
updateFullScreen(); // Hiding the keyboard clears the immersive mode, so we need to set it again.
return true;
}
public void resetSoftwareKeyboard()
@ -721,12 +732,7 @@ public class QtActivityDelegate
QtNative.updateApplicationState(ApplicationActive);
QtNative.clearLostActions();
QtNative.updateWindow();
if (m_fullScreen) {
// Suspending the app clears the immersive mode, so we need to set it again.
m_fullScreen = false; // Force the setFullScreen() call below to actually do something
setFullScreen(true);
}
updateFullScreen(); // Suspending the app clears the immersive mode, so we need to set it again.
}
}
}

View File

@ -254,7 +254,20 @@ QByteArray QUtf8::convertFromUnicode(const QChar *uc, int len, QTextCodec::Conve
QString QUtf8::convertToUnicode(const char *chars, int len)
{
QString result(len + 1, Qt::Uninitialized); // worst case
// UTF-8 to UTF-16 always needs the exact same number of words or less:
// UTF-8 UTF-16
// 1 byte 1 word
// 2 bytes 1 word
// 3 bytes 1 word
// 4 bytes 2 words (one surrogate pair)
// That is, we'll use the full buffer if the input is US-ASCII (1-byte UTF-8),
// half the buffer for U+0080-U+07FF text (e.g., Greek, Cyrillic, Arabic) or
// non-BMP text, and one third of the buffer for U+0800-U+FFFF text (e.g, CJK).
//
// The table holds for invalid sequences too: we'll insert one replacement char
// per invalid byte.
QString result(len, Qt::Uninitialized);
ushort *dst = reinterpret_cast<ushort *>(const_cast<QChar *>(result.constData()));
const uchar *src = reinterpret_cast<const uchar *>(chars);
const uchar *end = src + len;
@ -299,7 +312,18 @@ QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::Converte
int res;
uchar ch = 0;
QString result(need + len + 1, Qt::Uninitialized); // worst case
// See above for buffer requirements for stateless decoding. However, that
// fails if the state is not empty. The following situations can add to the
// requirements:
// state contains chars starts with requirement
// 1 of 2 bytes valid continuation 0
// 2 of 3 bytes same 0
// 3 bytes of 4 same +1 (need to insert surrogate pair)
// 1 of 2 bytes invalid continuation +1 (need to insert replacement and restart)
// 2 of 3 bytes same +1 (same)
// 3 of 4 bytes same +1 (same)
QString result(need + len + 1, Qt::Uninitialized);
ushort *dst = reinterpret_cast<ushort *>(const_cast<QChar *>(result.constData()));
const uchar *src = reinterpret_cast<const uchar *>(chars);
const uchar *end = src + len;
@ -322,15 +346,17 @@ QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::Converte
const uchar *begin = &remainingCharsData[1];
res = QUtf8Functions::fromUtf8<QUtf8BaseTraits>(remainingCharsData[0], dst, begin,
static_cast<const uchar *>(remainingCharsData) + remainingCharsCount + newCharsToCopy);
if (res == QUtf8BaseTraits::EndOfString) {
if (res == QUtf8BaseTraits::Error || (res == QUtf8BaseTraits::EndOfString && len == 0)) {
// special case for len == 0:
// if we were supplied an empty string, terminate the previous, unfinished sequence with error
++invalid;
*dst++ = replacement;
} else if (res == QUtf8BaseTraits::EndOfString) {
// if we got EndOfString again, then there were too few bytes in src;
// copy to our state and return
state->remainingChars = remainingCharsCount + newCharsToCopy;
memcpy(&state->state_data[0], remainingCharsData, state->remainingChars);
return QString();
} else if (res == QUtf8BaseTraits::Error) {
++invalid;
*dst++ = replacement;
} else if (!headerdone && res >= 0) {
// eat the UTF-8 BOM
headerdone = true;
@ -339,8 +365,10 @@ QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::Converte
}
// adjust src now that we have maybe consumed a few chars
//Q_ASSERT(res > remainingCharsCount)
src += res - remainingCharsCount;
if (res >= 0) {
Q_ASSERT(res > remainingCharsCount);
src += res - remainingCharsCount;
}
}
}

View File

@ -1752,7 +1752,7 @@ bool QConfFileSettingsPrivate::readIniLine(const QByteArray &data, int &dataPos,
if (i == lineStart + 1) {
char ch;
while (i < dataLen && ((ch = data.at(i) != '\n') && ch != '\r'))
while (i < dataLen && (((ch = data.at(i)) != '\n') && ch != '\r'))
++i;
lineStart = i;
} else if (!inQuotes) {

View File

@ -435,10 +435,10 @@ static inline UINT inputTimerMask()
UINT result = QS_TIMER | QS_INPUT | QS_RAWINPUT;
// QTBUG 28513, QTBUG-29097, QTBUG-29435: QS_TOUCH, QS_POINTER became part of
// QS_INPUT in Windows Kit 8. They should not be used when running on pre-Windows 8.
#if WINVER > 0x0602
#if WINVER > 0x0601
if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8)
result &= ~(QS_TOUCH | QS_POINTER);
#endif // WINVER > 0x0602
#endif // WINVER > 0x0601
return result;
}

View File

@ -127,8 +127,7 @@ QPpsAttribute QPpsAttributePrivate::createPpsAttribute(const QPpsAttributeMap &v
//
///////////////////////////
QPpsAttribute::QPpsAttribute():
d(new QPpsAttributePrivate())
QPpsAttribute::QPpsAttribute() : d(new QPpsAttributePrivate())
{
}
@ -136,7 +135,7 @@ QPpsAttribute::~QPpsAttribute()
{
}
QPpsAttribute::QPpsAttribute(const QPpsAttribute &other): d(other.d)
QPpsAttribute::QPpsAttribute(const QPpsAttribute &other) : d(other.d)
{
}
@ -147,7 +146,7 @@ QPpsAttribute &QPpsAttribute::operator=(const QPpsAttribute &other)
}
#ifdef Q_COMPILER_RVALUE_REFS
QPpsAttribute::QPpsAttribute(QPpsAttribute &&other): d(other.d)
QPpsAttribute::QPpsAttribute(QPpsAttribute &&other) : d(other.d)
{
other.d->type = QPpsAttribute::None;
}

View File

@ -94,12 +94,12 @@ Q_GLOBAL_STATIC(QPpsMaxSize, ppsMaxSize)
//
///////////////////////////////////////////////////////////////////////////////
QPpsObjectPrivate::QPpsObjectPrivate(const QString &path) :
notifier(0),
path(path),
error(EOK),
fd(-1),
readyReadEnabled(true)
QPpsObjectPrivate::QPpsObjectPrivate(const QString &path)
: notifier(0),
path(path),
error(EOK),
fd(-1),
readyReadEnabled(true)
{
}
@ -490,9 +490,9 @@ void QPpsObjectPrivate::encodeObject(pps_encoder_t *encoder, const QVariantMap &
//
///////////////////////////////////////////////////////////////////////////////
QPpsObject::QPpsObject(const QString &path, QObject *parent) :
QObject(parent),
d_ptr(new QPpsObjectPrivate(path))
QPpsObject::QPpsObject(const QString &path, QObject *parent)
: QObject(parent),
d_ptr(new QPpsObjectPrivate(path))
{
}

View File

@ -50,11 +50,11 @@
#endif
QT_BEGIN_NAMESPACE
static const char digits[] = "0123456789abcdef";
template <class Char, class Integral>
void _q_toHex(Char *&dst, Integral value)
{
static const char digits[] = "0123456789abcdef";
value = qToBigEndian(value);
const char* p = reinterpret_cast<const char*>(&value);

View File

@ -353,7 +353,8 @@ public:
inline Direction direction() const { return QChar::direction(ucs); }
inline JoiningType joiningType() const { return QChar::joiningType(ucs); }
#if QT_DEPRECATED_SINCE(5, 3)
QT_DEPRECATED inline Joining joining() const {
QT_DEPRECATED inline Joining joining() const
{
switch (QChar::joiningType(ucs)) {
case QChar::Joining_Causing: return QChar::Center;
case QChar::Joining_Dual: return QChar::Dual;

View File

@ -2405,6 +2405,9 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT
local.tm_year = sysTime.wYear - 1900;
}
#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// localtime() is required to work as if tzset() was called before it.
// localtime_r() does not have this requirement, so make an explicit call.
qt_tzset();
// Use the reentrant version of localtime() where available
// as is thread-safe and doesn't use a shared static data area
tm *res = 0;

View File

@ -125,7 +125,7 @@ static uint crc32(const Char *ptr, size_t len, uint h)
# else
p += 4;
for ( ; p <= e; p += 4)
h = _mm_crc32_u32(h, *reinterpret_cast<const uint *>(p));
h = _mm_crc32_u32(h, *reinterpret_cast<const uint *>(p - 4));
p -= 4;
len = e - p;
# endif
@ -227,12 +227,13 @@ uint qHash(QLatin1String key, uint seed) Q_DECL_NOTHROW
*/
static uint qt_create_qhash_seed()
{
uint seed = 0;
#ifndef QT_BOOTSTRAPPED
QByteArray envSeed = qgetenv("QT_HASH_SEED");
if (!envSeed.isNull())
return envSeed.toUInt();
uint seed = 0;
#ifdef Q_OS_UNIX
int randomfd = qt_safe_open("/dev/urandom", O_RDONLY);
if (randomfd == -1)
@ -259,17 +260,16 @@ static uint qt_create_qhash_seed()
seed ^= timestamp;
seed ^= (timestamp >> 32);
#ifndef QT_BOOTSTRAPPED
quint64 pid = QCoreApplication::applicationPid();
seed ^= pid;
seed ^= (pid >> 32);
#endif // QT_BOOTSTRAPPED
quintptr seedPtr = reinterpret_cast<quintptr>(&seed);
seed ^= seedPtr;
#if QT_POINTER_SIZE == 8
seed ^= (seedPtr >> 32);
#endif
#endif // QT_BOOTSTRAPPED
return seed;
}

View File

@ -949,7 +949,8 @@ public:
QChar::Direction direction() const { return QChar(*this).direction(); }
QChar::JoiningType joiningType() const { return QChar(*this).joiningType(); }
#if QT_DEPRECATED_SINCE(5, 3)
QT_DEPRECATED QChar::Joining joining() const {
QT_DEPRECATED QChar::Joining joining() const
{
switch (QChar(*this).joiningType()) {
case QChar::Joining_Causing: return QChar::Center;
case QChar::Joining_Dual: return QChar::Dual;

View File

@ -94,7 +94,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
!!ENDIF
foreach(_lib ${Libs})
string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_lib})
if (NOT TARGET Qt5::Gui_${_cmake_lib_name})
if (NOT TARGET Qt5::Gui_${_cmake_lib_name} AND NOT _Qt5Gui_${_cmake_lib_name}_LIBRARY_DONE)
find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib}
!!IF !isEmpty(CROSS_COMPILE)
PATHS \"${LibDir}\"
@ -106,42 +106,51 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
!!IF mac
set(Qt5Gui_${_cmake_lib_name}_LIBRARY "${Qt5Gui_${_cmake_lib_name}_LIBRARY}/${_lib}")
!!ENDIF
if (NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
if (\"${ARGN}\" STREQUAL \"OPTIONAL\")
break()
else()
message(FATAL_ERROR \"Failed to find \\\"${_lib}\\\" in \\\"${LibDir}\\\" with CMAKE_CXX_LIBRARY_ARCHITECTURE \\\"${CMAKE_CXX_LIBRARY_ARCHITECTURE}\\\".\")
endif()
endif()
add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS})
if (WIN32 AND NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
# The above find_library call doesn't work for finding
# libraries in Windows SDK paths outside of the proper
# environment. Just add the library name to the result
# variable instead.
# We avoid doing this in the first case because Qt may be
# compiled with another set of GL libraries (such as coming
# from ANGLE). The point of these find calls is to try to
# find the same binaries as Qt is compiled with (as they are
# in the interface of QtGui), so an effort is made to do so
# above with paths known to qmake.
set(_Qt5Gui_${_cmake_lib_name}_LIBRARY_DONE TRUE)
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
list(APPEND Qt5Gui_${Name}_LIBRARIES ${_lib})
else()
add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS})
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
_qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
_qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
!!ENDIF
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG ${_lib}d
PATHS \"${LibDir}\"
find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG ${_lib}d
PATHS \"${LibDir}\"
!!IF !mac
NO_DEFAULT_PATH
NO_DEFAULT_PATH
!!ENDIF
)
if (Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
_qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
)
if (Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
_qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
!!ENDIF
endif()
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG CACHE)
list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name})
endif()
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG CACHE)
endif()
list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name})
endforeach()
if (NOT CMAKE_CROSSCOMPILING)
foreach(_dir ${Qt5Gui_${Name}_INCLUDE_DIRS})
@ -152,7 +161,7 @@ endmacro()
!!IF !isEmpty(CMAKE_EGL_LIBS)
_qt5gui_find_extra_libs(EGL \"$$CMAKE_EGL_LIBS\" \"$$CMAKE_EGL_LIBDIR\" \"$$CMAKE_EGL_INCDIRS\" OPTIONAL)
_qt5gui_find_extra_libs(EGL \"$$CMAKE_EGL_LIBS\" \"$$CMAKE_EGL_LIBDIR\" \"$$CMAKE_EGL_INCDIRS\")
!!ENDIF
!!IF !isEmpty(CMAKE_OPENGL_LIBS)

View File

@ -261,12 +261,12 @@ bool QOpenGLTextureBlitter::create()
d->vertexBuffer.create();
d->vertexBuffer.bind();
d->vertexBuffer.allocate(vertex_buffer_data, sizeof(vertex_buffer_data) * sizeof(vertex_buffer_data[0]));
d->vertexBuffer.allocate(vertex_buffer_data, sizeof(vertex_buffer_data));
d->vertexBuffer.release();
d->textureBuffer.create();
d->textureBuffer.bind();
d->textureBuffer.allocate(texture_buffer_data, sizeof(texture_buffer_data) * sizeof(texture_buffer_data[0]));
d->textureBuffer.allocate(texture_buffer_data, sizeof(texture_buffer_data));
d->textureBuffer.release();
d->vertexCoordAttribPos = d->program->attributeLocation("vertexCoord");

View File

@ -57,6 +57,13 @@ QT_BEGIN_NAMESPACE
static QBasicAtomicPointer<QNetworkConfigurationManagerPrivate> connManager_ptr;
static QBasicAtomicInt appShutdown;
static void connManager_prepare()
{
int shutdown = appShutdown.fetchAndStoreAcquire(0);
Q_ASSERT(shutdown == 0 || shutdown == 1);
Q_UNUSED(shutdown);
}
static void connManager_cleanup()
{
// this is not atomic or thread-safe!
@ -68,8 +75,9 @@ static void connManager_cleanup()
cmp->cleanup();
}
void QNetworkConfigurationManagerPrivate::addPostRoutine()
void QNetworkConfigurationManagerPrivate::addPreAndPostRoutine()
{
qAddPreRoutine(connManager_prepare);
qAddPostRoutine(connManager_cleanup);
}
@ -85,12 +93,12 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate()
if (QCoreApplicationPrivate::mainThread() == QThread::currentThread()) {
// right thread or no main thread yet
ptr->addPostRoutine();
ptr->addPreAndPostRoutine();
ptr->initialize();
} else {
// wrong thread, we need to make the main thread do this
QObject *obj = new QObject;
QObject::connect(obj, SIGNAL(destroyed()), ptr, SLOT(addPostRoutine()), Qt::DirectConnection);
QObject::connect(obj, SIGNAL(destroyed()), ptr, SLOT(addPreAndPostRoutine()), Qt::DirectConnection);
ptr->initialize(); // this moves us to the right thread
obj->moveToThread(QCoreApplicationPrivate::mainThread());
obj->deleteLater();

View File

@ -94,7 +94,7 @@ public:
public Q_SLOTS:
void updateConfigurations();
static void addPostRoutine();
static void addPreAndPostRoutine();
Q_SIGNALS:
void configurationAdded(const QNetworkConfiguration &config);

View File

@ -57,7 +57,7 @@
system:
\code
./configure -openssl-linked OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto'
OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked
\endcode
To disable SSL support in a Qt build, configure Qt with the \c{-no-openssl}

View File

@ -281,6 +281,11 @@ QDnsLookup::QDnsLookup(Type type, const QString &name, QObject *parent)
d->type = type;
}
/*!
\fn QDnsLookup::QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, QObject *parent)
\internal
*/
/*!
Destroys the QDnsLookup object.

View File

@ -238,9 +238,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSL_CIPHER(SSL_CIPHER *ciph
ciph.d->encryptionMethod = descriptionList.at(4).mid(4);
ciph.d->exportable = (descriptionList.size() > 6 && descriptionList.at(6) == QLatin1String("export"));
ciph.d->bits = cipher->strength_bits;
ciph.d->supportedBits = cipher->alg_bits;
ciph.d->bits = q_SSL_CIPHER_get_bits(cipher, &ciph.d->supportedBits);
}
return ciph;
}

View File

@ -205,6 +205,7 @@ DEFINEFUNC2(char *, sk_value, STACK *a, a, int b, b, return 0, return)
DEFINEFUNC(int, SSL_accept, SSL *a, a, return -1, return)
DEFINEFUNC(int, SSL_clear, SSL *a, a, return -1, return)
DEFINEFUNC3(char *, SSL_CIPHER_description, SSL_CIPHER *a, a, char *b, b, int c, c, return 0, return)
DEFINEFUNC2(int, SSL_CIPHER_get_bits, SSL_CIPHER *a, a, int *b, b, return 0, return)
DEFINEFUNC(int, SSL_connect, SSL *a, a, return -1, return)
#if OPENSSL_VERSION_NUMBER >= 0x00908000L
// 0.9.8 broke SC and BC by changing this function's signature.
@ -736,6 +737,7 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(sk_pop_free)
RESOLVEFUNC(sk_value)
RESOLVEFUNC(SSL_CIPHER_description)
RESOLVEFUNC(SSL_CIPHER_get_bits)
RESOLVEFUNC(SSL_CTX_check_private_key)
RESOLVEFUNC(SSL_CTX_ctrl)
RESOLVEFUNC(SSL_CTX_free)

View File

@ -296,6 +296,7 @@ char * q_sk_value(STACK *a, int b);
int q_SSL_accept(SSL *a);
int q_SSL_clear(SSL *a);
char *q_SSL_CIPHER_description(SSL_CIPHER *a, char *b, int c);
int q_SSL_CIPHER_get_bits(SSL_CIPHER *a, int *b);
int q_SSL_connect(SSL *a);
#if OPENSSL_VERSION_NUMBER >= 0x00908000L
// 0.9.8 broke SC and BC by changing this function's signature.

View File

@ -39,6 +39,13 @@
**
****************************************************************************/
#include <QtCore/qsystemdetection.h>
#if defined(Q_OS_IOS)
#import <UIKit/UIKit.h>
#elif defined(Q_OS_OSX)
#import <Cocoa/Cocoa.h>
#endif
#include "qmacmime_p.h"
#include "qguiapplication.h"
@ -115,6 +122,7 @@ const QStringList& qt_mac_enabledDraggedTypes()
\list
\i public.utf8-plain-text - converts to "text/plain"
\i public.utf16-plain-text - converts to "text/plain"
\i public.text - converts to "text/plain"
\i public.html - converts to "text/html"
\i public.url - converts to "text/uri-list"
\i public.file-url - converts to "text/uri-list"
@ -282,9 +290,9 @@ QList<QByteArray> QMacPasteboardMimeTypeName::convertFromMime(const QString &, Q
return ret;
}
class QMacPasteboardMimePlainText : public QMacInternalPasteboardMime {
class QMacPasteboardMimePlainTextFallback : public QMacInternalPasteboardMime {
public:
QMacPasteboardMimePlainText() : QMacInternalPasteboardMime(MIME_ALL) { }
QMacPasteboardMimePlainTextFallback() : QMacInternalPasteboardMime(MIME_ALL) { }
QString convertorName();
QString flavorFor(const QString &mime);
@ -294,52 +302,54 @@ public:
QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
};
QString QMacPasteboardMimePlainText::convertorName()
QString QMacPasteboardMimePlainTextFallback::convertorName()
{
return QLatin1String("PlainText");
return QLatin1String("PlainText (public.text)");
}
QString QMacPasteboardMimePlainText::flavorFor(const QString &mime)
QString QMacPasteboardMimePlainTextFallback::flavorFor(const QString &mime)
{
if (mime == QLatin1String("text/plain"))
return QLatin1String("com.apple.traditional-mac-plain-text");
return QLatin1String("public.text");
return QString();
}
QString QMacPasteboardMimePlainText::mimeFor(QString flav)
QString QMacPasteboardMimePlainTextFallback::mimeFor(QString flav)
{
if (flav == QLatin1String("com.apple.traditional-mac-plain-text"))
if (flav == QLatin1String("public.text"))
return QLatin1String("text/plain");
return QString();
}
bool QMacPasteboardMimePlainText::canConvert(const QString &mime, QString flav)
bool QMacPasteboardMimePlainTextFallback::canConvert(const QString &mime, QString flav)
{
return flavorFor(mime) == flav;
return mime == mimeFor(flav);
}
QVariant QMacPasteboardMimePlainText::convertToMime(const QString &mimetype, QList<QByteArray> data, QString flavor)
QVariant QMacPasteboardMimePlainTextFallback::convertToMime(const QString &mimetype, QList<QByteArray> data, QString flavor)
{
if (data.count() > 1)
qWarning("QMacPasteboardMimePlainText: Cannot handle multiple member data");
const QByteArray &firstData = data.first();
QVariant ret;
if (flavor == QLatin1String("com.apple.traditional-mac-plain-text")) {
qWarning("QMacPasteboardMimePlainTextFallback: Cannot handle multiple member data");
if (flavor == QLatin1String("public.text")) {
// Note that public.text is documented by Apple to have an undefined encoding. From
// testing it seems that utf8 is normally used, at least by Safari on iOS.
const QByteArray &firstData = data.first();
return QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
reinterpret_cast<const UInt8 *>(firstData.constData()),
firstData.size(), CFStringGetSystemEncoding(), false));
firstData.size(), kCFStringEncodingUTF8, false));
} else {
qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
}
return ret;
return QVariant();
}
QList<QByteArray> QMacPasteboardMimePlainText::convertFromMime(const QString &, QVariant data, QString flavor)
QList<QByteArray> QMacPasteboardMimePlainTextFallback::convertFromMime(const QString &, QVariant data, QString flavor)
{
QList<QByteArray> ret;
QString string = data.toString();
if (flavor == QLatin1String("com.apple.traditional-mac-plain-text"))
ret.append(string.toLatin1());
if (flavor == QLatin1String("public.text"))
ret.append(string.toUtf8());
return ret;
}
@ -477,6 +487,86 @@ QList<QByteArray> QMacPasteboardMimeHTMLText::convertFromMime(const QString &mim
return ret;
}
class QMacPasteboardMimeRtfText : public QMacInternalPasteboardMime {
public:
QMacPasteboardMimeRtfText() : QMacInternalPasteboardMime(MIME_ALL) { }
QString convertorName();
QString flavorFor(const QString &mime);
QString mimeFor(QString flav);
bool canConvert(const QString &mime, QString flav);
QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
};
QString QMacPasteboardMimeRtfText::convertorName()
{
return QLatin1String("Rtf");
}
QString QMacPasteboardMimeRtfText::flavorFor(const QString &mime)
{
if (mime == QLatin1String("text/html"))
return QLatin1String("public.rtf");
return QString();
}
QString QMacPasteboardMimeRtfText::mimeFor(QString flav)
{
if (flav == QLatin1String("public.rtf"))
return QLatin1String("text/html");
return QString();
}
bool QMacPasteboardMimeRtfText::canConvert(const QString &mime, QString flav)
{
#if defined(Q_OS_IOS)
if (QSysInfo::MacintoshVersion < QSysInfo::MV_IOS_7_0)
return false;
#endif
return mime == mimeFor(flav);
}
QVariant QMacPasteboardMimeRtfText::convertToMime(const QString &mimeType, QList<QByteArray> data, QString flavor)
{
if (!canConvert(mimeType, flavor))
return QVariant();
if (data.count() > 1)
qWarning("QMacPasteboardMimeHTMLText: Cannot handle multiple member data");
// Read RTF into to NSAttributedString, then convert the string to HTML
NSAttributedString *string = [[NSAttributedString alloc] initWithData:data.at(0).toNSData()
options:[NSDictionary dictionaryWithObject:NSRTFTextDocumentType forKey:NSDocumentTypeDocumentAttribute]
documentAttributes:nil
error:nil];
NSError *error;
NSRange range = NSMakeRange(0, [string length]);
NSDictionary *dict = [NSDictionary dictionaryWithObject:NSHTMLTextDocumentType forKey:NSDocumentTypeDocumentAttribute];
NSData *htmlData = [string dataFromRange:range documentAttributes:dict error:&error];
return QByteArray::fromNSData(htmlData);
}
QList<QByteArray> QMacPasteboardMimeRtfText::convertFromMime(const QString &mime, QVariant data, QString flavor)
{
QList<QByteArray> ret;
if (!canConvert(mime, flavor))
return ret;
NSAttributedString *string = [[NSAttributedString alloc] initWithData:data.toByteArray().toNSData()
options:[NSDictionary dictionaryWithObject:NSHTMLTextDocumentType forKey:NSDocumentTypeDocumentAttribute]
documentAttributes:nil
error:nil];
NSError *error;
NSRange range = NSMakeRange(0, [string length]);
NSDictionary *dict = [NSDictionary dictionaryWithObject:NSRTFTextDocumentType forKey:NSDocumentTypeDocumentAttribute];
NSData *rtfData = [string dataFromRange:range documentAttributes:dict error:&error];
ret << QByteArray::fromNSData(rtfData);
return ret;
}
class QMacPasteboardMimeFileUri : public QMacInternalPasteboardMime {
public:
QMacPasteboardMimeFileUri() : QMacInternalPasteboardMime(MIME_ALL) { }
@ -696,8 +786,9 @@ void QMacInternalPasteboardMime::initializeMimeTypes()
new QMacPasteboardMimeAny;
//standard types that we wrap
new QMacPasteboardMimePlainTextFallback;
new QMacPasteboardMimeUnicodeText;
new QMacPasteboardMimePlainText;
new QMacPasteboardMimeRtfText;
new QMacPasteboardMimeHTMLText;
new QMacPasteboardMimeFileUri;
new QMacPasteboardMimeUrl;

View File

@ -171,7 +171,7 @@ void QEGLPlatformCursor::createShaderPrograms()
m_vertexCoordEntry = m_program->attributeLocation("vertexCoordEntry");
m_textureCoordEntry = m_program->attributeLocation("textureCoordEntry");
m_textureEntry = m_program->attributeLocation("texture");
m_textureEntry = m_program->uniformLocation("texture");
}
void QEGLPlatformCursor::createCursorTexture(uint *texture, const QImage &image)

View File

@ -659,6 +659,9 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
{
QFontEngineFT *engine = static_cast<QFontEngineFT*>(QBasicFontDatabase::fontEngine(fontData, pixelSize, hintingPreference));
if (engine == 0)
return 0;
QFontDef fontDef = engine->fontDef;
QFontEngineFT::GlyphFormat format;

View File

@ -1024,15 +1024,28 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
case QAccessible::ValueChanged: {
if (sendObject || sendObject_value_changed || sendObject_property_change_accessible_value) {
QAccessibleInterface * iface = event->accessibleInterface();
if (!iface || !iface->valueInterface()) {
qWarning() << "ValueChanged event from invalid accessible: " << iface;
if (!iface) {
qWarning() << "ValueChanged event from invalid accessible.";
return;
}
QString path = pathForInterface(iface);
QVariantList args = packDBusSignalArguments(QLatin1String("accessible-value"), 0, 0, variantForPath(path));
sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
QLatin1String("PropertyChange"), args);
if (iface->valueInterface()) {
QString path = pathForInterface(iface);
QVariantList args = packDBusSignalArguments(QLatin1String("accessible-value"), 0, 0, variantForPath(path));
sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
QLatin1String("PropertyChange"), args);
} else if (iface->role() == QAccessible::ComboBox) {
// Combo Box with AT-SPI likes to be special
// It requires a name-change to update caches and then selection-changed
QString path = pathForInterface(iface);
QVariantList args1 = packDBusSignalArguments(QLatin1String("accessible-name"), 0, 0, variantForPath(path));
sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
QLatin1String("PropertyChange"), args1);
QVariantList args2 = packDBusSignalArguments(QString(), 0, 0, QVariant::fromValue(QDBusVariant(QVariant(0))));
sendDBusSignal(path, QLatin1String(ATSPI_DBUS_INTERFACE_EVENT_OBJECT),
QLatin1String("SelectionChanged"), args2);
} else {
qWarning() << "ValueChanged event and no ValueInterface or ComboBox: " << iface;
}
}
break;
}

View File

@ -419,6 +419,8 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
QCoreWlanEngine::~QCoreWlanEngine()
{
scanThread->wait(5000);
while (!foundConfigurations.isEmpty())
delete foundConfigurations.takeFirst();
[listener remove];

View File

@ -404,6 +404,8 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
QCoreWlanEngine::~QCoreWlanEngine()
{
scanThread->wait(5000);
while (!foundConfigurations.isEmpty())
delete foundConfigurations.takeFirst();
[listener remove];

View File

@ -170,7 +170,7 @@ if (!clazz) { \
jmethodID method = env->GetMethodID(clazz, METHOD_NAME, METHOD_SIGNATURE); \
if (!method) { \
__android_log_print(ANDROID_LOG_WARN, m_qtTag, m_methodErrorMsg, METHOD_NAME, METHOD_SIGNATURE); \
return; \
return false; \
} \
env->CallVoidMethod(OBJECT, method, __VA_ARGS__); \
}
@ -190,12 +190,12 @@ if (!clazz) { \
return jdesc;
}
static void populateNode(JNIEnv *env, jobject /*thiz*/, jint objectId, jobject node)
static bool populateNode(JNIEnv *env, jobject /*thiz*/, jint objectId, jobject node)
{
QAccessibleInterface *iface = interfaceFromId(objectId);
if (!iface || !iface->isValid()) {
__android_log_print(ANDROID_LOG_WARN, m_qtTag, "Accessibility: populateNode for Invalid ID");
return;
return false;
}
QAccessible::State state = iface->state();
@ -215,11 +215,10 @@ if (!clazz) { \
}
CALL_METHOD(node, "setEnabled", "(Z)V", !state.disabled)
//CALL_METHOD(node, "setFocusable", "(Z)V", state.focusable)
CALL_METHOD(node, "setFocusable", "(Z)V", true)
//CALL_METHOD(node, "setFocused", "(Z)V", state.focused)
CALL_METHOD(node, "setCheckable", "(Z)V", state.checkable)
CALL_METHOD(node, "setChecked", "(Z)V", state.checked)
CALL_METHOD(node, "setFocusable", "(Z)V", (bool)state.focusable)
CALL_METHOD(node, "setFocused", "(Z)V", (bool)state.focused)
CALL_METHOD(node, "setCheckable", "(Z)V", (bool)state.checkable)
CALL_METHOD(node, "setChecked", "(Z)V", (bool)state.checked)
CALL_METHOD(node, "setVisibleToUser", "(Z)V", !state.invisible)
if (iface->actionInterface()) {
@ -227,7 +226,7 @@ if (!clazz) { \
bool clickable = actions.contains(QAccessibleActionInterface::pressAction());
bool toggle = actions.contains(QAccessibleActionInterface::toggleAction());
if (clickable || toggle) {
CALL_METHOD(node, "setClickable", "(Z)V", clickable)
CALL_METHOD(node, "setClickable", "(Z)V", (bool)clickable)
CALL_METHOD(node, "addAction", "(I)V", 16) // ACTION_CLICK defined in AccessibilityNodeInfo
}
}
@ -235,6 +234,8 @@ if (!clazz) { \
jstring jdesc = env->NewString((jchar*) desc.constData(), (jsize) desc.size());
//CALL_METHOD(node, "setText", "(Ljava/lang/CharSequence;)V", jdesc)
CALL_METHOD(node, "setContentDescription", "(Ljava/lang/CharSequence;)V", jdesc)
return true;
}
static JNINativeMethod methods[] = {
@ -244,7 +245,7 @@ if (!clazz) { \
{"descriptionForAccessibleObject", "(I)Ljava/lang/String;", (jstring)descriptionForAccessibleObject},
{"screenRect", "(I)Landroid/graphics/Rect;", (jobject)screenRect},
{"hitTest", "(FF)I", (void*)hitTest},
{"populateNode", "(ILandroid/view/accessibility/AccessibilityNodeInfo;)V", (void*)populateNode},
{"populateNode", "(ILandroid/view/accessibility/AccessibilityNodeInfo;)Z", (void*)populateNode},
{"clickAction", "(I)Z", (void*)clickAction},
};

View File

@ -463,17 +463,19 @@ static void *startMainMethod(void */*data*/)
static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring paramsString, jstring environmentString)
{
m_mainLibraryHnd = NULL;
const char *nativeString = env->GetStringUTFChars(environmentString, 0);
QByteArray string = nativeString;
env->ReleaseStringUTFChars(environmentString, nativeString);
m_applicationParams=string.split('\t');
foreach (string, m_applicationParams) {
if (!string.isEmpty() && putenv(string.constData()))
qWarning() << "Can't set environment" << string;
{ // Set env. vars
const char *nativeString = env->GetStringUTFChars(environmentString, 0);
const QList<QByteArray> envVars = QByteArray(nativeString).split('\t');
env->ReleaseStringUTFChars(environmentString, nativeString);
foreach (const QByteArray &envVar, envVars) {
const QList<QByteArray> envVarPair = envVar.split('=');
if (envVarPair.size() == 2 && ::setenv(envVarPair[0], envVarPair[1], 1) != 0)
qWarning() << "Can't set environment" << envVarPair;
}
}
nativeString = env->GetStringUTFChars(paramsString, 0);
string = nativeString;
const char *nativeString = env->GetStringUTFChars(paramsString, 0);
QByteArray string = nativeString;
env->ReleaseStringUTFChars(paramsString, nativeString);
m_applicationParams=string.split('\t');

View File

@ -82,7 +82,7 @@ QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &fami
Q_UNUSED(family);
Q_UNUSED(style);
if (styleHint == QFont::Monospace)
if (styleHint == QFont::Monospace || styleHint == QFont::Courier)
return QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";") + m_fallbacks[script];
return QString(qgetenv("QT_ANDROID_FONTS")).split(";") + m_fallbacks[script];

View File

@ -119,7 +119,7 @@ QCocoaMenuItem::~QCocoaMenuItem()
void QCocoaMenuItem::setText(const QString &text)
{
m_text = qt_mac_removeAmpersandEscapes(text);
m_text = text;
}
void QCocoaMenuItem::setIcon(const QIcon &icon)

View File

@ -45,6 +45,67 @@
QT_BEGIN_NAMESPACE
class QMacPasteboardMimeTraditionalMacPlainText : public QMacInternalPasteboardMime {
public:
QMacPasteboardMimeTraditionalMacPlainText() : QMacInternalPasteboardMime(MIME_ALL) { }
QString convertorName();
QString flavorFor(const QString &mime);
QString mimeFor(QString flav);
bool canConvert(const QString &mime, QString flav);
QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
};
QString QMacPasteboardMimeTraditionalMacPlainText::convertorName()
{
return QLatin1String("PlainText (traditional-mac-plain-text)");
}
QString QMacPasteboardMimeTraditionalMacPlainText::flavorFor(const QString &mime)
{
if (mime == QLatin1String("text/plain"))
return QLatin1String("com.apple.traditional-mac-plain-text");
return QString();
}
QString QMacPasteboardMimeTraditionalMacPlainText::mimeFor(QString flav)
{
if (flav == QLatin1String("com.apple.traditional-mac-plain-text"))
return QLatin1String("text/plain");
return QString();
}
bool QMacPasteboardMimeTraditionalMacPlainText::canConvert(const QString &mime, QString flav)
{
return flavorFor(mime) == flav;
}
QVariant QMacPasteboardMimeTraditionalMacPlainText::convertToMime(const QString &mimetype, QList<QByteArray> data, QString flavor)
{
if (data.count() > 1)
qWarning("QMacPasteboardMimeTraditionalMacPlainText: Cannot handle multiple member data");
const QByteArray &firstData = data.first();
QVariant ret;
if (flavor == QLatin1String("com.apple.traditional-mac-plain-text")) {
return QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
reinterpret_cast<const UInt8 *>(firstData.constData()),
firstData.size(), CFStringGetSystemEncoding(), false));
} else {
qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
}
return ret;
}
QList<QByteArray> QMacPasteboardMimeTraditionalMacPlainText::convertFromMime(const QString &, QVariant data, QString flavor)
{
QList<QByteArray> ret;
QString string = data.toString();
if (flavor == QLatin1String("com.apple.traditional-mac-plain-text"))
ret.append(string.toLatin1());
return ret;
}
class QMacPasteboardMimeTiff : public QMacInternalPasteboardMime {
public:
QMacPasteboardMimeTiff() : QMacInternalPasteboardMime(MIME_ALL) { }
@ -136,76 +197,10 @@ QList<QByteArray> QMacPasteboardMimeTiff::convertFromMime(const QString &mime, Q
return ret;
}
// This handler is special: It supports converting public.rtf top text/html,
// but not the other way around.
class QMacPasteboardMimeRtfText : public QMacInternalPasteboardMime {
public:
QMacPasteboardMimeRtfText() : QMacInternalPasteboardMime(MIME_ALL) { }
QString convertorName();
QString flavorFor(const QString &mime);
QString mimeFor(QString flav);
bool canConvert(const QString &mime, QString flav);
QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
};
QString QMacPasteboardMimeRtfText::convertorName()
{
return QLatin1String("Rtf");
}
QString QMacPasteboardMimeRtfText::flavorFor(const QString &mime)
{
if (mime == QLatin1String("text/html"))
return QLatin1String("public.rtf");
return QString();
}
QString QMacPasteboardMimeRtfText::mimeFor(QString flav)
{
if (flav == QLatin1String("public.rtf"))
return QLatin1String("text/html");
return QString();
}
bool QMacPasteboardMimeRtfText::canConvert(const QString &mime, QString flav)
{
return flavorFor(mime) == flav;
}
QVariant QMacPasteboardMimeRtfText::convertToMime(const QString &mimeType, QList<QByteArray> data, QString flavor)
{
if (!canConvert(mimeType, flavor))
return QVariant();
if (data.count() > 1)
qWarning("QMacPasteboardMimeHTMLText: Cannot handle multiple member data");
// Convert Rtf to Html.
NSAttributedString *string = [[NSAttributedString alloc] initWithRTF:data.at(0).toNSData() documentAttributes:NULL];
NSError *error;
NSRange range = NSMakeRange(0,[string length]);
NSDictionary *dict = [NSDictionary dictionaryWithObject:NSHTMLTextDocumentType forKey:NSDocumentTypeDocumentAttribute];
NSData *htmldata = [string dataFromRange:range documentAttributes:dict error:&error];
[string release];
return QByteArray::fromNSData(htmldata);
}
QList<QByteArray> QMacPasteboardMimeRtfText::convertFromMime(const QString &mime, QVariant data, QString flavor)
{
Q_UNUSED(mime);
Q_UNUSED(data);
Q_UNUSED(flavor);
qWarning("QMacPasteboardMimeRtfText: Conversion from Html to Rtf is not supported");
QList<QByteArray> ret;
return ret;
}
void QCocoaMimeTypes::initializeMimeTypes()
{
new QMacPasteboardMimeTraditionalMacPlainText;
new QMacPasteboardMimeTiff;
new QMacPasteboardMimeRtfText;
}
QT_END_NAMESPACE

View File

@ -1620,6 +1620,7 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
if (!m_drawContentBorderGradient) {
[window setStyleMask:[window styleMask] & ~NSTexturedBackgroundWindowMask];
[[[window contentView] superview] setNeedsDisplay:YES];
return;
}
@ -1650,6 +1651,8 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
[window setContentBorderThickness:effectiveBottomContentBorderThickness forEdge:NSMinYEdge];
[window setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge];
[[[window contentView] superview] setNeedsDisplay:YES];
}
void QCocoaWindow::updateNSToolbar()

View File

@ -80,12 +80,12 @@ private:
{}
public:
// 6.2.9200.16765 corresponds to Direct2D 1.1 on Windows 7 SP1 with Platform Update
// 6.2.9200.16492 corresponds to Direct2D 1.1 on Windows 7 SP1 with Platform Update
enum {
D2DMinVersionPart1 = 6,
D2DMinVersionPart2 = 2,
D2DMinVersionPart3 = 9200,
D2DMinVersionPart4 = 16765
D2DMinVersionPart4 = 16492
};
static Direct2DVersion systemVersion() {
@ -93,8 +93,8 @@ public:
TCHAR filename[bufSize];
UINT i = GetSystemDirectory(filename, bufSize);
if (i > 0 && i < MAX_PATH) {
if (_tcscat_s(filename, MAX_PATH, __TEXT("\\d2d1.dll")) == 0) {
if (i > 0 && i < bufSize) {
if (_tcscat_s(filename, bufSize, __TEXT("\\d2d1.dll")) == 0) {
DWORD versionInfoSize = GetFileVersionInfoSize(filename, NULL);
if (versionInfoSize) {
QVector<BYTE> info(versionInfoSize);

View File

@ -592,9 +592,13 @@ public:
props.miterLimit = newPen.miterLimit() * qreal(2.0); // D2D and Qt miter specs differ
props.dashOffset = newPen.dashOffset();
props.transformType = qIsNull(newPen.widthF()) ? D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE
: newPen.isCosmetic() ? D2D1_STROKE_TRANSFORM_TYPE_FIXED
: D2D1_STROKE_TRANSFORM_TYPE_NORMAL;
if (newPen.widthF() == 0)
props.transformType = D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE;
else if (qt_pen_is_cosmetic(newPen, q->state()->renderHints))
props.transformType = D2D1_STROKE_TRANSFORM_TYPE_FIXED;
else
props.transformType = D2D1_STROKE_TRANSFORM_TYPE_NORMAL;
switch (newPen.style()) {
case Qt::SolidLine:
@ -930,6 +934,33 @@ void QWindowsDirect2DPaintEngine::setState(QPainterState *s)
transformChanged();
}
void QWindowsDirect2DPaintEngine::draw(const QVectorPath &path)
{
Q_D(QWindowsDirect2DPaintEngine);
ComPtr<ID2D1Geometry> geometry = vectorPathToID2D1PathGeometry(path, d->antialiasMode() == D2D1_ANTIALIAS_MODE_ALIASED);
if (!geometry) {
qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__);
return;
}
const QBrush &brush = state()->brush;
if (qbrush_style(brush) != Qt::NoBrush) {
if (emulationRequired(BrushEmulation))
rasterFill(path, brush);
else
fill(geometry.Get(), brush);
}
const QPen &pen = state()->pen;
if (qpen_style(pen) != Qt::NoPen && qbrush_style(qpen_brush(pen)) != Qt::NoBrush) {
if (emulationRequired(PenEmulation))
QPaintEngineEx::stroke(path, pen);
else
stroke(geometry.Get(), pen);
}
}
void QWindowsDirect2DPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
{
Q_D(QWindowsDirect2DPaintEngine);
@ -939,7 +970,6 @@ void QWindowsDirect2DPaintEngine::fill(const QVectorPath &path, const QBrush &br
return;
ensureBrush(brush);
if (emulationRequired(BrushEmulation)) {
rasterFill(path, brush);
return;
@ -957,6 +987,56 @@ void QWindowsDirect2DPaintEngine::fill(const QVectorPath &path, const QBrush &br
d->dc()->FillGeometry(geometry.Get(), d->brush.brush.Get());
}
void QWindowsDirect2DPaintEngine::fill(ID2D1Geometry *geometry, const QBrush &brush)
{
Q_D(QWindowsDirect2DPaintEngine);
D2D_TAG(D2DDebugFillTag);
ensureBrush(brush);
if (!d->brush.brush)
return;
d->dc()->FillGeometry(geometry, d->brush.brush.Get());
}
void QWindowsDirect2DPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
{
Q_D(QWindowsDirect2DPaintEngine);
D2D_TAG(D2DDebugFillTag);
if (path.isEmpty())
return;
ensurePen(pen);
if (emulationRequired(PenEmulation)) {
QPaintEngineEx::stroke(path, pen);
return;
}
if (!d->pen.brush)
return;
ComPtr<ID2D1Geometry> geometry = vectorPathToID2D1PathGeometry(path, d->antialiasMode() == D2D1_ANTIALIAS_MODE_ALIASED);
if (!geometry) {
qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__);
return;
}
d->dc()->DrawGeometry(geometry.Get(), d->pen.brush.Get(), d->pen.qpen.widthF(), d->pen.strokeStyle.Get());
}
void QWindowsDirect2DPaintEngine::stroke(ID2D1Geometry *geometry, const QPen &pen)
{
Q_D(QWindowsDirect2DPaintEngine);
D2D_TAG(D2DDebugFillTag);
ensurePen(pen);
if (!d->pen.brush)
return;
d->dc()->DrawGeometry(geometry, d->pen.brush.Get(), d->pen.qpen.widthF(), d->pen.strokeStyle.Get());
}
void QWindowsDirect2DPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
{
Q_D(QWindowsDirect2DPaintEngine);

View File

@ -68,7 +68,14 @@ public:
void setState(QPainterState *s) Q_DECL_OVERRIDE;
void draw(const QVectorPath &path) Q_DECL_OVERRIDE;
void fill(const QVectorPath &path, const QBrush &brush) Q_DECL_OVERRIDE;
void fill(ID2D1Geometry *geometry, const QBrush &brush);
void stroke(const QVectorPath &path, const QPen &pen) Q_DECL_OVERRIDE;
void stroke(ID2D1Geometry *geometry, const QPen &pen);
void clip(const QVectorPath &path, Qt::ClipOperation op) Q_DECL_OVERRIDE;
void clipEnabledChanged() Q_DECL_OVERRIDE;

View File

@ -253,7 +253,7 @@ Q_GLOBAL_STATIC(StaticVariables, staticVariables);
- (UITextRange *)selectedTextRange {
int cursorPos = [self imValue:Qt::ImCursorPosition].toInt();
int anchorPos = [self imValue:Qt::ImAnchorPosition].toInt();
return [QUITextRange rangeWithNSRange:NSMakeRange(cursorPos, (anchorPos - cursorPos))];
return [QUITextRange rangeWithNSRange:NSMakeRange(qMin(cursorPos, anchorPos), qAbs(anchorPos - cursorPos))];
}
- (NSString *)textInRange:(UITextRange *)range

View File

@ -741,6 +741,27 @@ HWND QWindowsContext::createDummyWindow(const QString &classNameIn,
HWND_MESSAGE, NULL, (HINSTANCE)GetModuleHandle(0), NULL);
}
#ifndef Q_OS_WINCE
// Re-engineered from the inline function _com_error::ErrorMessage().
// We cannot use it directly since it uses swprintf_s(), which is not
// present in the MSVCRT.DLL found on Windows XP (QTBUG-35617).
static inline QString errorMessageFromComError(const _com_error &comError)
{
TCHAR *message = Q_NULLPTR;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, comError.Error(), MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
message, 0, NULL);
if (message) {
const QString result = QString::fromWCharArray(message).trimmed();
LocalFree((HLOCAL)message);
return result;
}
if (const WORD wCode = comError.WCode())
return QStringLiteral("IDispatch error #") + QString::number(wCode);
return QStringLiteral("Unknown error 0x0") + QString::number(comError.Error(), 16);
}
#endif // !Q_OS_WINCE
/*!
\brief Common COM error strings.
*/
@ -807,7 +828,7 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr)
#ifndef Q_OS_WINCE
_com_error error(hr);
result += QByteArrayLiteral(" (");
result += QString::fromWCharArray(error.ErrorMessage()).toLocal8Bit();
result += errorMessageFromComError(error);
result += ')';
#endif // !Q_OS_WINCE
return result;
@ -876,7 +897,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
// TODO: Release/regrab mouse if a popup has mouse grab.
return false;
case QtWindows::DestroyEvent:
if (!platformWindow->testFlag(QWindowsWindow::WithinDestroy)) {
if (platformWindow && !platformWindow->testFlag(QWindowsWindow::WithinDestroy)) {
qWarning() << "External WM_DESTROY received for " << platformWindow->window()
<< ", parent: " << platformWindow->window()->parent()
<< ", transient parent: " << platformWindow->window()->transientParent();

View File

@ -165,6 +165,9 @@ namespace {
Q_ASSERT(tagName.size() == 4);
quint32 tagId = *(reinterpret_cast<const quint32 *>(tagName.constData()));
if (m_fontData.size() < sizeof(OffsetSubTable) + sizeof(TableDirectory))
return 0;
OffsetSubTable *offsetSubTable = reinterpret_cast<OffsetSubTable *>(m_fontData.data());
TableDirectory *tableDirectory = reinterpret_cast<TableDirectory *>(offsetSubTable + 1);

View File

@ -148,15 +148,17 @@ void QXcbConnection::initializeXInput2()
}
case XIButtonClass: {
XIButtonClassInfo *bci = reinterpret_cast<XIButtonClassInfo *>(devices[i].classes[c]);
for (int i=0; i < bci->num_buttons; ++i) {
const int buttonAtom = qatom(bci->labels[i]);
if (buttonAtom == QXcbAtom::ButtonWheelUp
|| buttonAtom == QXcbAtom::ButtonWheelDown) {
if (bci->num_buttons >= 5) {
Atom label4 = bci->labels[3];
Atom label5 = bci->labels[4];
if ((!label4 || qatom(label4) == QXcbAtom::ButtonWheelUp) && (!label5 || qatom(label5) == QXcbAtom::ButtonWheelDown))
scrollingDevice.legacyOrientations |= Qt::Vertical;
} else if (buttonAtom == QXcbAtom::ButtonHorizWheelLeft
|| buttonAtom == QXcbAtom::ButtonHorizWheelRight) {
}
if (bci->num_buttons >= 7) {
Atom label6 = bci->labels[5];
Atom label7 = bci->labels[6];
if ((!label6 || qatom(label6) == QXcbAtom::ButtonHorizWheelLeft) && (!label7 || qatom(label7) == QXcbAtom::ButtonHorizWheelRight))
scrollingDevice.legacyOrientations |= Qt::Horizontal;
}
}
break;
}
@ -246,6 +248,7 @@ void QXcbConnection::xi2Select(xcb_window_t window)
}
#endif // XCB_USE_XINPUT22
QSet<int> tabletDevices;
#ifndef QT_NO_TABLETEVENT
// For each tablet, select some additional event types.
// Press, motion, etc. events must never be selected for _all_ devices
@ -253,15 +256,19 @@ void QXcbConnection::xi2Select(xcb_window_t window)
// similar handlers useless and we have no intention to infect
// all the pure xcb code with Xlib-based XI2.
if (!m_tabletData.isEmpty()) {
unsigned int tabletBitMask = bitMask;
unsigned char *xiTabletBitMask = reinterpret_cast<unsigned char *>(&tabletBitMask);
QVector<XIEventMask> xiEventMask(m_tabletData.count());
bitMask |= XI_ButtonPressMask;
bitMask |= XI_ButtonReleaseMask;
bitMask |= XI_MotionMask;
bitMask |= XI_PropertyEventMask;
tabletBitMask |= XI_ButtonPressMask;
tabletBitMask |= XI_ButtonReleaseMask;
tabletBitMask |= XI_MotionMask;
tabletBitMask |= XI_PropertyEventMask;
for (int i = 0; i < m_tabletData.count(); ++i) {
xiEventMask[i].deviceid = m_tabletData.at(i).deviceId;
xiEventMask[i].mask_len = sizeof(bitMask);
xiEventMask[i].mask = xiBitMask;
int deviceId = m_tabletData.at(i).deviceId;
tabletDevices.insert(deviceId);
xiEventMask[i].deviceid = deviceId;
xiEventMask[i].mask_len = sizeof(tabletBitMask);
xiEventMask[i].mask = xiTabletBitMask;
}
XISelectEvents(xDisplay, window, xiEventMask.data(), m_tabletData.count());
}
@ -271,17 +278,30 @@ void QXcbConnection::xi2Select(xcb_window_t window)
// Enable each scroll device
if (!m_scrollingDevices.isEmpty()) {
QVector<XIEventMask> xiEventMask(m_scrollingDevices.size());
bitMask = XI_MotionMask;
unsigned int scrollBitMask = 0;
unsigned char *xiScrollBitMask = reinterpret_cast<unsigned char *>(&scrollBitMask);
scrollBitMask = XI_MotionMask;
scrollBitMask |= XI_ButtonReleaseMask;
bitMask |= XI_MotionMask;
bitMask |= XI_ButtonReleaseMask;
int i=0;
Q_FOREACH (const ScrollingDevice& scrollingDevice, m_scrollingDevices) {
if (tabletDevices.contains(scrollingDevice.deviceId))
continue; // All necessary events are already captured.
xiEventMask[i].deviceid = scrollingDevice.deviceId;
xiEventMask[i].mask_len = sizeof(bitMask);
xiEventMask[i].mask = xiBitMask;
if (m_touchDevices.contains(scrollingDevice.deviceId)) {
xiEventMask[i].mask_len = sizeof(bitMask);
xiEventMask[i].mask = xiBitMask;
} else {
xiEventMask[i].mask_len = sizeof(scrollBitMask);
xiEventMask[i].mask = xiScrollBitMask;
}
i++;
}
XISelectEvents(xDisplay, window, xiEventMask.data(), m_scrollingDevices.size());
XISelectEvents(xDisplay, window, xiEventMask.data(), i);
}
#else
Q_UNUSED(xiBitMask);
#endif
}
@ -655,13 +675,15 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData)
if (reinterpret_cast<xXIDeviceEvent *>(event)->detail == 1) { // ignore the physical buttons on the stylus
tabletData->down = true;
xi2ReportTabletEvent(*tabletData, xiEvent);
}
} else
handled = false;
break;
case XI_ButtonRelease: // stylus up
if (reinterpret_cast<xXIDeviceEvent *>(event)->detail == 1) {
tabletData->down = false;
xi2ReportTabletEvent(*tabletData, xiEvent);
}
} else
handled = false;
break;
case XI_Motion:
// Report TabletMove only when the stylus is touching the tablet.

View File

@ -688,7 +688,9 @@ void QSqlResult::bindValue(int index, const QVariant& val, QSql::ParamType param
{
Q_D(QSqlResult);
d->binds = PositionalBinding;
d->indexes[d->fieldSerial(index)].append(index);
QList<int>& indexes = d->indexes[d->fieldSerial(index)];
if (!indexes.contains(index))
indexes.append(index);
if (d->values.count() <= index)
d->values.resize(index + 1);
d->values[index] = val;

View File

@ -49,7 +49,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
static const char *currentAppName = 0;
@ -257,10 +256,11 @@ bool QTestResult::compare(bool success, const char *failureMsg,
QTEST_ASSERT(expected);
QTEST_ASSERT(actual);
char msg[1024];
const size_t maxMsgLen = 1024;
char msg[maxMsgLen];
if (QTestLog::verboseLevel() >= 2) {
qsnprintf(msg, 1024, "QCOMPARE(%s, %s)", actual, expected);
qsnprintf(msg, maxMsgLen, "QCOMPARE(%s, %s)", actual, expected);
QTestLog::info(msg, file, line);
}
@ -268,16 +268,17 @@ bool QTestResult::compare(bool success, const char *failureMsg,
failureMsg = "Compared values are not the same";
if (success && QTest::expectFailMode) {
qsnprintf(msg, 1024, "QCOMPARE(%s, %s) returned TRUE unexpectedly.", actual, expected);
qsnprintf(msg, maxMsgLen,
"QCOMPARE(%s, %s) returned TRUE unexpectedly.", actual, expected);
} else if (val1 || val2) {
size_t len1 = mbstowcs(NULL, actual, 0);
size_t len2 = mbstowcs(NULL, expected, 0);
qsnprintf(msg, 1024, "%s\n Actual (%s)%*s %s\n Expected (%s)%*s %s",
size_t len1 = mbstowcs(NULL, actual, maxMsgLen); // Last parameter is not ignored on QNX
size_t len2 = mbstowcs(NULL, expected, maxMsgLen); // (result is never larger than this).
qsnprintf(msg, maxMsgLen, "%s\n Actual (%s)%*s %s\n Expected (%s)%*s %s",
failureMsg,
actual, qMax(len1, len2) - len1 + 1, ":", val1 ? val1 : "<null>",
expected, qMax(len1, len2) - len2 + 1, ":", val2 ? val2 : "<null>");
} else
qsnprintf(msg, 1024, "%s", failureMsg);
qsnprintf(msg, maxMsgLen, "%s", failureMsg);
delete [] val1;
delete [] val2;

View File

@ -146,8 +146,6 @@ macx {
../../corelib/io/qstandardpaths_win.cpp
}
*-g++*: QMAKE_CXXFLAGS += -ffunction-sections
if(contains(QT_CONFIG, zlib)|cross_compile):include(../../3rdparty/zlib.pri)
else:include(../../3rdparty/zlib_dependency.pri)

View File

@ -1354,7 +1354,6 @@ void HtmlGenerator::generateCollisionPages()
beginSubPage(ncn, Generator::fileName(ncn));
QString fullTitle = ncn->fullTitle();
QString htmlTitle = fullTitle;
CodeMarker* marker = CodeMarker::markerForFileName(ncn->location().filePath());
if (ncn->isQmlNode()) {
// Replace the marker with a QML code marker.
@ -1362,7 +1361,7 @@ void HtmlGenerator::generateCollisionPages()
marker = CodeMarker::markerForLanguage(QLatin1String("QML"));
}
generateHeader(htmlTitle, ncn, marker);
generateHeader(fullTitle, ncn, marker);
if (!fullTitle.isEmpty())
out() << "<h1 class=\"title\">" << protectEnc(fullTitle) << "</h1>\n";
@ -1447,17 +1446,18 @@ void HtmlGenerator::generateDocNode(DocNode* dn, CodeMarker* marker)
QList<Section> sections;
QList<Section>::const_iterator s;
QString fullTitle = dn->fullTitle();
QString htmlTitle = fullTitle;
if (dn->subType() == Node::QmlBasicType) {
fullTitle = "QML Basic Type: " + fullTitle;
htmlTitle = fullTitle;
// Replace the marker with a QML code marker.
marker = CodeMarker::markerForLanguage(QLatin1String("QML"));
}
else if (dn->subType() == Node::QmlClass) {
fullTitle = fullTitle + " QML Type";
}
generateHeader(htmlTitle, dn, marker);
generateHeader(fullTitle, dn, marker);
/*
Generate the TOC for the new doc format.
Don't generate a TOC for the home page.

View File

@ -551,6 +551,7 @@ static void processQdocconfFile(const QString &fileName)
Generator::debug("qdoc finished!");
}
extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed;
QT_END_NAMESPACE
int main(int argc, char **argv)
@ -558,6 +559,7 @@ int main(int argc, char **argv)
QT_USE_NAMESPACE
#ifndef QT_BOOTSTRAPPED
qt_qhash_seed.testAndSetRelaxed(-1, 0); // set the hash seed to 0 if it wasn't set yet
QCoreApplication app(argc, argv);
#endif

View File

@ -52,9 +52,12 @@
#include <qcommandlineparser.h>
QT_BEGIN_NAMESPACE
extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed;
int runUic(int argc, char *argv[])
{
qt_qhash_seed.testAndSetRelaxed(-1, 0); // set the hash seed to 0 if it wasn't set yet
QCoreApplication app(argc, argv);
QCoreApplication::setApplicationVersion(QString::fromLatin1(QT_VERSION_STR));

View File

@ -170,12 +170,6 @@ void QOpenGLWidget::resizeEvent(QResizeEvent *)
d->fbo = new QOpenGLFramebufferObject(size() * devicePixelRatio(), QOpenGLFramebufferObject::CombinedDepthStencil);
d->fbo->bind();
QOpenGLFunctions *funcs = d->context.functions();
funcs->glBindTexture(GL_TEXTURE_2D, d->fbo->texture());
funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
resizeGL(width(), height());
paintGL();
funcs->glFlush();

View File

@ -3245,7 +3245,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
case PE_PanelStatusBar: {
// Fill the status bar with the titlebar gradient.
QLinearGradient linearGrad(0, opt->rect.top(), 0, opt->rect.bottom());
if (opt->state & QStyle::State_Active) {
if (w ? qt_macWindowMainWindow(w->window()) : (opt->state & QStyle::State_Active)) {
linearGrad.setColorAt(0, titlebarGradientActiveBegin);
linearGrad.setColorAt(1, titlebarGradientActiveEnd);
} else {
@ -3255,7 +3255,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
p->fillRect(opt->rect, linearGrad);
// Draw the black separator line at the top of the status bar.
if (opt->state & QStyle::State_Active)
if (w ? qt_macWindowMainWindow(w->window()) : (opt->state & QStyle::State_Active))
p->setPen(titlebarSeparatorLineActive);
else
p->setPen(titlebarSeparatorLineInactive);

View File

@ -1000,11 +1000,11 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn
emit q->currentTextChanged(text);
}
q->update();
}
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent event(q, QAccessible::NameChanged);
QAccessibleValueChangeEvent event(q, text);
QAccessible::updateAccessibility(&event);
#endif
}
}
void QComboBoxPrivate::_q_rowsInserted(const QModelIndex &parent, int start, int end)
@ -1269,7 +1269,7 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
if (!lineEdit)
emit q->currentTextChanged(text);
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent event(q, QAccessible::NameChanged);
QAccessibleValueChangeEvent event(q, text);
QAccessible::updateAccessibility(&event);
#endif
}
@ -2757,7 +2757,7 @@ void QComboBox::clear()
Q_D(QComboBox);
d->model->removeRows(0, d->model->rowCount(d->root), d->root);
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent event(this, QAccessible::NameChanged);
QAccessibleValueChangeEvent event(this, QString());
QAccessible::updateAccessibility(&event);
#endif
}
@ -2771,7 +2771,7 @@ void QComboBox::clearEditText()
if (d->lineEdit)
d->lineEdit->clear();
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent event(this, QAccessible::NameChanged);
QAccessibleValueChangeEvent event(this, QString());
QAccessible::updateAccessibility(&event);
#endif
}
@ -2785,7 +2785,7 @@ void QComboBox::setEditText(const QString &text)
if (d->lineEdit)
d->lineEdit->setText(text);
#ifndef QT_NO_ACCESSIBILITY
QAccessibleEvent event(this, QAccessible::NameChanged);
QAccessibleValueChangeEvent event(this, text);
QAccessible::updateAccessibility(&event);
#endif
}

View File

@ -1519,6 +1519,7 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
typedef void (*SetContentBorderEnabledFunction)(QWindow *window, bool enable);
(reinterpret_cast<SetContentBorderEnabledFunction>(function))(window()->windowHandle(), set);
update();
}
#endif

View File

@ -284,14 +284,15 @@ void QPlainTextDocumentLayoutPrivate::relayout()
/*! \reimp
*/
void QPlainTextDocumentLayout::documentChanged(int from, int /*charsRemoved*/, int charsAdded)
void QPlainTextDocumentLayout::documentChanged(int from, int charsRemoved, int charsAdded)
{
Q_D(QPlainTextDocumentLayout);
QTextDocument *doc = document();
int newBlockCount = doc->blockCount();
int charsChanged = qMax(charsRemoved, charsAdded);
QTextBlock changeStartBlock = doc->findBlock(from);
QTextBlock changeEndBlock = doc->findBlock(qMax(0, from + charsAdded - 1));
QTextBlock changeEndBlock = doc->findBlock(qMax(0, from + charsChanged - 1));
if (changeStartBlock == changeEndBlock && newBlockCount == d->blockCount) {
QTextBlock block = changeStartBlock;

View File

@ -80,6 +80,9 @@ private slots:
void utf8bom_data();
void utf8bom();
void utf8stateful_data();
void utf8stateful();
void utfHeaders_data();
void utfHeaders();
@ -1611,6 +1614,99 @@ void tst_QTextCodec::utf8bom()
QCOMPARE(codec->toUnicode(data.constData(), data.length(), &state), result);
}
void tst_QTextCodec::utf8stateful_data()
{
QTest::addColumn<QByteArray>("buffer1");
QTest::addColumn<QByteArray>("buffer2");
QTest::addColumn<QString>("result"); // null QString indicates decoder error
// valid buffer continuations
QTest::newRow("1of2+valid") << QByteArray("\xc2") << QByteArray("\xa0") << "\xc2\xa0";
QTest::newRow("1of3+valid") << QByteArray("\xe0") << QByteArray("\xa0\x80") << "\xe0\xa0\x80";
QTest::newRow("2of3+valid") << QByteArray("\xe0\xa0") << QByteArray("\x80") << "\xe0\xa0\x80";
QTest::newRow("1of4+valid") << QByteArray("\360") << QByteArray("\220\210\203") << "\360\220\210\203";
QTest::newRow("2of4+valid") << QByteArray("\360\220") << QByteArray("\210\203") << "\360\220\210\203";
QTest::newRow("3of4+valid") << QByteArray("\360\220\210") << QByteArray("\203") << "\360\220\210\203";
QTest::newRow("1ofBom+valid") << QByteArray("\xef") << QByteArray("\xbb\xbf") << "";
QTest::newRow("2ofBom+valid") << QByteArray("\xef\xbb") << QByteArray("\xbf") << "";
// invalid continuation
QTest::newRow("1of2+invalid") << QByteArray("\xc2") << QByteArray("a") << QString();
QTest::newRow("1of3+invalid") << QByteArray("\xe0") << QByteArray("a") << QString();
QTest::newRow("2of3+invalid") << QByteArray("\xe0\xa0") << QByteArray("a") << QString();
QTest::newRow("1of4+invalid") << QByteArray("\360") << QByteArray("a") << QString();
QTest::newRow("2of4+invalid") << QByteArray("\360\220") << QByteArray("a") << QString();
QTest::newRow("3of4+invalid") << QByteArray("\360\220\210") << QByteArray("a") << QString();
// invalid: sequence too short (the empty second buffer causes a state reset)
QTest::newRow("1of2+empty") << QByteArray("\xc2") << QByteArray() << QString();
QTest::newRow("1of3+empty") << QByteArray("\xe0") << QByteArray() << QString();
QTest::newRow("2of3+empty") << QByteArray("\xe0\xa0") << QByteArray() << QString();
QTest::newRow("1of4+empty") << QByteArray("\360") << QByteArray() << QString();
QTest::newRow("2of4+empty") << QByteArray("\360\220") << QByteArray() << QString();
QTest::newRow("3of4+empty") << QByteArray("\360\220\210") << QByteArray() << QString();
// overlong sequence:
QTest::newRow("overlong-1of2") << QByteArray("\xc1") << QByteArray("\x81") << QString();
QTest::newRow("overlong-1of3") << QByteArray("\xe0") << QByteArray("\x81\x81") << QString();
QTest::newRow("overlong-2of3") << QByteArray("\xe0\x81") << QByteArray("\x81") << QString();
QTest::newRow("overlong-1of4") << QByteArray("\xf0") << QByteArray("\x80\x81\x81") << QString();
QTest::newRow("overlong-2of4") << QByteArray("\xf0\x80") << QByteArray("\x81\x81") << QString();
QTest::newRow("overlong-3of4") << QByteArray("\xf0\x80\x81") << QByteArray("\x81") << QString();
// out of range:
// leading byte 0xF4 can produce codepoints above U+10FFFF, which aren't valid
QTest::newRow("outofrange1-1of4") << QByteArray("\xf4") << QByteArray("\x90\x80\x80") << QString();
QTest::newRow("outofrange1-2of4") << QByteArray("\xf4\x90") << QByteArray("\x80\x80") << QString();
QTest::newRow("outofrange1-3of4") << QByteArray("\xf4\x90\x80") << QByteArray("\x80") << QString();
QTest::newRow("outofrange2-1of4") << QByteArray("\xf5") << QByteArray("\x90\x80\x80") << QString();
QTest::newRow("outofrange2-2of4") << QByteArray("\xf5\x90") << QByteArray("\x80\x80") << QString();
QTest::newRow("outofrange2-3of4") << QByteArray("\xf5\x90\x80") << QByteArray("\x80") << QString();
QTest::newRow("outofrange-1of5") << QByteArray("\xf8") << QByteArray("\x88\x80\x80\x80") << QString();
QTest::newRow("outofrange-2of5") << QByteArray("\xf8\x88") << QByteArray("\x80\x80\x80") << QString();
QTest::newRow("outofrange-3of5") << QByteArray("\xf8\x88\x80") << QByteArray("\x80\x80") << QString();
QTest::newRow("outofrange-4of5") << QByteArray("\xf8\x88\x80\x80") << QByteArray("\x80") << QString();
QTest::newRow("outofrange-1of6") << QByteArray("\xfc") << QByteArray("\x84\x80\x80\x80\x80") << QString();
QTest::newRow("outofrange-2of6") << QByteArray("\xfc\x84") << QByteArray("\x80\x80\x80\x80") << QString();
QTest::newRow("outofrange-3of6") << QByteArray("\xfc\x84\x80") << QByteArray("\x80\x80\x80") << QString();
QTest::newRow("outofrange-4of6") << QByteArray("\xfc\x84\x80\x80") << QByteArray("\x80\x80") << QString();
QTest::newRow("outofrange-5of6") << QByteArray("\xfc\x84\x80\x80\x80") << QByteArray("\x80") << QString();
}
void tst_QTextCodec::utf8stateful()
{
QFETCH(QByteArray, buffer1);
QFETCH(QByteArray, buffer2);
QFETCH(QString, result);
QTextCodec *utf8codec = QTextCodec::codecForName("utf-8");
QVERIFY(utf8codec);
QTextCodec::ConverterState state;
memset(&state, 0, sizeof state);
QString decoded1 = utf8codec->toUnicode(buffer1, buffer1.size(), &state);
if (result.isNull()) {
// the decoder may have found an early error (invalidChars > 0):
// if it has, remainingChars == 0;
// if it hasn't, then it must have a state
QVERIFY2((state.remainingChars == 0) != (state.invalidChars == 0),
"remainingChars = " + QByteArray::number(state.remainingChars) +
"; invalidChars = " + QByteArray::number(state.invalidChars));
} else {
QVERIFY(state.remainingChars > 0);
QCOMPARE(state.invalidChars, 0);
}
QString decoded2 = utf8codec->toUnicode(buffer2, buffer2.size(), &state);
QCOMPARE(state.remainingChars, 0);
if (result.isNull()) {
QVERIFY(state.invalidChars > 0);
} else {
QCOMPARE(decoded1 + decoded2, result);
}
}
void tst_QTextCodec::utfHeaders_data()
{
QTest::addColumn<QByteArray>("codecName");

View File

@ -1073,10 +1073,8 @@ void tst_QFileInfo::fileTimes()
#endif
#if defined(Q_OS_WINCE)
QEXPECT_FAIL("simple", "WinCE only stores date of access data, not the time", Continue);
#elif defined(Q_OS_BLACKBERRY)
QEXPECT_FAIL("simple", "Blackberry OS uses the noatime filesystem option", Continue);
QEXPECT_FAIL("longfile", "Blackberry OS uses the noatime filesystem option", Continue);
QEXPECT_FAIL("longfile absolutepath", "Blackberry OS uses the noatime filesystem option", Continue);
#elif defined(Q_OS_QNX)
QEXPECT_FAIL("", "QNX uses the noatime filesystem option", Continue);
#endif
QVERIFY(fileInfo.lastRead() > beforeRead);
QVERIFY(fileInfo.lastModified() > beforeWrite);
@ -1511,8 +1509,7 @@ void tst_QFileInfo::isWritable()
QVERIFY(fi.exists());
QVERIFY(!fi.isWritable());
#endif
#if defined (Q_OS_BLACKBERRY)
// The Blackberry filesystem is read-only
#if defined (Q_OS_QNX) // On QNX /etc is usually on a read-only filesystem
QVERIFY(!QFileInfo("/etc/passwd").isWritable());
#elif defined (Q_OS_UNIX) && !defined(Q_OS_VXWORKS) // VxWorks does not have users/groups
if (::getuid() == 0)

View File

@ -44,6 +44,9 @@
#include <QtConcurrentRun>
#include <qlockfile.h>
#include <qtemporarydir.h>
#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
#include <unistd.h>
#endif
class tst_QLockFile : public QObject
{
@ -365,9 +368,12 @@ void tst_QLockFile::staleLockRace()
void tst_QLockFile::noPermissions()
{
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN)
// A readonly directory still allows us to create files, on Windows.
QSKIP("No permission testing on Windows");
#elif defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
if (::geteuid() == 0)
QSKIP("Test is not applicable with root privileges");
#endif
// Restore permissions so that the QTemporaryDir cleanup can happen
class PermissionRestorer

View File

@ -47,9 +47,8 @@
#include <qdir.h>
#include <qset.h>
#if defined(Q_OS_UNIX)
# include <unistd.h> // for geteuid
# include <sys/types.h>
#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
#include <unistd.h> // for geteuid
#endif
#if defined(Q_OS_WIN)
@ -199,6 +198,10 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnDir_data()
void tst_QSaveFile::transactionalWriteNoPermissionsOnDir()
{
#ifdef Q_OS_UNIX
#if !defined(Q_OS_VXWORKS)
if (::geteuid() == 0)
QSKIP("Test is not applicable with root privileges");
#endif
QFETCH(bool, directWriteFallback);
QTemporaryDir dir;
QVERIFY(dir.isValid());
@ -253,6 +256,10 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnDir()
void tst_QSaveFile::transactionalWriteNoPermissionsOnFile()
{
#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
if (::geteuid() == 0)
QSKIP("Test is not applicable with root privileges");
#endif
// Setup an existing but readonly file
QTemporaryDir dir;
QVERIFY(dir.isValid());
@ -299,6 +306,10 @@ void tst_QSaveFile::transactionalWriteCanceled()
void tst_QSaveFile::transactionalWriteErrorRenaming()
{
#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
if (::geteuid() == 0)
QSKIP("Test is not applicable with root privileges");
#endif
QTemporaryDir dir;
QVERIFY(dir.isValid());
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");

View File

@ -2549,7 +2549,7 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(msecBefore.isValid());
QCOMPARE(msecBefore.date(), QDate(2012, 10, 28));
QCOMPARE(msecBefore.time(), QTime(2, 59, 59, 999));
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
#if defined(Q_OS_MAC) || defined(Q_OS_WIN) || defined(Q_OS_QNX)
// Win and Mac uses SecondOccurrence here
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
#endif // Q_OS_MAC
@ -2571,7 +2571,7 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(afterTran.isValid());
QCOMPARE(afterTran.date(), QDate(2012, 10, 28));
QCOMPARE(afterTran.time(), QTime(2, 59, 59, 999));
#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_QNX)
// Linux mktime bug uses last calculation
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
#endif // Q_OS_UNIX
@ -2629,7 +2629,7 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(test.isValid());
QCOMPARE(test.date(), QDate(2012, 10, 28));
QCOMPARE(test.time(), QTime(2, 0, 0));
#ifndef Q_OS_MAC
#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX)
// Linux mktime bug uses last calculation
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
#endif // Q_OS_MAC
@ -2671,7 +2671,7 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(test.isValid());
QCOMPARE(test.date(), QDate(2012, 10, 28));
QCOMPARE(test.time(), QTime(2, 0, 0));
#ifndef Q_OS_MAC
#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX)
// Linux mktime bug uses last calculation
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
#endif // Q_OS_MAC
@ -2713,7 +2713,7 @@ void tst_QDateTime::daylightTransitions() const
QVERIFY(test.isValid());
QCOMPARE(test.date(), QDate(2012, 10, 28));
QCOMPARE(test.time(), QTime(2, 0, 0));
#ifndef Q_OS_MAC
#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX)
// Linux mktime bug uses last calculation
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
#endif // Q_OS_MAC
@ -2778,12 +2778,12 @@ void tst_QDateTime::daylightTransitions() const
test = test.addMSecs(msecsOneHour);
QVERIFY(test.isValid());
QCOMPARE(test.date(), QDate(2012, 10, 28));
#ifdef Q_OS_MAC
#if defined(Q_OS_MAC) || defined(Q_OS_QNX)
// Mac uses FirstOccurrence, Windows uses SecondOccurrence, Linux uses last calculation
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
#endif // Q_OS_WIN
QCOMPARE(test.time(), QTime(3, 0, 0));
#ifdef Q_OS_MAC
#if defined(Q_OS_MAC) || defined(Q_OS_QNX)
// Mac uses FirstOccurrence, Windows uses SecondOccurrence, Linux uses last calculation
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
#endif // Q_OS_WIN

View File

@ -99,6 +99,8 @@ private slots:
void rawFontSetPixelSize();
void multipleRawFontsFromData();
void rawFontFromInvalidData();
private:
QString testFont;
QString testFontBoldItalic;
@ -942,6 +944,15 @@ void tst_QRawFont::multipleRawFontsFromData()
|| testFont.style() != (testFontBoldItalic.style()));
}
void tst_QRawFont::rawFontFromInvalidData()
{
QByteArray invalidData("foobar");
QRawFont font;
font.loadFromData(invalidData, 10, QFont::PreferDefaultHinting);
QVERIFY(!font.isValid());
}
#endif // QT_NO_RAWFONT
QTEST_MAIN(tst_QRawFont)

View File

@ -2,5 +2,6 @@ TEMPLATE=subdirs
SUBDIRS=\
qnetworkconfiguration \
qnetworkconfigurationmanager \
qnetworkconfigurationmanagerqappless \
qnetworksession \

View File

@ -0,0 +1,6 @@
CONFIG += testcase
TARGET = tst_qnetworkconfigurationmanagerqappless
SOURCES += tst_qnetworkconfigurationmanagerqappless.cpp
HEADERS += ../qbearertestcommon.h
QT = core network testlib

View File

@ -0,0 +1,73 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QtTest>
#include <QtNetwork/qnetworkaccessmanager.h>
QT_USE_NAMESPACE
class tst_QNetworkConfigurationManager : public QObject
{
Q_OBJECT
private slots:
void staticsInitialization();
};
void tst_QNetworkConfigurationManager::staticsInitialization()
{
// This code should not crash. The test was introduced as
// a fix for https://bugreports.qt-project.org/browse/QTBUG-36897
for (int i = 0; i < 2; i++)
{
int argc = 1;
const char *testName = "tst_qnetworkconfigurationmanagerqappless";
char **argv = const_cast<char **>(&testName);
QCoreApplication app(argc, argv);
QNetworkAccessManager qnam;
Q_UNUSED(app);
Q_UNUSED(qnam);
}
QVERIFY(true);
}
QTEST_APPLESS_MAIN(tst_QNetworkConfigurationManager)
#include "tst_qnetworkconfigurationmanagerqappless.moc"

View File

@ -570,16 +570,10 @@ void tst_QSocks5SocketEngine::udpTest()
QVERIFY(udpSocket.state() == QAbstractSocket::UnconnectedState);
// Bind #1
#if defined(UBUNTU_ONEIRIC) && defined(__x86_64__)
{
bool bindSuccessful = udpSocket.bind(QHostAddress("0.0.0.0"), 0);
if (!bindSuccessful)
QEXPECT_FAIL("", "QTBUG-23380: Fails on some Ubuntu 11.10 x64 configurations", Abort);
QVERIFY(bindSuccessful);
}
#else
QVERIFY(udpSocket.bind(QHostAddress("0.0.0.0"), 0));
#endif
bool bindSuccessful = udpSocket.bind(QHostAddress("0.0.0.0"), 0);
if (!bindSuccessful)
QEXPECT_FAIL("", "QTBUG-23380 / QTBUG-35490: Fails on some Ubuntu 11.10 x64 configurations and on new network test server", Abort);
QVERIFY(bindSuccessful);
QVERIFY(udpSocket.state() == QAbstractSocket::BoundState);
QVERIFY(udpSocket.localPort() != 0);

View File

@ -315,6 +315,8 @@ void tst_QAccessibility::initTestCase()
{
QTestAccessibility::initialize();
QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration();
if (!pfIntegration->accessibility())
QSKIP("This platform does not support accessibility");
pfIntegration->accessibility()->setActive(true);
}

View File

@ -531,9 +531,11 @@ static QProcessEnvironment processEnvironment()
const QProcessEnvironment systemEnvironment = QProcessEnvironment::systemEnvironment();
foreach (const QString &key, systemEnvironment.keys()) {
const bool useVariable = key == QLatin1String("PATH") || key == QLatin1String("QT_QPA_PLATFORM")
#ifdef Q_OS_UNIX
#if defined(Q_OS_QNX)
|| key == QLatin1String("GRAPHICS_ROOT") || key == QLatin1String("TZ")
#elif defined(Q_OS_UNIX)
|| key == QLatin1String("HOME") || key == QLatin1String("USER") // Required for X11 on openSUSE
# ifndef Q_OS_MAC
# if !defined(Q_OS_MAC)
|| key == QLatin1String("DISPLAY") || key == QLatin1String("XAUTHLOCALHOSTNAME")
|| key.startsWith(QLatin1String("XDG_"))
# endif // !Q_OS_MAC

View File

@ -2,4 +2,7 @@ CONFIG += testcase
TARGET = tst_qmenu
QT += widgets testlib
SOURCES += tst_qmenu.cpp
macx:{
OBJECTIVE_SOURCES += tst_qmenu_mac.mm
LIBS += -lobjc
}

View File

@ -116,6 +116,10 @@ private slots:
void QTBUG30595_rtl_submenu();
void QTBUG20403_nested_popup_on_shortcut_trigger();
void QTBUG_10735_crashWithDialog();
#ifdef Q_OS_MAC
void QTBUG_37933_ampersands_data();
void QTBUG_37933_ampersands();
#endif
protected slots:
void onActivated(QAction*);
void onHighlighted(QAction*);
@ -1025,5 +1029,24 @@ void tst_QMenu::QTBUG_10735_crashWithDialog()
menu.activateAction(0);
}
#ifdef Q_OS_MAC
void tst_QMenu::QTBUG_37933_ampersands_data()
{
QTest::addColumn<QString>("title");
QTest::addColumn<QString>("visibleTitle");
QTest::newRow("simple") << QString("Test") << QString("Test");
QTest::newRow("ampersand") << QString("&Test") << QString("Test");
QTest::newRow("double_ampersand") << QString("&Test && more") << QString("Test & more");
}
void tst_qmenu_QTBUG_37933_ampersands();
void tst_QMenu::QTBUG_37933_ampersands()
{
// external in .mm file
tst_qmenu_QTBUG_37933_ampersands();
}
#endif
QTEST_MAIN(tst_QMenu)
#include "tst_qmenu.moc"

View File

@ -0,0 +1,59 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#import <Cocoa/Cocoa.h>
#include <QMenu>
#include <QTest>
void tst_qmenu_QTBUG_37933_ampersands()
{
QMenu m;
QFETCH(QString, title);
QFETCH(QString, visibleTitle);
m.addAction(title);
NSMenu* nativeMenu = m.toNSMenu();
Q_ASSERT(nativeMenu != 0);
NSMenuItem* item = [nativeMenu itemAtIndex:0];
Q_ASSERT(item != 0);
QCOMPARE(QString::fromUtf8([[item title] UTF8String]), visibleTitle);
}

View File

@ -154,6 +154,7 @@ private slots:
void findBackwardWithRegExp();
void findWithRegExpReturnsFalseIfNoMoreResults();
#endif
void layoutAfterMultiLineRemove();
private:
void createSelection();
@ -1567,5 +1568,49 @@ void tst_QPlainTextEdit::findWithRegExpReturnsFalseIfNoMoreResults()
}
#endif
void tst_QPlainTextEdit::layoutAfterMultiLineRemove()
{
ed->setVisible(true); // The widget must be visible to reproduce this bug.
QString contents;
for (int i = 0; i < 5; ++i)
contents.append("\ttest\n");
ed->setPlainText(contents);
/*
* Remove the tab from the beginning of lines 2-4, in an edit block. The
* edit block is required for the bug to be reproduced.
*/
QTextCursor curs = ed->textCursor();
curs.movePosition(QTextCursor::Start);
curs.movePosition(QTextCursor::NextBlock);
curs.beginEditBlock();
for (int i = 0; i < 3; ++i) {
curs.deleteChar();
curs.movePosition(QTextCursor::NextBlock);
}
curs.endEditBlock();
/*
* Now, we're going to perform the following actions:
*
* - Move to the beginning of the document.
* - Move down three times - this should put us at the front of block 3.
* - Move to the end of the line.
*
* At this point, if the document layout is behaving correctly, we should
* still be positioned on block 3. Verify that this is the case.
*/
curs.movePosition(QTextCursor::Start);
curs.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, 3);
curs.movePosition(QTextCursor::EndOfLine);
QCOMPARE(curs.blockNumber(), 3);
}
QTEST_MAIN(tst_QPlainTextEdit)
#include "tst_qplaintextedit.moc"

View File

@ -4039,8 +4039,9 @@ void Configure::buildQmake()
stream << "QT_VERSION = " << dictionary["VERSION"] << endl;
if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) {
stream << "QMAKESPEC = $(SOURCE_PATH)\\mkspecs\\win32-g++" << endl
<< "EXTRA_CFLAGS = -DUNICODE" << endl
<< "EXTRA_CXXFLAGS = -DUNICODE" << endl
<< "EXTRA_CFLAGS = -DUNICODE -ffunction-sections" << endl
<< "EXTRA_CXXFLAGS = -DUNICODE -ffunction-sections" << endl
<< "EXTRA_LFLAGS = -Wl,--gc-sections" << endl
<< "QTOBJS = qfilesystemengine_win.o \\" << endl
<< " qfilesystemiterator_win.o \\" << endl
<< " qfsfileengine_win.o \\" << endl