Merge "Merge branch 'stable' into dev" into refs/staging/dev

This commit is contained in:
Sergio Ahumada 2013-09-27 11:31:32 +02:00 committed by The Qt Project
commit 150b8ca294
85 changed files with 1055 additions and 311 deletions

View File

@ -125,8 +125,8 @@ manifestmeta.android.names = "QtQuick/Qt Quick Demo - Maroon*" \
"QtLinguist/Arrow Pad Example" \ "QtLinguist/Arrow Pad Example" \
"QtGui/Raster Window Example" \ "QtGui/Raster Window Example" \
"QtGui/Analog Clock Window Example" \ "QtGui/Analog Clock Window Example" \
"QtMultimedia/Video Widget Example" \ "QtMultimediaWidgets/Video Widget Example" \
"QtMultimedia/Media Player Example" \ "QtMultimediaWidgets/Media Player Example" \
"QtSVG/Text Object Example" \ "QtSVG/Text Object Example" \
"QtQML/Qt Quick Examples - XMLHttpRequest" \ "QtQML/Qt Quick Examples - XMLHttpRequest" \
"QtQuick/Qt Quick Particles Examples - *" \ "QtQuick/Qt Quick Particles Examples - *" \
@ -188,7 +188,7 @@ manifestmeta.thumbnail.names = "QtConcurrent/Map Example" \
"QtHelp/*" \ "QtHelp/*" \
"QtMultimedia/AudioEngine Example" \ "QtMultimedia/AudioEngine Example" \
"QtMultimedia/Declarative Radio Example" \ "QtMultimedia/Declarative Radio Example" \
"QtMultimedia/Media Player Example" \ "QtMultimediaWidgets/Media Player Example" \
"QtQml/Extending QML*" \ "QtQml/Extending QML*" \
"QtQuick/Qt Quick Examples - Accessibility" \ "QtQuick/Qt Quick Examples - Accessibility" \
"QtSensors/Qt Sensors - SensorGesture QML Type example" \ "QtSensors/Qt Sensors - SensorGesture QML Type example" \

View File

@ -79,12 +79,14 @@ char **qtArgv;
QApplication *qtApp = 0; QApplication *qtApp = 0;
} }
@interface WindowCreator : NSObject {} @interface WindowCreator : NSObject <NSApplicationDelegate>
- (void)createWindow;
@end @end
@implementation WindowCreator @implementation WindowCreator
- (void)createWindow {
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
Q_UNUSED(notification)
// Qt widgets rely on a QApplication being alive somewhere // Qt widgets rely on a QApplication being alive somewhere
qtApp = new QApplication(qtArgc, qtArgv); qtApp = new QApplication(qtArgc, qtArgv);
@ -120,18 +122,25 @@ QApplication *qtApp = 0;
// Show the NSWindow // Show the NSWindow
[window makeKeyAndOrderFront:NSApp]; [window makeKeyAndOrderFront:NSApp];
} }
- (void)applicationWillTerminate:(NSNotification *)notification
{
Q_UNUSED(notification)
delete qtApp;
}
@end @end
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
Q_UNUSED(pool);
// Normally, we would use the application delegate. // Normally, we would use let the main bundle instanciate and set
// We resort to the notification mechanism for conciseness. // the application delegate, but we set it manually for conciseness.
WindowCreator *windowCreator= [WindowCreator alloc]; WindowCreator *windowCreator= [WindowCreator alloc];
[[NSNotificationCenter defaultCenter] [[NSApplication sharedApplication] setDelegate:windowCreator];
addObserver:windowCreator selector:@selector(createWindow)
name:NSApplicationDidFinishLaunchingNotification object:nil];
// Save these for QApplication // Save these for QApplication
qtArgc = argc; qtArgc = argc;

View File

@ -54,7 +54,7 @@ class QEglFS8726MHooks : public QEglFSHooks
{ {
public: public:
virtual QSize screenSize() const; virtual QSize screenSize() const;
virtual EGLNativeWindowType createNativeWindow(const QSize &size, const QSurfaceFormat &format); virtual EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format);
virtual void destroyNativeWindow(EGLNativeWindowType window); virtual void destroyNativeWindow(EGLNativeWindowType window);
}; };
@ -75,9 +75,10 @@ QSize QEglFS8726MHooks::screenSize() const
return QSize(vinfo.xres, vinfo.yres); return QSize(vinfo.xres, vinfo.yres);
} }
EGLNativeWindowType QEglFS8726MHooks::createNativeWindow(const QSize &size, const QSurfaceFormat &format) EGLNativeWindowType QEglFS8726MHooks::createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format)
{ {
Q_UNUSED(format); Q_UNUSED(window)
Q_UNUSED(format)
fbdev_window *window = new fbdev_window; fbdev_window *window = new fbdev_window;
window->width = size.width(); window->width = size.width();

View File

@ -49,7 +49,7 @@ class QEglFSImx6Hooks : public QEglFSHooks
public: public:
QEglFSImx6Hooks(); QEglFSImx6Hooks();
virtual QSize screenSize() const; virtual QSize screenSize() const;
virtual EGLNativeWindowType createNativeWindow(const QSize &size, const QSurfaceFormat &format); virtual EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format);
virtual void destroyNativeWindow(EGLNativeWindowType window); virtual void destroyNativeWindow(EGLNativeWindowType window);
virtual EGLNativeDisplayType platformDisplay() const; virtual EGLNativeDisplayType platformDisplay() const;
@ -78,9 +78,10 @@ EGLNativeDisplayType QEglFSImx6Hooks::platformDisplay() const
return mNativeDisplay; return mNativeDisplay;
} }
EGLNativeWindowType QEglFSImx6Hooks::createNativeWindow(const QSize &size, const QSurfaceFormat &format) EGLNativeWindowType QEglFSImx6Hooks::createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format)
{ {
Q_UNUSED(format); Q_UNUSED(window)
Q_UNUSED(format)
EGLNativeWindowType eglWindow = fbCreateWindow(mNativeDisplay, 0, 0, size.width(), size.height()); EGLNativeWindowType eglWindow = fbCreateWindow(mNativeDisplay, 0, 0, size.width(), size.height());
return eglWindow; return eglWindow;

View File

@ -226,7 +226,7 @@ public:
virtual void platformDestroy(); virtual void platformDestroy();
virtual EGLNativeDisplayType platformDisplay() const; virtual EGLNativeDisplayType platformDisplay() const;
virtual QSize screenSize() const; virtual QSize screenSize() const;
virtual EGLNativeWindowType createNativeWindow(const QSize &size, const QSurfaceFormat &format); virtual EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format);
virtual void destroyNativeWindow(EGLNativeWindowType window); virtual void destroyNativeWindow(EGLNativeWindowType window);
virtual bool hasCapability(QPlatformIntegration::Capability cap) const; virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
@ -258,8 +258,9 @@ QSize QEglFSPiHooks::screenSize() const
return QSize(width, height); return QSize(width, height);
} }
EGLNativeWindowType QEglFSPiHooks::createNativeWindow(const QSize &size, const QSurfaceFormat &format) EGLNativeWindowType QEglFSPiHooks::createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format)
{ {
Q_UNUSED(window)
return createDispmanxLayer(QPoint(0, 0), size, 1, format.hasAlpha() ? DISPMANX_FLAGS_ALPHA_FROM_SOURCE : DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS); return createDispmanxLayer(QPoint(0, 0), size, 1, format.hasAlpha() ? DISPMANX_FLAGS_ALPHA_FROM_SOURCE : DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS);
} }

View File

@ -2,13 +2,10 @@ contains(TEMPLATE, ".*app") {
!android_app { !android_app {
!contains(TARGET, ".so"): TARGET = lib$${TARGET}.so !contains(TARGET, ".so"): TARGET = lib$${TARGET}.so
QMAKE_LFLAGS += -Wl,-soname,$$TARGET QMAKE_LFLAGS += -Wl,-soname,$$TARGET
}
} android_install: {
!QTDIR_build:android_install {
isEmpty(QT_BUILD_TREE) {
target.path=/libs/$$ANDROID_TARGET_ARCH/ target.path=/libs/$$ANDROID_TARGET_ARCH/
} else {
target.path = /
}
INSTALLS *= target INSTALLS *= target
}
}
} }

View File

@ -45,10 +45,10 @@ contains(TEMPLATE, ".*app"):!build_pass:!android-no-sdk {
FILE_CONTENT += " \"android-package\": \"$$ANDROID_PACKAGE\"," FILE_CONTENT += " \"android-package\": \"$$ANDROID_PACKAGE\","
!isEmpty(ANDROID_MINIMUM_VERSION): \ !isEmpty(ANDROID_MINIMUM_VERSION): \
FILE_CONTENT += " \"android-minimum-version\": \"$$ANDROID_MINIMUM_VERSION\"," FILE_CONTENT += " \"android-minimum-version\": $$ANDROID_MINIMUM_VERSION,"
!isEmpty(ANDROID_TARGET_VERSION): \ !isEmpty(ANDROID_TARGET_VERSION): \
FILE_CONTENT += " \"android-target-version\": \"$$ANDROID_TARGET_VERSION\"," FILE_CONTENT += " \"android-target-version\": $$ANDROID_TARGET_VERSION,"
!isEmpty(ANDROID_APP_NAME): \ !isEmpty(ANDROID_APP_NAME): \
FILE_CONTENT += " \"android-app-name\": \"$$ANDROID_APP_NAME\"," FILE_CONTENT += " \"android-app-name\": \"$$ANDROID_APP_NAME\","

View File

@ -19,7 +19,7 @@ equals(TEMPLATE, app) {
# We use xcodebuild to do the actual build, but filter out the verbose # We use xcodebuild to do the actual build, but filter out the verbose
# output that shows all environment variables for each build step. # output that shows all environment variables for each build step.
xcodebuild_build.commands = "@xcodebuild build | grep -v setenv" xcodebuild_build.commands = "@bash -o pipefail -c 'xcodebuild | grep -v setenv'"
QMAKE_EXTRA_TARGETS += xcodebuild_build QMAKE_EXTRA_TARGETS += xcodebuild_build
all.depends = xcodebuild_build all.depends = xcodebuild_build
QMAKE_EXTRA_TARGETS += all QMAKE_EXTRA_TARGETS += all

View File

@ -62,7 +62,7 @@ class QEglFSPandaHooks : public QEglFSHooks
{ {
public: public:
QEglFSPandaHooks(); QEglFSPandaHooks();
virtual EGLNativeWindowType createNativeWindow(const QSize &size, const QSurfaceFormat &format); virtual EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format);
virtual bool filterConfig(EGLDisplay display, EGLConfig config) const; virtual bool filterConfig(EGLDisplay display, EGLConfig config) const;
virtual const char *fbDeviceName() const { return "/dev/graphics/fb0"; } virtual const char *fbDeviceName() const { return "/dev/graphics/fb0"; }
@ -103,8 +103,9 @@ void QEglFSPandaHooks::ensureFramebufferNativeWindowCreated()
window->query(window, NATIVE_WINDOW_FORMAT, &mFramebufferVisualId); window->query(window, NATIVE_WINDOW_FORMAT, &mFramebufferVisualId);
} }
EGLNativeWindowType QEglFSPandaHooks::createNativeWindow(const QSize &size, const QSurfaceFormat &format) EGLNativeWindowType QEglFSPandaHooks::createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format)
{ {
Q_UNUSED(window)
return mUseFramebuffer ? createNativeWindowFramebuffer(size, format) : createNativeWindowSurfaceFlinger(size, format); return mUseFramebuffer ? createNativeWindowFramebuffer(size, format) : createNativeWindowSurfaceFlinger(size, format);
} }

View File

@ -1,4 +1,4 @@
CONFIG -= qt CONFIG -= qt android_install
javaresources.files = \ javaresources.files = \
$$PWD/AndroidManifest.xml \ $$PWD/AndroidManifest.xml \

View File

@ -27,7 +27,7 @@ qhp.QtConcurrent.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtconcurrent/qtconcurrent.tags tagfile = ../../../doc/qtconcurrent/qtconcurrent.tags
depends += qtcore depends += qtcore qtdoc
headerdirs += .. headerdirs += ..

View File

@ -90,10 +90,13 @@ static qint64 getticks()
# if (_POSIX_THREAD_CPUTIME-0 == 0) # if (_POSIX_THREAD_CPUTIME-0 == 0)
// detect availablility of CLOCK_THREAD_CPUTIME_ID // detect availablility of CLOCK_THREAD_CPUTIME_ID
static long useThreadCpuTime = -2; static QBasicAtomicInt sUseThreadCpuTime = Q_BASIC_ATOMIC_INITIALIZER(-2);
int useThreadCpuTime = sUseThreadCpuTime.load();
if (useThreadCpuTime == -2) { if (useThreadCpuTime == -2) {
// sysconf() will return either -1 or _POSIX_VERSION (don't care about thread races here) // sysconf() will return either -1L or _POSIX_VERSION
useThreadCpuTime = sysconf(_SC_THREAD_CPUTIME); // (don't care about sysconf's exact return value)
useThreadCpuTime = sysconf(_SC_THREAD_CPUTIME) == -1L ? -1 : 0 ;
sUseThreadCpuTime.store(useThreadCpuTime); // might happen multiple times, but doesn't matter
} }
if (useThreadCpuTime != -1) if (useThreadCpuTime != -1)
clockId = CLOCK_THREAD_CPUTIME_ID; clockId = CLOCK_THREAD_CPUTIME_ID;

View File

@ -0,0 +1,180 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <QCoreApplication>
#include <QLoggingCategory>
//![1]
QLoggingCategory theFooArea("foo");
QLoggingCategory theBarArea("bar");
QLoggingCategory theBazArea("baz");
//![1]
// Note: These locations are Ubuntu specific.
// Note: To make the example work with user permissions, make sure
// the files are user-writable and the path leading there accessible.
const char traceSwitch[] = "/sys/kernel/debug/tracing/tracing_on";
const char traceSink[] = "/sys/kernel/debug/tracing/trace_marker";
// The base class only serves as a facility to share code
// between the "single line" data logging aspect and the
// scoped "measuring" aspect.
// Both aspects and the base class could be combined into
// a single tracer serving both purposes, but are split
// here for clarity.
// Error handling is left as an exercise.
//![2]
class MyTracerBase : public QTracer
{
public:
MyTracerBase() {
enable = ::open(traceSwitch, O_WRONLY);
marker = ::open(traceSink, O_WRONLY);
}
~MyTracerBase() {
::close(enable);
::close(marker);
}
protected:
int enable;
int marker;
};
//![2]
//![2]
class MyTracer : public MyTracerBase
{
public:
void start() { ::write(marker, "B", 1); }
void end() { ::write(marker, "E", 1); }
};
//![2]
//![3]
class MyDataLogger : public MyTracerBase
{
public:
MyDataLogger() {
buf[0] = 0;
pos = 0;
}
void record(int i) { pos += sprintf(buf + pos, "%d", i); }
void record(const char *msg) { pos += sprintf(buf + pos, "%s", msg); }
void end() { ::write(marker, buf, pos); pos = 0; }
private:
char buf[100];
int pos;
};
//![3]
// Simplest possible example for "measuring".
//![4]
int foo(int i)
{
qCTraceGuard(theFooArea);
// Here could be some lengthy code.
return i * i;
}
//![4]
// We can switch on/off tracing dynamically.
// The tracer will be temporarily switched off at the third call
// and re-enabled at the eighth.
//![5]
int bar(int i)
{
static int n = 0;
++n;
if (n == 3)
theBarArea.setEnabled(QtTraceMsg, false);
if (n == 8)
theBarArea.setEnabled(QtTraceMsg, true);
qCTraceGuard(theBarArea);
return i * i;
}
//![5]
// An example to create "complex" log messages.
//![6]
int baz(int i)
{
qCTrace(theBazArea) << 32 << "some stuff";
return i * i;
}
//![6]
//![7]
namespace {
static struct Init
{
Init() {
tracer.addToCategory(theFooArea);
tracer.addToCategory(theBarArea);
logger.addToCategory(theBazArea);
}
MyTracer tracer;
MyDataLogger logger;
} initializer;
}
//![7]

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 examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
int foo(int i);
int bar(int i);
int baz(int i);
int main()
{
int s = 0;
for (int i = 0; i != 10; ++i)
s += foo(i);
for (int i = 0; i != 10; ++i)
s += bar(i);
for (int i = 0; i != 10; ++i)
s += baz(i);
return s;
}

View File

@ -0,0 +1,2 @@
SOURCES += ftracer.cpp main.cpp

View File

@ -46,26 +46,6 @@
\title ISO 8601 \title ISO 8601
*/ */
/*!
\externalpage http://www.ietf.org/rfc/rfc3986.txt
\title RFC 3986
*/
/*!
\externalpage http://www.ietf.org/rfc/rfc1738.txt
\title RFC 1738
*/
/*!
\externalpage http://www.ietf.org/rfc/rfc3941.txt
\title RFC 3491
*/
/*!
\externalpage http://www.ietf.org/rfc/rfc2045.txt
\title RFC 2045
*/
/*! /*!
\externalpage http://www.ietf.org/rfc/rfc4648.txt \externalpage http://www.ietf.org/rfc/rfc4648.txt
\title RFC 4648 \title RFC 4648

View File

@ -717,6 +717,10 @@ Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n);
A message generated by the qCritical() function. A message generated by the qCritical() function.
\value QtFatalMsg \value QtFatalMsg
A message generated by the qFatal() function. A message generated by the qFatal() function.
\value QtTraceMsg
Used by the qCTrace() macro. Trace events are usually passed only
to dedicated \a QTracer objects, and do not appear in the installed
message handler.
\value QtSystemMsg \value QtSystemMsg

View File

@ -814,6 +814,7 @@ Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type, const QMessageLogCont
case QtWarningMsg: message.append(QLatin1String("warning")); break; case QtWarningMsg: message.append(QLatin1String("warning")); break;
case QtCriticalMsg:message.append(QLatin1String("critical")); break; case QtCriticalMsg:message.append(QLatin1String("critical")); break;
case QtFatalMsg: message.append(QLatin1String("fatal")); break; case QtFatalMsg: message.append(QLatin1String("fatal")); break;
case QtTraceMsg: message.append(QLatin1String("trace")); break;
} }
} else if (token == fileTokenC) { } else if (token == fileTokenC) {
if (context.file) if (context.file)

View File

@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class QDebug; class QDebug;
class QNoDebug; class QNoDebug;
enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg }; enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtTraceMsg, QtSystemMsg = QtCriticalMsg };
class QMessageLogContext class QMessageLogContext
{ {

View File

@ -511,7 +511,14 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea
if (slash) { if (slash) {
const QByteArray chunk = QFile::encodeName(dirName.left(slash)); const QByteArray chunk = QFile::encodeName(dirName.left(slash));
if (QT_MKDIR(chunk.constData(), 0777) != 0) { if (QT_MKDIR(chunk.constData(), 0777) != 0) {
if (errno == EEXIST) { if (errno == EEXIST
#if defined(Q_OS_QNX)
// On QNX the QNet (VFS paths of other hosts mounted under a directory
// such as /net) mountpoint returns ENOENT, despite existing. stat()
// on the QNet mountpoint returns successfully and reports S_IFDIR.
|| errno == ENOENT
#endif
) {
QT_STATBUF st; QT_STATBUF st;
if (QT_STAT(chunk.constData(), &st) == 0 && (st.st_mode & S_IFMT) == S_IFDIR) if (QT_STAT(chunk.constData(), &st) == 0 && (st.st_mode & S_IFMT) == S_IFDIR)
continue; continue;

View File

@ -107,7 +107,8 @@ QLoggingCategory::QLoggingCategory(const char *category)
: name(0), : name(0),
enabledDebug(false), enabledDebug(false),
enabledWarning(true), enabledWarning(true),
enabledCritical(true) enabledCritical(true),
enabledTrace(false)
{ {
bool isDefaultCategory bool isDefaultCategory
= (category == 0) || (strcmp(category, qtDefaultCategoryName) == 0); = (category == 0) || (strcmp(category, qtDefaultCategoryName) == 0);
@ -122,7 +123,8 @@ QLoggingCategory::QLoggingCategory(const char *category)
} }
if (QLoggingRegistry *reg = QLoggingRegistry::instance()) if (QLoggingRegistry *reg = QLoggingRegistry::instance())
reg->registerCategory(this);} reg->registerCategory(this);
}
/*! /*!
Destructs a QLoggingCategory object Destructs a QLoggingCategory object
@ -164,6 +166,7 @@ bool QLoggingCategory::isEnabled(QtMsgType msgtype) const
case QtDebugMsg: return enabledDebug; case QtDebugMsg: return enabledDebug;
case QtWarningMsg: return enabledWarning; case QtWarningMsg: return enabledWarning;
case QtCriticalMsg: return enabledCritical; case QtCriticalMsg: return enabledCritical;
case QtTraceMsg: return enabledTrace;
case QtFatalMsg: return true; case QtFatalMsg: return true;
default: break; default: break;
} }
@ -177,6 +180,10 @@ bool QLoggingCategory::isEnabled(QtMsgType msgtype) const
change e.g. the settings of another objects for the same category name. change e.g. the settings of another objects for the same category name.
\note QtFatalMsg cannot be changed. It will always return true. \note QtFatalMsg cannot be changed. It will always return true.
Example:
\snippet qtracer/ftracer.cpp 5
*/ */
void QLoggingCategory::setEnabled(QtMsgType type, bool enable) void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
{ {
@ -184,6 +191,7 @@ void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
case QtDebugMsg: enabledDebug = enable; break; case QtDebugMsg: enabledDebug = enable; break;
case QtWarningMsg: enabledWarning = enable; break; case QtWarningMsg: enabledWarning = enable; break;
case QtCriticalMsg: enabledCritical = enable; break; case QtCriticalMsg: enabledCritical = enable; break;
case QtTraceMsg: enabledTrace = enable; break;
case QtFatalMsg: case QtFatalMsg:
default: break; default: break;
} }
@ -319,11 +327,60 @@ void QLoggingCategory::setFilterRules(const QString &rules)
\snippet qloggingcategory/main.cpp 12 \snippet qloggingcategory/main.cpp 12
\note Arguments are not processed if critical output for the category is not \note Arguments are not processed if critical output for the category is not
enabled, so do not reply on any side effects. enabled, so do not rely on any side effects.
\sa qCritical() \sa qCritical()
*/ */
/*!
\relates QLoggingCategory
\macro qCTrace(category)
\since 5.2
Returns an output stream for trace messages in the logging category
\a category.
The macro expands to code that first checks whether
\l QLoggingCategory::isEnabled() evaluates for trace output to \c{true}.
If so, the stream arguments are processed and sent to the tracers
registered with the category.
\note Arguments are not processed if trace output for the category is not
enabled, so do not rely on any side effects.
Example:
\snippet qtracer/ftracer.cpp 6
\sa qCTraceGuard()
*/
/*!
\relates QLoggingCategory
\macro qCTraceGuard(category)
\since 5.2
The macro expands to code that creates a guard object with automatic
storage. The guard constructor checks whether
\l QLoggingCategory::isEnabled() evaluates for trace output to \c{true}.
If so, the stream arguments are processed and the \c{start()}
functions of the tracers registered with the \a category are called.
The guard destructor also checks whether the category is enabled for
tracing and if so, the \c{end()}
functions of the tracers registered with the \a category are called.
\note Arguments are always processed, even if trace output for the
category is disabled. They will, however, in that case not be passed
to the \c{record()} functions of the registered tracers.
Example:
\snippet qtracer/ftracer.cpp 4
\sa qCTrace()
*/
/*! /*!
\macro Q_DECLARE_LOGGING_CATEGORY(name) \macro Q_DECLARE_LOGGING_CATEGORY(name)
\relates QLoggingCategory \relates QLoggingCategory
@ -349,4 +406,234 @@ void QLoggingCategory::setFilterRules(const QString &rules)
This macro must be used outside of a class or method. This macro must be used outside of a class or method.
*/ */
/*!
\class QTracer
\inmodule QtCore
\since 5.2
\brief The QTracer class provides an interface for handling
trace events associated with a logging category.
\c QTracer objects are registered with logging categories.
Multiple \c QTracer objects
can be registered with the same category, and the same
\c QTracer object can be registered with different categories.
If code containing \c qCTrace is executed, and the associated
logging category is enabled for tracing, all \c QTracer objects
that are registered with the category are notified.
\c QTracer objects
*/
/*!
\fn QTracer::QTracer()
Constructs a tracer object.
Example:
\snippet qtracer/ftracer.cpp 2
*/
/*!
\fn QTracer::~QTracer()
Destroys the tracer object.
*/
/*!
Registers this tracer for the \a category.
The tracer will later be notified of messages of type
\c QtTraceMsg, as long as that message type
is enabled in the category.
Example:
\snippet qtracer/ftracer.cpp 1
\codeline
\snippet qtracer/ftracer.cpp 7
*/
void QTracer::addToCategory(QLoggingCategory &category)
{
category.tracers.append(this);
}
/*!
\fn void QTracer::start()
This function is invoked when a tracing activity starts,
typically from the constructor of a \c QTraceGuard object
defined by \c qCTrace() or \c qCTraceGuard().
The base implementation does nothing. \c QTracer subclasses
are advised to override it if needed.
\sa qCTrace(), qCTraceGuard()
*/
/*!
\fn void QTracer::end()
This function is invoked when a tracing activity ends,
typically from the destructor of a \c QTraceGuard object
defined by \c qCTrace() or \c qCTraceGuard().
The base implementation does nothing. It is common for
\c QTracer subclasses to override it to perform flushing
of collected data.
\sa qCTrace(), qCTraceGuard()
*/
/*!
\fn void QTracer::record(int data)
This function is invoked during a tracing activity to
pass integer \a data to the \c QTracer object.
Example:
\snippet qtracer/ftracer.cpp 3
*/
/*!
\fn void QTracer::record(const char *data)
This function is invoked during a tracing activity to
pass string \a data to the \c QTracer object.
*/
/*!
\fn void QTracer::record(const QVariant &data)
This function is invoked during a tracing activity to
pass abitrary (non-integer, non-string) \a data to
the \c QTracer object.
*/
/*!
\class QTraceGuard
\since 5.2
\inmodule QtCore
\brief The QTraceGuard class facilitates notifications to
\c QTracer objects.
\c QTraceGuard objects are typically implicitly created on the
stack when using the \c qCTrace or \c qCTraceGuard macros and
are associated to a \c QLoggingCategory.
The constructor of a \c QTraceGuard objects checks whether
its associated category is enabled, and if so, informs all
\c QTracer objects registered with the category that a
tracing activity starts.
The destructor of a \c QTraceGuard objects checks whether
its associated category is enabled, and if so, informs all
\c QTracer objects registered with the category that a
tracing activity ended.
A \c QTraceGuard object created by \c qCTrace will be destroyed
at the end of the full expression, a guard created by
\c qCTraceGuard at the end of the block containing the macro.
During the lifetime of a QTraceGuard object, its \c operator<<()
can be used to pass additional data to the active tracers.
The fast path handles only \c int and \c{const char *} data,
but it is possible to use arbitrary values wrapped in \c QVariants.
\sa QTracer
*/
/*!
\fn QTraceGuard::QTraceGuard(QLoggingCategory &category)
\internal
Constructs a trace guard object relaying to \a category.
*/
/*!
\fn QTraceGuard::~QTraceGuard()
\internal
Destroys the trace guard object.
*/
/*!
\internal
Calls \c start() on all registered tracers.
*/
void QTraceGuard::start()
{
QLoggingCategory::Tracers &tracers = target->tracers;
for (int i = tracers.size(); --i >= 0; )
tracers.at(i)->start();
}
/*!
\internal
Calls \c end() on all registered tracers.
*/
void QTraceGuard::end()
{
QLoggingCategory::Tracers &tracers = target->tracers;
for (int i = tracers.size(); --i >= 0; )
tracers.at(i)->end();
}
/*!
\internal
This function is called for int parameters passed to the
qCTrace stream.
*/
QTraceGuard &QTraceGuard::operator<<(int msg)
{
QLoggingCategory::Tracers &tracers = target->tracers;
for (int i = tracers.size(); --i >= 0; )
tracers.at(i)->record(msg);
return *this;
}
/*!
\internal
This function is called for string parameters passed to the
qCTrace stream.
*/
QTraceGuard &QTraceGuard::operator<<(const char *msg)
{
QLoggingCategory::Tracers &tracers = target->tracers;
for (int i = tracers.size(); --i >= 0; )
tracers.at(i)->record(msg);
return *this;
}
/*!
\internal
This function is called for QVariant parameters passed to the
qCTrace stream.
*/
QTraceGuard &QTraceGuard::operator<<(const QVariant &msg)
{
QLoggingCategory::Tracers &tracers = target->tracers;
for (int i = tracers.size(); --i >= 0; )
tracers.at(i)->record(msg);
return *this;
}
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -44,9 +44,13 @@
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include <QtCore/qvector.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QTracer;
class QTraceGuard;
class Q_CORE_EXPORT QLoggingCategory class Q_CORE_EXPORT QLoggingCategory
{ {
Q_DISABLE_COPY(QLoggingCategory) Q_DISABLE_COPY(QLoggingCategory)
@ -76,13 +80,18 @@ public:
static void setFilterRules(const QString &rules); static void setFilterRules(const QString &rules);
private: private:
friend class QLoggingRegistry;
friend class QTraceGuard;
friend class QTracer;
const char *name; const char *name;
bool enabledDebug; bool enabledDebug;
bool enabledWarning; bool enabledWarning;
bool enabledCritical; bool enabledCritical;
bool enabledTrace;
friend class QLoggingRegistry; typedef QVector<QTracer *> Tracers;
Tracers tracers;
}; };
template <> template <>
@ -103,6 +112,56 @@ inline bool QLoggingCategory::isEnabled<QtCriticalMsg>() const
return enabledCritical; return enabledCritical;
} }
template <>
inline bool QLoggingCategory::isEnabled<QtTraceMsg>() const
{
return enabledTrace;
}
class Q_CORE_EXPORT QTracer
{
Q_DISABLE_COPY(QTracer)
public:
QTracer() {}
virtual ~QTracer() {}
void addToCategory(QLoggingCategory &category);
virtual void start() {}
virtual void end() {}
virtual void record(int) {}
virtual void record(const char *) {}
virtual void record(const QVariant &) {}
};
class Q_CORE_EXPORT QTraceGuard
{
Q_DISABLE_COPY(QTraceGuard)
public:
QTraceGuard(QLoggingCategory &category)
{
target = category.isEnabled<QtTraceMsg>() ? &category : 0;
if (target)
start();
}
~QTraceGuard()
{
if (target)
end();
}
QTraceGuard &operator<<(int msg);
QTraceGuard &operator<<(const char *msg);
QTraceGuard &operator<<(const QVariant &msg);
private:
void start();
void end();
QLoggingCategory *target;
};
#define Q_DECLARE_LOGGING_CATEGORY(name) \ #define Q_DECLARE_LOGGING_CATEGORY(name) \
extern QLoggingCategory &name(); extern QLoggingCategory &name();
@ -123,6 +182,17 @@ inline bool QLoggingCategory::isEnabled<QtCriticalMsg>() const
#define qCCritical(category) \ #define qCCritical(category) \
for (bool enabled = category().isEnabled<QtCriticalMsg>(); enabled; enabled = false) \ for (bool enabled = category().isEnabled<QtCriticalMsg>(); enabled; enabled = false) \
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical() QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical()
#define qCTrace(category) \
for (bool enabled = category.isEnabled<QtTraceMsg>(); enabled; enabled = false) \
QTraceGuard(category)
#define Q_TRACE_GUARD_NAME_HELPER(line) qTraceGuard ## line
#define Q_TRACE_GUARD_NAME(line) Q_TRACE_GUARD_NAME_HELPER(line)
#define qCTraceGuard(category) \
QTraceGuard Q_TRACE_GUARD_NAME(__LINE__)(category);
#if defined(QT_NO_DEBUG_OUTPUT) #if defined(QT_NO_DEBUG_OUTPUT)
# undef qCDebug # undef qCDebug

View File

@ -86,6 +86,9 @@ int QLoggingRule::pass(const QString &categoryName, QtMsgType msgType) const
case QtCriticalMsg: case QtCriticalMsg:
fullCategory += QLatin1String(".critical"); fullCategory += QLatin1String(".critical");
break; break;
case QtTraceMsg:
fullCategory += QLatin1String(".trace");
break;
default: default:
break; break;
} }
@ -288,6 +291,7 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
bool debug = (cat->categoryName() == qtDefaultCategoryName); bool debug = (cat->categoryName() == qtDefaultCategoryName);
bool warning = true; bool warning = true;
bool critical = true; bool critical = true;
bool trace = true;
QString categoryName = QLatin1String(cat->categoryName()); QString categoryName = QLatin1String(cat->categoryName());
QLoggingRegistry *reg = QLoggingRegistry::instance(); QLoggingRegistry *reg = QLoggingRegistry::instance();
@ -301,11 +305,15 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
filterpass = item.pass(categoryName, QtCriticalMsg); filterpass = item.pass(categoryName, QtCriticalMsg);
if (filterpass != 0) if (filterpass != 0)
critical = (filterpass > 0); critical = (filterpass > 0);
filterpass = item.pass(categoryName, QtTraceMsg);
if (filterpass != 0)
trace = (filterpass > 0);
} }
cat->setEnabled(QtDebugMsg, debug); cat->setEnabled(QtDebugMsg, debug);
cat->setEnabled(QtWarningMsg, warning); cat->setEnabled(QtWarningMsg, warning);
cat->setEnabled(QtCriticalMsg, critical); cat->setEnabled(QtCriticalMsg, critical);
cat->setEnabled(QtTraceMsg, trace);
} }

View File

@ -141,6 +141,7 @@ static void qt_sa_sigchld_sigaction(int signum, siginfo_t *info, void *context)
if (qt_sa_old_sigchld_handler.sa_flags & SA_SIGINFO) { if (qt_sa_old_sigchld_handler.sa_flags & SA_SIGINFO) {
void (*oldAction)(int, siginfo_t *, void *) = vsa->sa_sigaction; void (*oldAction)(int, siginfo_t *, void *) = vsa->sa_sigaction;
if (oldAction)
oldAction(signum, info, context); oldAction(signum, info, context);
} else { } else {
void (*oldAction)(int) = vsa->sa_handler; void (*oldAction)(int) = vsa->sa_handler;

View File

@ -61,6 +61,11 @@ struct NameprepCaseFoldingEntry {
ushort mapping[4]; ushort mapping[4];
}; };
#if defined(Q_CC_MSVC) && _MSC_VER < 1600
inline bool operator<(const NameprepCaseFoldingEntry &one, const NameprepCaseFoldingEntry &other)
{ return one.uc < other.uc; }
#endif
inline bool operator<(uint one, const NameprepCaseFoldingEntry &other) inline bool operator<(uint one, const NameprepCaseFoldingEntry &other)
{ return one < other.uc; } { return one < other.uc; }

View File

@ -150,15 +150,20 @@ QString QCoreApplicationPrivate::macMenuBarName()
#endif #endif
QString QCoreApplicationPrivate::appName() const QString QCoreApplicationPrivate::appName() const
{ {
static QString applName; static QBasicMutex applicationNameMutex;
QMutexLocker locker(&applicationNameMutex);
if (applicationName.isNull()) {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
applName = macMenuBarName(); applicationName = macMenuBarName();
#endif #endif
if (applName.isEmpty() && argv[0]) { if (applicationName.isEmpty() && argv[0]) {
char *p = strrchr(argv[0], '/'); char *p = strrchr(argv[0], '/');
applName = QString::fromLocal8Bit(p ? p + 1 : argv[0]); applicationName = QString::fromLocal8Bit(p ? p + 1 : argv[0]);
} }
return applName; }
return applicationName;
} }
#endif #endif

View File

@ -83,6 +83,7 @@ public:
~QCoreApplicationPrivate(); ~QCoreApplicationPrivate();
QString appName() const; QString appName() const;
mutable QString applicationName;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
static QString macMenuBarName(); static QString macMenuBarName();

View File

@ -70,16 +70,24 @@ static jclass getCachedClass(JNIEnv *env, const char *className)
QString key = QLatin1String(className); QString key = QLatin1String(className);
QHash<QString, jclass>::iterator it = cachedClasses->find(key); QHash<QString, jclass>::iterator it = cachedClasses->find(key);
if (it == cachedClasses->end()) { if (it == cachedClasses->end()) {
jclass c = env->FindClass(className); QJNIObjectPrivate classLoader = QtAndroidPrivate::classLoader();
if (!classLoader.isValid())
return 0;
QJNIObjectPrivate stringName = QJNIObjectPrivate::fromString(QLatin1String(className));
QJNIObjectPrivate classObject = classLoader.callObjectMethod("loadClass",
"(Ljava/lang/String;)Ljava/lang/Class;",
stringName.object());
if (env->ExceptionCheck()) { if (env->ExceptionCheck()) {
c = 0;
#ifdef QT_DEBUG #ifdef QT_DEBUG
env->ExceptionDescribe(); env->ExceptionDescribe();
#endif // QT_DEBUG #endif // QT_DEBUG
env->ExceptionClear(); env->ExceptionClear();
} }
if (c)
clazz = static_cast<jclass>(env->NewGlobalRef(c)); if (classObject.isValid())
clazz = static_cast<jclass>(env->NewGlobalRef(classObject.object()));
cachedClasses->insert(key, clazz); cachedClasses->insert(key, clazz);
} else { } else {
clazz = it.value(); clazz = it.value();
@ -160,11 +168,13 @@ QJNIEnvironmentPrivate::QJNIEnvironmentPrivate()
: jniEnv(0) : jniEnv(0)
{ {
JavaVM *vm = QtAndroidPrivate::javaVM(); JavaVM *vm = QtAndroidPrivate::javaVM();
if (vm->GetEnv((void**)&jniEnv, JNI_VERSION_1_6) != JNI_EDETACHED) if (vm->GetEnv((void**)&jniEnv, JNI_VERSION_1_6) == JNI_EDETACHED) {
return;
if (vm->AttachCurrentThread(&jniEnv, 0) < 0) if (vm->AttachCurrentThread(&jniEnv, 0) < 0)
return; return;
}
if (!jniEnv)
return;
if (!refCount->hasLocalData()) if (!refCount->hasLocalData())
refCount->setLocalData(1); refCount->setLocalData(1);

View File

@ -45,6 +45,7 @@ QT_BEGIN_NAMESPACE
static JavaVM *g_javaVM = Q_NULLPTR; static JavaVM *g_javaVM = Q_NULLPTR;
static jobject g_jActivity = Q_NULLPTR; static jobject g_jActivity = Q_NULLPTR;
static jobject g_jClassLoader = Q_NULLPTR;
static inline bool exceptionCheck(JNIEnv *env) static inline bool exceptionCheck(JNIEnv *env)
{ {
@ -79,6 +80,20 @@ jint QtAndroidPrivate::initJNI(JavaVM *vm, JNIEnv *env)
if (exceptionCheck(env)) if (exceptionCheck(env))
return JNI_ERR; return JNI_ERR;
jmethodID classLoaderMethodID = env->GetStaticMethodID(jQtNative,
"classLoader",
"()Ljava/lang/ClassLoader;");
if (exceptionCheck(env))
return JNI_ERR;
jobject classLoader = env->CallStaticObjectMethod(jQtNative, classLoaderMethodID);
if (exceptionCheck(env))
return JNI_ERR;
g_jClassLoader = env->NewGlobalRef(classLoader);
g_jActivity = env->NewGlobalRef(activity); g_jActivity = env->NewGlobalRef(activity);
g_javaVM = vm; g_javaVM = vm;
@ -96,4 +111,9 @@ JavaVM *QtAndroidPrivate::javaVM()
return g_javaVM; return g_javaVM;
} }
jobject QtAndroidPrivate::classLoader()
{
return g_jClassLoader;
}
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -63,6 +63,7 @@ namespace QtAndroidPrivate
Q_CORE_EXPORT jobject activity(); Q_CORE_EXPORT jobject activity();
Q_CORE_EXPORT JavaVM *javaVM(); Q_CORE_EXPORT JavaVM *javaVM();
Q_CORE_EXPORT jint initJNI(JavaVM *vm, JNIEnv *env); Q_CORE_EXPORT jint initJNI(JavaVM *vm, JNIEnv *env);
jobject classLoader();
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -91,7 +91,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
// Allocate additional space if array is growing // Allocate additional space if array is growing
if (options & Grow) if (options & Grow)
capacity = qAllocMore(objectSize * capacity, headerSize) / int(objectSize); capacity = qAllocMore(int(objectSize * capacity), int(headerSize)) / int(objectSize);
size_t allocSize = headerSize + objectSize * capacity; size_t allocSize = headerSize + objectSize * capacity;

View File

@ -166,6 +166,11 @@ static QString macTimeToString(const QTime &time, bool short_format)
return QCFString(CFDateFormatterCreateStringWithDate(0, myFormatter, myDate)); return QCFString(CFDateFormatterCreateStringWithDate(0, myFormatter, myDate));
} }
// Mac uses the Unicode CLDR format codes
// http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
// See also qtbase/util/local_database/dateconverter.py
// Makes the assumption that input formats are always well formed and consecutive letters
// never exceed the maximum for the format code.
static QString macToQtFormat(const QString &sys_fmt) static QString macToQtFormat(const QString &sys_fmt)
{ {
QString result; QString result;
@ -185,55 +190,97 @@ static QString macToQtFormat(const QString &sys_fmt)
int repeat = qt_repeatCount(sys_fmt, i); int repeat = qt_repeatCount(sys_fmt, i);
switch (c.unicode()) { switch (c.unicode()) {
case 'G': // Qt doesn't support these :( // Qt does not support the following options
case 'Y': case 'G': // Era (1..5): 4 = long, 1..3 = short, 5 = narrow
case 'D': case 'Y': // Year of Week (1..n): 1..n = padded number
case 'F': case 'U': // Cyclic Yar Name (1..5): 4 = long, 1..3 = short, 5 = narrow
case 'w': case 'Q': // Quarter (1..4): 4 = long, 3 = short, 1..2 = padded number
case 'W': case 'q': // Standalone Quarter (1..4): 4 = long, 3 = short, 1..2 = padded number
case 'g': case 'w': // Week of Year (1..2): 1..2 = padded number
case 'W': // Week of Month (1): 1 = number
case 'D': // Day of Year (1..3): 1..3 = padded number
case 'F': // Day of Week in Month (1): 1 = number
case 'g': // Modified Julian Day (1..n): 1..n = padded number
case 'A': // Milliseconds in Day (1..n): 1..n = padded number
break; break;
case 'u': // extended year - use 'y' case 'y': // Year (1..n): 2 = short year, 1 & 3..n = padded number
if (repeat < 4) case 'u': // Extended Year (1..n): 2 = short year, 1 & 3..n = padded number
// Qt only supports long (4) or short (2) year, use long for all others
if (repeat == 2)
result += QLatin1String("yy"); result += QLatin1String("yy");
else else
result += QLatin1String("yyyy"); result += QLatin1String("yyyy");
break; break;
case 'S': // fractional second case 'M': // Month (1..5): 4 = long, 3 = short, 1..2 = number, 5 = narrow
case 'L': // Standalone Month (1..5): 4 = long, 3 = short, 1..2 = number, 5 = narrow
// Qt only supports long, short and number, use short for narrow
if (repeat == 5)
result += QLatin1String("MMM");
else
result += QString(repeat, QLatin1Char('M'));
break;
case 'd': // Day of Month (1..2): 1..2 padded number
result += QString(repeat, c);
break;
case 'E': // Day of Week (1..6): 4 = long, 1..3 = short, 5..6 = narrow
// Qt only supports long, short and padded number, use short for narrow
if (repeat == 4)
result += QLatin1String("dddd");
else
result += QLatin1String("ddd");
break;
case 'e': // Local Day of Week (1..6): 4 = long, 3 = short, 5..6 = narrow, 1..2 padded number
case 'c': // Standalone Local Day of Week (1..6): 4 = long, 3 = short, 5..6 = narrow, 1..2 padded number
// Qt only supports long, short and padded number, use short for narrow
if (repeat >= 5)
result += QLatin1String("ddd");
else
result += QString(repeat, QLatin1Char('d'));
break;
case 'a': // AM/PM (1): 1 = short
// Translate to Qt uppercase AM/PM
result += QLatin1String("AP");
break;
case 'h': // Hour [1..12] (1..2): 1..2 = padded number
case 'K': // Hour [0..11] (1..2): 1..2 = padded number
case 'j': // Local Hour [12 or 24] (1..2): 1..2 = padded number
// Qt h is local hour
result += QString(repeat, QLatin1Char('h'));
break;
case 'H': // Hour [0..23] (1..2): 1..2 = padded number
case 'k': // Hour [1..24] (1..2): 1..2 = padded number
// Qt H is 0..23 hour
result += QString(repeat, QLatin1Char('H'));
break;
case 'm': // Minutes (1..2): 1..2 = padded number
case 's': // Seconds (1..2): 1..2 = padded number
result += QString(repeat, c);
break;
case 'S': // Fractional second (1..n): 1..n = tuncates to decimal places
// Qt uses msecs either unpadded or padded to 3 places
if (repeat < 3) if (repeat < 3)
result += QLatin1Char('z'); result += QLatin1Char('z');
else else
result += QLatin1String("zzz"); result += QLatin1String("zzz");
break; break;
case 'E': case 'z': // Time Zone (1..4)
if (repeat <= 3) case 'Z': // Time Zone (1..5)
result += QLatin1String("ddd"); case 'O': // Time Zone (1, 4)
else case 'v': // Time Zone (1, 4)
result += QLatin1String("dddd"); case 'V': // Time Zone (1..4)
break; case 'X': // Time Zone (1..5)
case 'e': case 'x': // Time Zone (1..5)
if (repeat >= 2)
result += QLatin1String("dd");
else
result += QLatin1Char('d');
break;
case 'a':
result += QLatin1String("AP");
break;
case 'k':
result += QString(repeat, QLatin1Char('H'));
break;
case 'K':
result += QString(repeat, QLatin1Char('h'));
break;
case 'z':
case 'Z':
case 'v':
result += QLatin1Char('t'); result += QLatin1Char('t');
break; break;
default: default:
// a..z and A..Z are reserved for format codes, so any occurrence of these not
// already processed are not known and so unsupported formats to be ignored.
// All other chars are allowed as literals.
if (c < QLatin1Char('A') || c > QLatin1Char('z') ||
(c > QLatin1Char('Z') && c < QLatin1Char('a'))) {
result += QString(repeat, c); result += QString(repeat, c);
}
break; break;
} }

View File

@ -3895,7 +3895,7 @@ static inline __m128i mergeQuestionMarks(__m128i chunk)
# else # else
// SSE has no compare instruction for unsigned comparison. // SSE has no compare instruction for unsigned comparison.
// The variables must be shiffted + 0x8000 to be compared // The variables must be shiffted + 0x8000 to be compared
const __m128i signedBitOffset = _mm_set1_epi16(0x8000); const __m128i signedBitOffset = _mm_set1_epi16(short(0x8000));
const __m128i thresholdMask = _mm_set1_epi16(short(0xff + 0x8000)); const __m128i thresholdMask = _mm_set1_epi16(short(0xff + 0x8000));
const __m128i signedChunk = _mm_add_epi16(chunk, signedBitOffset); const __m128i signedChunk = _mm_add_epi16(chunk, signedBitOffset);

View File

@ -934,8 +934,8 @@ inline QString::~QString() { if (!d->ref.deref()) Data::deallocate(d); }
inline void QString::reserve(int asize) inline void QString::reserve(int asize)
{ {
if (d->ref.isShared() || uint(asize) + 1u > d->alloc) if (d->ref.isShared() || uint(asize) >= d->alloc)
reallocData(uint(asize) + 1u); reallocData(qMax(asize, d->size) + 1u);
if (!d->capacityReserved) { if (!d->capacityReserved) {
// cannot set unconditionally, since d could be the shared_null/shared_empty (which is const) // cannot set unconditionally, since d could be the shared_null/shared_empty (which is const)

View File

@ -618,7 +618,7 @@ void QTzTimeZonePrivate::init(const QByteArray &olsenId)
// Offsets are stored as total offset, want to know separate UTC and DST offsets // Offsets are stored as total offset, want to know separate UTC and DST offsets
// so find the first non-dst transition to use as base UTC Offset // so find the first non-dst transition to use as base UTC Offset
int utcOffset; int utcOffset = 0;
foreach (const QTzTransition &tran, tranList) { foreach (const QTzTransition &tran, tranList) {
if (!typeList.at(tran.tz_typeind).tz_isdst) { if (!typeList.at(tran.tz_typeind).tz_isdst) {
utcOffset = typeList.at(tran.tz_typeind).tz_gmtoff; utcOffset = typeList.at(tran.tz_typeind).tz_gmtoff;

View File

@ -65,10 +65,10 @@ Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, con
} }
// Mask the 4 first colors of the RGB888 vector // Mask the 4 first colors of the RGB888 vector
const __m128i shuffleMask = _mm_set_epi8(0xff, 9, 10, 11, 0xff, 6, 7, 8, 0xff, 3, 4, 5, 0xff, 0, 1, 2); const __m128i shuffleMask = _mm_set_epi8(char(0xff), 9, 10, 11, char(0xff), 6, 7, 8, char(0xff), 3, 4, 5, char(0xff), 0, 1, 2);
// Mask the 4 last colors of a RGB888 vector with an offset of 1 (so the last 3 bytes are RGB) // Mask the 4 last colors of a RGB888 vector with an offset of 1 (so the last 3 bytes are RGB)
const __m128i shuffleMaskEnd = _mm_set_epi8(0xff, 13, 14, 15, 0xff, 10, 11, 12, 0xff, 7, 8, 9, 0xff, 4, 5, 6); const __m128i shuffleMaskEnd = _mm_set_epi8(char(0xff), 13, 14, 15, char(0xff), 10, 11, 12, char(0xff), 7, 8, 9, char(0xff), 4, 5, 6);
// Mask to have alpha = 0xff // Mask to have alpha = 0xff
const __m128i alphaMask = _mm_set1_epi32(0xff000000); const __m128i alphaMask = _mm_set1_epi32(0xff000000);

View File

@ -742,6 +742,11 @@ static const struct XPMRGBData {
{ QRGB(139,139, 0), "yellow4" }, { QRGB(139,139, 0), "yellow4" },
{ QRGB(154,205, 50), "yellowgreen" } }; { QRGB(154,205, 50), "yellowgreen" } };
#if defined(Q_CC_MSVC) && _MSC_VER < 1600
inline bool operator<(const XPMRGBData &data1, const XPMRGBData &data2)
{ return qstrcmp(data1.name, data2.name) < 0; }
#endif
inline bool operator<(const char *name, const XPMRGBData &data) inline bool operator<(const char *name, const XPMRGBData &data)
{ return qstrcmp(name, data.name) < 0; } { return qstrcmp(name, data.name) < 0; }
inline bool operator<(const XPMRGBData &data, const char *name) inline bool operator<(const XPMRGBData &data, const char *name)

View File

@ -89,12 +89,6 @@
#include <QDebug> #include <QDebug>
// ####TODO Properly #ifdef this class to use #define symbols actually defined
// by OpenGL/ES includes
#ifndef GL_FRAMEBUFFER_SRGB
#define GL_FRAMEBUFFER_SRGB 0x8DB9
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -1860,25 +1854,12 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
} }
} }
bool srgbFrameBufferEnabled = false;
if (funcs.hasOpenGLExtension(QOpenGLExtensions::SRGBFrameBuffer)) {
if (false)
{
glEnable(GL_FRAMEBUFFER_SRGB);
srgbFrameBufferEnabled = true;
}
}
#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
#else #else
glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data());
#endif #endif
if (srgbFrameBufferEnabled)
glDisable(GL_FRAMEBUFFER_SRGB);
} }
void QOpenGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, void QOpenGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,

View File

@ -289,6 +289,11 @@ static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
#undef rgb #undef rgb
#if defined(Q_CC_MSVC) && _MSC_VER < 1600
inline bool operator<(const RGBData &data1, const RGBData &data2)
{ return qstrcmp(data1.name, data2.name) < 0; }
#endif
inline bool operator<(const char *name, const RGBData &data) inline bool operator<(const char *name, const RGBData &data)
{ return qstrcmp(name, data.name) < 0; } { return qstrcmp(name, data.name) < 0; }
inline bool operator<(const RGBData &data, const char *name) inline bool operator<(const RGBData &data, const char *name)

View File

@ -103,7 +103,7 @@ inline static void blend_pixel(quint32 &dst, const quint32 src)
if (!minusOffsetToAlignSrcOn16Bytes) {\ if (!minusOffsetToAlignSrcOn16Bytes) {\
/* src is aligned, usual algorithm but with aligned operations.\ /* src is aligned, usual algorithm but with aligned operations.\
See the SSE2 version for more documentation on the algorithm itself. */\ See the SSE2 version for more documentation on the algorithm itself. */\
const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\ const __m128i alphaShuffleMask = _mm_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);\
for (; x < length-3; x += 4) { \ for (; x < length-3; x += 4) { \
const __m128i srcVector = _mm_load_si128((__m128i *)&src[x]); \ const __m128i srcVector = _mm_load_si128((__m128i *)&src[x]); \
const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \
@ -124,7 +124,7 @@ inline static void blend_pixel(quint32 &dst, const quint32 src)
__m128i srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\ __m128i srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\
const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\ const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\
\ \
const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\ const __m128i alphaShuffleMask = _mm_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);\
switch (palignrOffset) {\ switch (palignrOffset) {\
case 4:\ case 4:\
BLENDING_LOOP(4, length)\ BLENDING_LOOP(4, length)\

View File

@ -347,6 +347,13 @@ static const QCssKnownValue styleFeatures[NumKnownStyleFeatures - 1] = {
{ "none", StyleFeature_None } { "none", StyleFeature_None }
}; };
#if defined(Q_CC_MSVC) && _MSC_VER < 1600
Q_STATIC_GLOBAL_OPERATOR bool operator<(const QCssKnownValue &prop1, const QCssKnownValue &prop2)
{
return QString::compare(QString::fromLatin1(prop1.name), QLatin1String(prop2.name), Qt::CaseInsensitive) < 0;
}
#endif
Q_STATIC_GLOBAL_OPERATOR bool operator<(const QString &name, const QCssKnownValue &prop) Q_STATIC_GLOBAL_OPERATOR bool operator<(const QString &name, const QCssKnownValue &prop)
{ {
return QString::compare(name, QLatin1String(prop.name), Qt::CaseInsensitive) < 0; return QString::compare(name, QLatin1String(prop.name), Qt::CaseInsensitive) < 0;

View File

@ -125,6 +125,11 @@ struct AGLEntry {
unsigned short index; unsigned short index;
}; };
#if defined(Q_CC_MSVC) && _MSC_VER < 1600
inline bool operator<(AGLEntry entry1, AGLEntry entry2)
{ return entry1.uc < entry2.uc; }
#endif
inline bool operator<(unsigned short uc, AGLEntry entry) inline bool operator<(unsigned short uc, AGLEntry entry)
{ return uc < entry.uc; } { return uc < entry.uc; }
inline bool operator<(AGLEntry entry, unsigned short uc) inline bool operator<(AGLEntry entry, unsigned short uc)

View File

@ -324,6 +324,13 @@ static const struct QTextHtmlEntity { const char *name; quint16 code; } entities
{ "zwnj", 0x200c } { "zwnj", 0x200c }
}; };
#if defined(Q_CC_MSVC) && _MSC_VER < 1600
bool operator<(const QTextHtmlEntity &entity1, const QTextHtmlEntity &entity2)
{
return QLatin1String(entity1.name) < QLatin1String(entity2.name);
}
#endif
Q_STATIC_GLOBAL_OPERATOR bool operator<(const QString &entityStr, const QTextHtmlEntity &entity) Q_STATIC_GLOBAL_OPERATOR bool operator<(const QString &entityStr, const QTextHtmlEntity &entity)
{ {
return entityStr < QLatin1String(entity.name); return entityStr < QLatin1String(entity.name);
@ -443,6 +450,12 @@ static const QTextHtmlElement elements[Html_NumElements]= {
{ "var", Html_var, QTextHtmlElement::DisplayInline }, { "var", Html_var, QTextHtmlElement::DisplayInline },
}; };
#if defined(Q_CC_MSVC) && _MSC_VER < 1600
Q_STATIC_GLOBAL_OPERATOR bool operator<(const QTextHtmlElement &e1, const QTextHtmlElement &e2)
{
return QLatin1String(e1.name) < QLatin1String(e2.name);
}
#endif
Q_STATIC_GLOBAL_OPERATOR bool operator<(const QString &str, const QTextHtmlElement &e) Q_STATIC_GLOBAL_OPERATOR bool operator<(const QString &str, const QTextHtmlElement &e)
{ {

View File

@ -86,12 +86,6 @@
#include <QDebug> #include <QDebug>
// ####TODO Properly #ifdef this class to use #define symbols actually defined
// by OpenGL/ES includes
#ifndef GL_FRAMEBUFFER_SRGB
#define GL_FRAMEBUFFER_SRGB 0x8DB9
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -1868,18 +1862,12 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
} }
} }
bool srgbFrameBufferEnabled = false;
#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
#else #else
glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data());
#endif #endif
if (srgbFrameBufferEnabled)
glDisable(GL_FRAMEBUFFER_SRGB);
} }
void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,

View File

@ -254,16 +254,25 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
input_absinfo absInfo; input_absinfo absInfo;
memset(&absInfo, 0, sizeof(input_absinfo)); memset(&absInfo, 0, sizeof(input_absinfo));
if (ioctl(m_fd, EVIOCGABS(d->m_singleTouch ? ABS_X : ABS_MT_POSITION_X), &absInfo) >= 0) { bool has_x_range = false, has_y_range = false;
if (ioctl(m_fd, EVIOCGABS((d->m_singleTouch ? ABS_X : ABS_MT_POSITION_X)), &absInfo) >= 0) {
qDebug("min X: %d max X: %d", absInfo.minimum, absInfo.maximum); qDebug("min X: %d max X: %d", absInfo.minimum, absInfo.maximum);
d->hw_range_x_min = absInfo.minimum; d->hw_range_x_min = absInfo.minimum;
d->hw_range_x_max = absInfo.maximum; d->hw_range_x_max = absInfo.maximum;
has_x_range = true;
} }
if (ioctl(m_fd, EVIOCGABS(d->m_singleTouch ? ABS_Y : ABS_MT_POSITION_Y), &absInfo) >= 0) {
if (ioctl(m_fd, EVIOCGABS((d->m_singleTouch ? ABS_Y : ABS_MT_POSITION_Y)), &absInfo) >= 0) {
qDebug("min Y: %d max Y: %d", absInfo.minimum, absInfo.maximum); qDebug("min Y: %d max Y: %d", absInfo.minimum, absInfo.maximum);
d->hw_range_y_min = absInfo.minimum; d->hw_range_y_min = absInfo.minimum;
d->hw_range_y_max = absInfo.maximum; d->hw_range_y_max = absInfo.maximum;
has_y_range = true;
} }
if (!has_x_range || !has_y_range)
qWarning("evdevtouch: Invalid ABS limits, behavior unspecified");
if (ioctl(m_fd, EVIOCGABS(ABS_PRESSURE), &absInfo) >= 0) { if (ioctl(m_fd, EVIOCGABS(ABS_PRESSURE), &absInfo) >= 0) {
qDebug("min pressure: %d max pressure: %d", absInfo.minimum, absInfo.maximum); qDebug("min pressure: %d max pressure: %d", absInfo.minimum, absInfo.maximum);
if (absInfo.maximum > absInfo.minimum) { if (absInfo.maximum > absInfo.minimum) {
@ -271,6 +280,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
d->hw_pressure_max = absInfo.maximum; d->hw_pressure_max = absInfo.maximum;
} }
} }
char name[1024]; char name[1024];
if (ioctl(m_fd, EVIOCGNAME(sizeof(name) - 1), name) >= 0) { if (ioctl(m_fd, EVIOCGNAME(sizeof(name) - 1), name) >= 0) {
d->hw_name = QString::fromLocal8Bit(name); d->hw_name = QString::fromLocal8Bit(name);
@ -452,9 +462,6 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
} }
addTouchPoint(contact, &combinedStates); addTouchPoint(contact, &combinedStates);
if (contact.state == Qt::TouchPointReleased)
it.remove();
} }
// Now look for contacts that have disappeared since the last sync. // Now look for contacts that have disappeared since the last sync.
@ -469,6 +476,15 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
} }
} }
// Remove contacts that have just been reported as released.
it = m_contacts;
while (it.hasNext()) {
it.next();
Contact &contact(it.value());
if (contact.state == Qt::TouchPointReleased)
it.remove();
}
m_lastContacts = m_contacts; m_lastContacts = m_contacts;
if (!m_typeB && !m_singleTouch) if (!m_typeB && !m_singleTouch)
m_contacts.clear(); m_contacts.clear();

View File

@ -455,7 +455,7 @@ static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring para
env->ReleaseStringUTFChars(environmentString, nativeString); env->ReleaseStringUTFChars(environmentString, nativeString);
m_applicationParams=string.split('\t'); m_applicationParams=string.split('\t');
foreach (string, m_applicationParams) { foreach (string, m_applicationParams) {
if (putenv(string.constData())) if (!string.isEmpty() && putenv(string.constData()))
qWarning() << "Can't set environment" << string; qWarning() << "Can't set environment" << string;
} }

View File

@ -210,9 +210,10 @@ static void cleanupCocoaApplicationDelegate()
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{ {
// The reflection delegate gets precedence // The reflection delegate gets precedence
if (reflectionDelegate if (reflectionDelegate) {
&& [reflectionDelegate respondsToSelector:@selector(applicationShouldTerminate:)]) { if ([reflectionDelegate respondsToSelector:@selector(applicationShouldTerminate:)])
return [reflectionDelegate applicationShouldTerminate:sender]; return [reflectionDelegate applicationShouldTerminate:sender];
return NSTerminateNow;
} }
if ([self canQuit]) { if ([self canQuit]) {
@ -327,12 +328,11 @@ static void cleanupCocoaApplicationDelegate()
- (void)applicationDidBecomeActive:(NSNotification *)notification - (void)applicationDidBecomeActive:(NSNotification *)notification
{ {
Q_UNUSED(notification);
/*
if (reflectionDelegate if (reflectionDelegate
&& [reflectionDelegate respondsToSelector:@selector(applicationDidBecomeActive:)]) && [reflectionDelegate respondsToSelector:@selector(applicationDidBecomeActive:)])
[reflectionDelegate applicationDidBecomeActive:notification]; [reflectionDelegate applicationDidBecomeActive:notification];
/*
onApplicationChangedActivation(true); onApplicationChangedActivation(true);
if (!QWidget::mouseGrabber()){ if (!QWidget::mouseGrabber()){
@ -351,12 +351,11 @@ static void cleanupCocoaApplicationDelegate()
- (void)applicationDidResignActive:(NSNotification *)notification - (void)applicationDidResignActive:(NSNotification *)notification
{ {
Q_UNUSED(notification);
/*
if (reflectionDelegate if (reflectionDelegate
&& [reflectionDelegate respondsToSelector:@selector(applicationDidResignActive:)]) && [reflectionDelegate respondsToSelector:@selector(applicationDidResignActive:)])
[reflectionDelegate applicationDidResignActive:notification]; [reflectionDelegate applicationDidResignActive:notification];
/*
onApplicationChangedActivation(false); onApplicationChangedActivation(false);
if (!QWidget::mouseGrabber()) if (!QWidget::mouseGrabber())

View File

@ -77,6 +77,8 @@ QPaintDevice *QCocoaBackingStore::paintDevice()
? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
m_qImage = QImage(m_requestedSize * scaleFactor, format); m_qImage = QImage(m_requestedSize * scaleFactor, format);
m_qImage.setDevicePixelRatio(scaleFactor); m_qImage.setDevicePixelRatio(scaleFactor);
if (format == QImage::Format_ARGB32_Premultiplied)
m_qImage.fill(Qt::transparent);
} }
return &m_qImage; return &m_qImage;
} }

View File

@ -165,6 +165,7 @@ public:
bool currentExecIsNSAppRun; bool currentExecIsNSAppRun;
bool nsAppRunCalledByQt; bool nsAppRunCalledByQt;
bool cleanupModalSessionsNeeded; bool cleanupModalSessionsNeeded;
uint processEventsCalled;
NSModalSession currentModalSessionCached; NSModalSession currentModalSessionCached;
NSModalSession currentModalSession(); NSModalSession currentModalSession();
void updateChildrenWorksWhenModal(); void updateChildrenWorksWhenModal();

View File

@ -118,7 +118,7 @@ static Boolean runLoopSourceEqualCallback(const void *info1, const void *info2)
void QCocoaEventDispatcherPrivate::runLoopTimerCallback(CFRunLoopTimerRef, void *info) void QCocoaEventDispatcherPrivate::runLoopTimerCallback(CFRunLoopTimerRef, void *info)
{ {
QCocoaEventDispatcherPrivate *d = static_cast<QCocoaEventDispatcherPrivate *>(info); QCocoaEventDispatcherPrivate *d = static_cast<QCocoaEventDispatcherPrivate *>(info);
if ((d->processEventsFlags & QEventLoop::EventLoopExec) == 0) { if (d->processEventsCalled && (d->processEventsFlags & QEventLoop::EventLoopExec) == 0) {
// processEvents() was called "manually," ignore this source for now // processEvents() was called "manually," ignore this source for now
d->maybeCancelWaitForMoreEvents(); d->maybeCancelWaitForMoreEvents();
return; return;
@ -364,6 +364,12 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
uint oldflags = d->processEventsFlags; uint oldflags = d->processEventsFlags;
d->processEventsFlags = flags; d->processEventsFlags = flags;
// Used to determine whether any eventloop has been exec'ed, and allow posted
// and timer events to be processed even if this function has never been called
// instead of being kept on hold for the next run of processEvents().
++d->processEventsCalled;
bool excludeUserEvents = d->processEventsFlags & QEventLoop::ExcludeUserInputEvents; bool excludeUserEvents = d->processEventsFlags & QEventLoop::ExcludeUserInputEvents;
bool retVal = false; bool retVal = false;
forever { forever {
@ -517,6 +523,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
} }
d->processEventsFlags = oldflags; d->processEventsFlags = oldflags;
--d->processEventsCalled;
// If we're interrupted, we need to interrupt the _current_ // If we're interrupted, we need to interrupt the _current_
// recursion as well to check if it is still supposed to be // recursion as well to check if it is still supposed to be
@ -770,6 +777,7 @@ QCocoaEventDispatcherPrivate::QCocoaEventDispatcherPrivate()
currentExecIsNSAppRun(false), currentExecIsNSAppRun(false),
nsAppRunCalledByQt(false), nsAppRunCalledByQt(false),
cleanupModalSessionsNeeded(false), cleanupModalSessionsNeeded(false),
processEventsCalled(0),
currentModalSessionCached(0), currentModalSessionCached(0),
lastSerial(-1), lastSerial(-1),
interrupt(false) interrupt(false)
@ -893,7 +901,7 @@ void QCocoaEventDispatcherPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
void QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void *info) void QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void *info)
{ {
QCocoaEventDispatcherPrivate *d = static_cast<QCocoaEventDispatcherPrivate *>(info); QCocoaEventDispatcherPrivate *d = static_cast<QCocoaEventDispatcherPrivate *>(info);
if ((d->processEventsFlags & QEventLoop::EventLoopExec) == 0) { if (d->processEventsCalled && (d->processEventsFlags & QEventLoop::EventLoopExec) == 0) {
// processEvents() was called "manually," ignore this source for now // processEvents() was called "manually," ignore this source for now
d->maybeCancelWaitForMoreEvents(); d->maybeCancelWaitForMoreEvents();
return; return;

View File

@ -45,6 +45,7 @@
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformnativeinterface.h>
#include <QtGui/qpixmap.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -91,6 +92,11 @@ private:
Needed by the native print dialog in the Qt Print Support module. Needed by the native print dialog in the Qt Print Support module.
*/ */
Q_INVOKABLE void *NSPrintInfoForPrintEngine(QPrintEngine *printEngine); Q_INVOKABLE void *NSPrintInfoForPrintEngine(QPrintEngine *printEngine);
/*
Function to return the default background pixmap.
Needed by QWizard in the Qt widget module.
*/
Q_INVOKABLE QPixmap defaultBackgroundPixmapForQWizard();
// QMacPastebardMime support. The mac pasteboard void pointers are // QMacPastebardMime support. The mac pasteboard void pointers are
// QMacPastebardMime instances from the cocoa plugin or qtmacextras // QMacPastebardMime instances from the cocoa plugin or qtmacextras

View File

@ -50,6 +50,7 @@
#include <qbytearray.h> #include <qbytearray.h>
#include <qwindow.h> #include <qwindow.h>
#include <qpixmap.h>
#include <qpa/qplatformwindow.h> #include <qpa/qplatformwindow.h>
#include "qsurfaceformat.h" #include "qsurfaceformat.h"
#include <qpa/qplatformopenglcontext.h> #include <qpa/qplatformopenglcontext.h>
@ -133,7 +134,7 @@ void QCocoaNativeInterface::beep()
QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport() QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport()
{ {
#ifndef QT_NO_WIDGETS #if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER)
return new QCocoaPrinterSupport(); return new QCocoaPrinterSupport();
#else #else
qFatal("Printing is not supported when Qt is configured with -no-widgets"); qFatal("Printing is not supported when Qt is configured with -no-widgets");
@ -143,7 +144,7 @@ QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport()
void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine) void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine)
{ {
#ifndef QT_NO_WIDGETS #if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER)
QMacPrintEnginePrivate *macPrintEnginePriv = static_cast<QMacPrintEngine *>(printEngine)->d_func(); QMacPrintEnginePrivate *macPrintEnginePriv = static_cast<QMacPrintEngine *>(printEngine)->d_func();
if (macPrintEnginePriv->state == QPrinter::Idle && !macPrintEnginePriv->isPrintSessionInitialized()) if (macPrintEnginePriv->state == QPrinter::Idle && !macPrintEnginePriv->isPrintSessionInitialized())
macPrintEnginePriv->initialize(); macPrintEnginePriv->initialize();
@ -154,6 +155,31 @@ void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine
#endif #endif
} }
QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard()
{
QCFType<CFURLRef> url;
const int ExpectedImageWidth = 242;
const int ExpectedImageHeight = 414;
if (LSFindApplicationForInfo(kLSUnknownCreator, CFSTR("com.apple.KeyboardSetupAssistant"),
0, 0, &url) == noErr) {
QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url);
if (bundle) {
url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("png"), 0);
if (url) {
QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithURL(url, 0);
QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
if (image) {
int width = CGImageGetWidth(image);
int height = CGImageGetHeight(image);
if (width == ExpectedImageWidth && height == ExpectedImageHeight)
return QPixmap::fromImage(qt_mac_toQImage(image));
}
}
}
}
return QPixmap();
}
void QCocoaNativeInterface::onAppFocusWindowChanged(QWindow *window) void QCocoaNativeInterface::onAppFocusWindowChanged(QWindow *window)
{ {
Q_UNUSED(window); Q_UNUSED(window);

View File

@ -43,6 +43,7 @@
#define QCOCOAPRINTERSUPPORT_H #define QCOCOAPRINTERSUPPORT_H
#include <qpa/qplatformprintersupport.h> #include <qpa/qplatformprintersupport.h>
#ifndef QT_NO_PRINTER
#include "qt_mac_p.h" #include "qt_mac_p.h"
@ -64,4 +65,5 @@ private:
QPrinterInfo printerInfoFromPMPrinter(const PMPrinter &printer); QPrinterInfo printerInfoFromPMPrinter(const PMPrinter &printer);
}; };
#endif // QT_NO_PRINTER
#endif // QCOCOAPRINTERSUPPORT_H #endif // QCOCOAPRINTERSUPPORT_H

View File

@ -40,6 +40,8 @@
****************************************************************************/ ****************************************************************************/
#include "qcocoaprintersupport.h" #include "qcocoaprintersupport.h"
#ifndef QT_NO_PRINTER
#include "qprintengine_mac_p.h" #include "qprintengine_mac_p.h"
#include <QtPrintSupport/QPrinter> #include <QtPrintSupport/QPrinter>
@ -169,3 +171,5 @@ QList<QPair<QString, QSizeF> > QCocoaPrinterSupport::supportedSizesWithNames(con
PMRelease(printer); PMRelease(printer);
return returnValue; return returnValue;
} }
#endif //QT_NO_PRINTER

View File

@ -204,9 +204,9 @@ static QTouchDevice *touchDevice = 0;
selector:@selector(windowNotification:) selector:@selector(windowNotification:)
name:nil // Get all notifications name:nil // Get all notifications
object:newWindow]; object:newWindow];
} else {
[[NSNotificationCenter defaultCenter] removeObserver:self name:nil object:[self window]];
} }
if ([self window])
[[NSNotificationCenter defaultCenter] removeObserver:self name:nil object:[self window]];
} }
- (void)updateGeometry - (void)updateGeometry
{ {

View File

@ -117,8 +117,10 @@ static void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransfor
QMacCGContext::QMacCGContext(QPainter *p) QMacCGContext::QMacCGContext(QPainter *p)
{ {
QPaintEngine *pe = p->paintEngine(); QPaintEngine *pe = p->paintEngine();
#ifndef QT_NO_PRINTER
if (pe->type() == QPaintEngine::MacPrinter) if (pe->type() == QPaintEngine::MacPrinter)
pe = static_cast<QMacPrintEngine*>(pe)->paintEngine(); pe = static_cast<QMacPrintEngine*>(pe)->paintEngine();
#endif
pe->syncState(); pe->syncState();
context = 0; context = 0;
if (pe->type() == QPaintEngine::CoreGraphics) if (pe->type() == QPaintEngine::CoreGraphics)

View File

@ -168,11 +168,13 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
return translateMouseWheelEvent(window, hwnd, msg, result); return translateMouseWheelEvent(window, hwnd, msg, result);
#ifndef Q_OS_WINCE #ifndef Q_OS_WINCE
// Check for events synthesized from touch. Lower byte is touch index, 0 means pen.
static const bool passSynthesizedMouseEvents = QWindowsIntegration::instance()->options() & QWindowsIntegration::PassOsMouseEventsSynthesizedFromTouch; static const bool passSynthesizedMouseEvents = QWindowsIntegration::instance()->options() & QWindowsIntegration::PassOsMouseEventsSynthesizedFromTouch;
if (!passSynthesizedMouseEvents) { if (!passSynthesizedMouseEvents) {
// Check for events synthesized from touch. Lower 7 bits are touch/pen index, bit 8 indicates touch.
// However, when tablet support is active, extraInfo is a packet serial number. This is not a problem
// since we do not want to ignore mouse events coming from a tablet.
const quint64 extraInfo = GetMessageExtraInfo(); const quint64 extraInfo = GetMessageExtraInfo();
const bool fromTouch = (extraInfo & signatureMask) == miWpSignature && (extraInfo & 0xff); const bool fromTouch = (extraInfo & signatureMask) == miWpSignature && (extraInfo & 0x80);
if (fromTouch) if (fromTouch)
return false; return false;
} }

View File

@ -39,11 +39,12 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QT_NO_PRINTDIALOG
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
#include "qpagesetupdialog.h" #include "qpagesetupdialog.h"
#ifndef QT_NO_PRINTDIALOG
#include "qpagesetupdialog_p.h" #include "qpagesetupdialog_p.h"
#include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformnativeinterface.h>

View File

@ -39,8 +39,6 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QT_NO_PRINTDIALOG
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
#include "qprintdialog.h" #include "qprintdialog.h"
@ -52,6 +50,8 @@
#include <QtPrintSupport/qprinter.h> #include <QtPrintSupport/qprinter.h>
#include <QtPrintSupport/qprintengine.h> #include <QtPrintSupport/qprintengine.h>
#ifndef QT_NO_PRINTDIALOG
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QPrintDialogPrivate : public QAbstractPrintDialogPrivate class QPrintDialogPrivate : public QAbstractPrintDialogPrivate

View File

@ -1,31 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\externalpage http://www.cups.org/
\title Common Unix Printing System (CUPS)
*/

View File

@ -32,7 +32,3 @@
\externalpage http://blog.qt.digia.com/blog/2008/12/05/qtestlib-now-with-nice-graphs-pointing-upwards/ \externalpage http://blog.qt.digia.com/blog/2008/12/05/qtestlib-now-with-nice-graphs-pointing-upwards/
\title qtestlib-tools Announcement \title qtestlib-tools Announcement
*/ */
/*!
\externalpage http://qt.gitorious.org/qt-labs/qtestlib-tools
\title qtestlib-tools
*/

View File

@ -211,7 +211,7 @@ void QPlainTestLogger::outputMessage(const char *str)
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
OutputDebugStringA(str); OutputDebugStringA(str);
#elif defined(Q_OS_ANDROID) #elif defined(Q_OS_ANDROID)
__android_log_print(ANDROID_LOG_INFO, "QTestLib", str); __android_log_write(ANDROID_LOG_INFO, "QTestLib", str);
#endif #endif
outputString(str); outputString(str);
} }

View File

@ -1612,7 +1612,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
} }
} }
bool installedTestCoverage = installCoverageTool(QTestResult::currentAppname(), QTestResult::currentTestObjectName()); bool installedTestCoverage = installCoverageTool(QTestResult::currentAppName(), QTestResult::currentTestObjectName());
QTestLog::setInstalledTestCoverage(installedTestCoverage); QTestLog::setInstalledTestCoverage(installedTestCoverage);
// If no loggers were created by the long version of the -o command-line // If no loggers were created by the long version of the -o command-line
@ -2167,7 +2167,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
QTestResult::setCurrentTestObject(metaObject->className()); QTestResult::setCurrentTestObject(metaObject->className());
if (argc > 0) if (argc > 0)
QTestResult::setCurrentAppname(argv[0]); QTestResult::setCurrentAppName(argv[0]);
qtest_qParseArgs(argc, argv, false); qtest_qParseArgs(argc, argv, false);
@ -2520,6 +2520,14 @@ QTestData &QTest::newRow(const char *dataTag)
\sa QTest::newRow(), QFETCH(), QMetaType \sa QTest::newRow(), QFETCH(), QMetaType
*/ */
/*!
Returns the name of the binary that is currently executed.
*/
const char *QTest::currentAppName()
{
return QTestResult::currentAppName();
}
/*! /*!
Returns the name of the test function that is currently executed. Returns the name of the test function that is currently executed.

View File

@ -200,6 +200,8 @@ namespace QTest
Q_TESTLIB_EXPORT void *qElementData(const char *elementName, int metaTypeId); Q_TESTLIB_EXPORT void *qElementData(const char *elementName, int metaTypeId);
Q_TESTLIB_EXPORT QObject *testObject(); Q_TESTLIB_EXPORT QObject *testObject();
Q_TESTLIB_EXPORT const char *currentAppName();
Q_TESTLIB_EXPORT const char *currentTestFunction(); Q_TESTLIB_EXPORT const char *currentTestFunction();
Q_TESTLIB_EXPORT const char *currentDataTag(); Q_TESTLIB_EXPORT const char *currentDataTag();
Q_TESTLIB_EXPORT bool currentTestFailed(); Q_TESTLIB_EXPORT bool currentTestFailed();

View File

@ -257,6 +257,7 @@ namespace QTest {
} }
switch (type) { switch (type) {
case QtTraceMsg:
case QtDebugMsg: case QtDebugMsg:
QTest::TestLoggers::addMessage(QAbstractTestLogger::QDebug, msg); QTest::TestLoggers::addMessage(QAbstractTestLogger::QDebug, msg);
break; break;
@ -393,7 +394,7 @@ void QTestLog::stopLogging()
QTest::TestLoggers::stopLogging(); QTest::TestLoggers::stopLogging();
QTest::TestLoggers::destroyLoggers(); QTest::TestLoggers::destroyLoggers();
QTest::loggerUsingStdout = false; QTest::loggerUsingStdout = false;
saveCoverageTool(QTestResult::currentAppname(), failCount() != 0, QTestLog::installedTestCoverage()); saveCoverageTool(QTestResult::currentAppName(), failCount() != 0, QTestLog::installedTestCoverage());
} }
void QTestLog::addLogger(LogMode mode, const char *filename) void QTestLog::addLogger(LogMode mode, const char *filename)

View File

@ -63,7 +63,7 @@ namespace QTest
static const char *expectFailComment = 0; static const char *expectFailComment = 0;
static int expectFailMode = 0; static int expectFailMode = 0;
static const char *currentAppname = 0; static const char *currentAppName = 0;
} }
void QTestResult::reset() void QTestResult::reset()
@ -318,14 +318,14 @@ bool QTestResult::skipCurrentTest()
return QTest::skipCurrentTest; return QTest::skipCurrentTest;
} }
void QTestResult::setCurrentAppname(const char *appname) void QTestResult::setCurrentAppName(const char *appName)
{ {
QTest::currentAppname = appname; QTest::currentAppName = appName;
} }
const char *QTestResult::currentAppname() const char *QTestResult::currentAppName()
{ {
return QTest::currentAppname; return QTest::currentAppName;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -93,8 +93,8 @@ public:
static void setSkipCurrentTest(bool value); static void setSkipCurrentTest(bool value);
static bool skipCurrentTest(); static bool skipCurrentTest();
static void setCurrentAppname(const char *appname); static void setCurrentAppName(const char *appName);
static const char *currentAppname(); static const char *currentAppName();
private: private:
Q_DISABLE_COPY(QTestResult) Q_DISABLE_COPY(QTestResult)

View File

@ -40,7 +40,6 @@
****************************************************************************/ ****************************************************************************/
#include <rcc.h> #include <rcc.h>
#include "../../corelib/kernel/qcorecmdlineargs_p.h"
#include <qdebug.h> #include <qdebug.h>
#include <qdir.h> #include <qdir.h>

View File

@ -4,7 +4,6 @@ CONFIG += force_bootstrap
DEFINES += QT_RCC QT_NO_CAST_FROM_ASCII DEFINES += QT_RCC QT_NO_CAST_FROM_ASCII
include(rcc.pri) include(rcc.pri)
HEADERS += ../../corelib/kernel/qcorecmdlineargs_p.h
SOURCES += main.cpp SOURCES += main.cpp
load(qt_tool) load(qt_tool)

View File

@ -59,9 +59,10 @@
#include "qset.h" #include "qset.h"
#include "qstyle.h" #include "qstyle.h"
#include "qvarlengtharray.h" #include "qvarlengtharray.h"
#if defined(Q_WS_MAC) #if defined(Q_OS_MACX)
#include "private/qt_mac_p.h" #include <QtCore/QMetaMethod>
#include "qlibrary.h" #include <QtGui/QGuiApplication>
#include <qpa/qplatformnativeinterface.h>
#elif !defined(QT_NO_STYLE_WINDOWSVISTA) #elif !defined(QT_NO_STYLE_WINDOWSVISTA)
#include "qwizard_win_p.h" #include "qwizard_win_p.h"
#include "qtimer.h" #include "qtimer.h"
@ -604,7 +605,7 @@ public:
void _q_updateButtonStates(); void _q_updateButtonStates();
void _q_handleFieldObjectDestroyed(QObject *); void _q_handleFieldObjectDestroyed(QObject *);
void setStyle(QStyle *style); void setStyle(QStyle *style);
#ifdef Q_WS_MAC #ifdef Q_OS_MACX
static QPixmap findDefaultBackgroundPixmap(); static QPixmap findDefaultBackgroundPixmap();
#endif #endif
@ -1368,7 +1369,7 @@ bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const
} }
break; break;
} }
#ifdef Q_WS_MAC #ifdef Q_OS_MACX
pushButton->setAutoDefault(false); pushButton->setAutoDefault(false);
#endif #endif
pushButton->hide(); pushButton->hide();
@ -1706,32 +1707,22 @@ void QWizardPrivate::setStyle(QStyle *style)
it.value()->setStyle(style); it.value()->setStyle(style);
} }
#ifdef Q_WS_MAC #ifdef Q_OS_MACX
QPixmap QWizardPrivate::findDefaultBackgroundPixmap() QPixmap QWizardPrivate::findDefaultBackgroundPixmap()
{ {
QCFType<CFURLRef> url; QGuiApplication *app = qobject_cast<QGuiApplication *>(QCoreApplication::instance());
const int ExpectedImageWidth = 242; if (!app)
const int ExpectedImageHeight = 414;
if (LSFindApplicationForInfo(kLSUnknownCreator, CFSTR("com.apple.KeyboardSetupAssistant"),
0, 0, &url) == noErr) {
QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url);
if (bundle) {
url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("tif"), 0);
if (url) {
QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithURL(url, 0);
QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
if (image) {
int width = CGImageGetWidth(image);
int height = CGImageGetHeight(image);
if (width == ExpectedImageWidth && height == ExpectedImageHeight)
return QPixmap::fromMacCGImageRef(image);
}
}
}
}
return QPixmap(); return QPixmap();
QPlatformNativeInterface *platformNativeInterface = app->platformNativeInterface();
int at = platformNativeInterface->metaObject()->indexOfMethod("defaultBackgroundPixmapForQWizard()");
if (at == -1)
return QPixmap();
QMetaMethod defaultBackgroundPixmapForQWizard = platformNativeInterface->metaObject()->method(at);
QPixmap result;
if (!defaultBackgroundPixmapForQWizard.invoke(platformNativeInterface, Q_RETURN_ARG(QPixmap, result)))
return QPixmap();
return result;
} }
#endif #endif
@ -2842,7 +2833,7 @@ QPixmap QWizard::pixmap(WizardPixmap which) const
{ {
Q_D(const QWizard); Q_D(const QWizard);
Q_ASSERT(uint(which) < NPixmaps); Q_ASSERT(uint(which) < NPixmaps);
#ifdef Q_WS_MAC #ifdef Q_OS_MACX
if (which == BackgroundPixmap && d->defaultPixmaps[BackgroundPixmap].isNull()) if (which == BackgroundPixmap && d->defaultPixmaps[BackgroundPixmap].isNull())
d->defaultPixmaps[BackgroundPixmap] = d->findDefaultBackgroundPixmap(); d->defaultPixmaps[BackgroundPixmap] = d->findDefaultBackgroundPixmap();
#endif #endif

View File

@ -59,7 +59,7 @@ void QKeySequenceEditPrivate::init()
prevKey = -1; prevKey = -1;
releaseTimer = 0; releaseTimer = 0;
layout = new QVBoxLayout(q); QVBoxLayout *layout = new QVBoxLayout(q);
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(lineEdit); layout->addWidget(lineEdit);

View File

@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_KEYSEQUENCEEDIT #ifndef QT_NO_KEYSEQUENCEEDIT
class QLineEdit; class QLineEdit;
class QVBoxLayout;
class QKeySequenceEditPrivate : public QWidgetPrivate class QKeySequenceEditPrivate : public QWidgetPrivate
{ {
@ -66,7 +65,6 @@ public:
void finishEditing(); void finishEditing();
QLineEdit *lineEdit; QLineEdit *lineEdit;
QVBoxLayout *layout;
QKeySequence keySequence; QKeySequence keySequence;
int keyNum; int keyNum;
int key[MaxKeyCount]; int key[MaxKeyCount];

View File

@ -127,6 +127,7 @@ QMacNativeWidget::QMacNativeWidget(NSView *parentView)
setPalette(QPalette(Qt::transparent)); setPalette(QPalette(Qt::transparent));
setAttribute(Qt::WA_SetPalette, false); setAttribute(Qt::WA_SetPalette, false);
setAttribute(Qt::WA_LayoutUsesWidgetRect); setAttribute(Qt::WA_LayoutUsesWidgetRect);
setAttribute(Qt::WA_TranslucentBackground);
} }
/*! /*!

View File

@ -324,7 +324,7 @@ void tst_QGlobal::qCoreAppStartupFunction()
{ {
QCOMPARE(qStartupFunctionValue, 0); QCOMPARE(qStartupFunctionValue, 0);
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qglobal") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
QCOMPARE(qStartupFunctionValue, 124); QCOMPARE(qStartupFunctionValue, 124);
} }

View File

@ -70,8 +70,7 @@ void tst_QProcessNoApplication::initializationDeadlock()
} }
}; };
static char argv0[] = "tst_QProcessNoApplication"; char *argv[] = { const_cast<char*>(QTest::currentAppName()), 0 };
char *argv[] = { argv0, 0 };
int argc = 1; int argc = 1;
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
MyThread thread; MyThread thread;

View File

@ -88,7 +88,7 @@ public:
void tst_QCoreApplication::sendEventsOnProcessEvents() void tst_QCoreApplication::sendEventsOnProcessEvents()
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
EventSpy spy; EventSpy spy;
@ -110,7 +110,7 @@ void tst_QCoreApplication::getSetCheck()
// Test the property // Test the property
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
QCOMPARE(app.property("applicationVersion").toString(), v); QCOMPARE(app.property("applicationVersion").toString(), v);
} }
@ -135,7 +135,7 @@ void tst_QCoreApplication::argc()
{ {
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
QCOMPARE(argc, 1); QCOMPARE(argc, 1);
QCOMPARE(app.arguments().count(), 1); QCOMPARE(app.arguments().count(), 1);
@ -143,7 +143,7 @@ void tst_QCoreApplication::argc()
{ {
int argc = 4; int argc = 4;
char *argv[] = { const_cast<char*>("tst_qcoreapplication"), char *argv[] = { const_cast<char*>(QTest::currentAppName()),
const_cast<char*>("arg1"), const_cast<char*>("arg1"),
const_cast<char*>("arg2"), const_cast<char*>("arg2"),
const_cast<char*>("arg3") }; const_cast<char*>("arg3") };
@ -162,7 +162,7 @@ void tst_QCoreApplication::argc()
{ {
int argc = 2; int argc = 2;
char *argv[] = { const_cast<char*>("tst_qcoreapplication"), char *argv[] = { const_cast<char*>(QTest::currentAppName()),
const_cast<char*>("-qmljsdebugger=port:3768,block") }; const_cast<char*>("-qmljsdebugger=port:3768,block") };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
QCOMPARE(argc, 1); QCOMPARE(argc, 1);
@ -196,7 +196,7 @@ public:
void tst_QCoreApplication::postEvent() void tst_QCoreApplication::postEvent()
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
EventSpy spy; EventSpy spy;
@ -281,7 +281,7 @@ void tst_QCoreApplication::postEvent()
void tst_QCoreApplication::removePostedEvents() void tst_QCoreApplication::removePostedEvents()
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
EventSpy spy; EventSpy spy;
@ -460,7 +460,7 @@ public:
void tst_QCoreApplication::deliverInDefinedOrder() void tst_QCoreApplication::deliverInDefinedOrder()
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
DeliverInDefinedOrderObject obj(&app); DeliverInDefinedOrderObject obj(&app);
@ -500,7 +500,7 @@ public:
void tst_QCoreApplication::globalPostedEventsCount() void tst_QCoreApplication::globalPostedEventsCount()
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
QCoreApplication::sendPostedEvents(); QCoreApplication::sendPostedEvents();
@ -546,7 +546,7 @@ public:
void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents() void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents()
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
ProcessEventsAlwaysSendsPostedEventsObject object; ProcessEventsAlwaysSendsPostedEventsObject object;
@ -564,7 +564,7 @@ void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents()
void tst_QCoreApplication::reexec() void tst_QCoreApplication::reexec()
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
// exec once // exec once
@ -579,7 +579,7 @@ void tst_QCoreApplication::reexec()
void tst_QCoreApplication::execAfterExit() void tst_QCoreApplication::execAfterExit()
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
app.exit(1); app.exit(1);
@ -590,7 +590,7 @@ void tst_QCoreApplication::execAfterExit()
void tst_QCoreApplication::eventLoopExecAfterExit() void tst_QCoreApplication::eventLoopExecAfterExit()
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
// exec once and exit // exec once and exit
@ -648,7 +648,7 @@ void tst_QCoreApplication::customEventDispatcher()
QVERIFY(!weak_ed.isNull()); QVERIFY(!weak_ed.isNull());
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
// instantiating app should not overwrite the ED // instantiating app should not overwrite the ED
QCOMPARE(QCoreApplication::eventDispatcher(), ed); QCOMPARE(QCoreApplication::eventDispatcher(), ed);
@ -763,7 +763,7 @@ private slots:
void tst_QCoreApplication::testQuitLock() void tst_QCoreApplication::testQuitLock()
{ {
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
QuitTester tester; QuitTester tester;
@ -782,7 +782,7 @@ void tst_QCoreApplication::QTBUG31606_QEventDestructorDeadLock()
}; };
int argc = 1; int argc = 1;
char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv); QCoreApplication app(argc, argv);
EventSpy spy; EventSpy spy;

View File

@ -48,6 +48,9 @@ class tst_QCommandLineParser : public QObject
{ {
Q_OBJECT Q_OBJECT
public slots:
void initTestCase();
private slots: private slots:
void parsingModes_data(); void parsingModes_data();
@ -81,9 +84,15 @@ private slots:
void testQuoteEscaping(); void testQuoteEscaping();
}; };
static char *empty_argv[] = { const_cast<char*>("tst_qcommandlineparser") }; static char *empty_argv[] = { 0 };
static int empty_argc = 1; static int empty_argc = 1;
void tst_QCommandLineParser::initTestCase()
{
Q_ASSERT(!empty_argv[0]);
empty_argv[0] = const_cast<char*>(QTest::currentAppName());
}
Q_DECLARE_METATYPE(QCommandLineParser::SingleDashWordOptionMode) Q_DECLARE_METATYPE(QCommandLineParser::SingleDashWordOptionMode)
void tst_QCommandLineParser::parsingModes_data() void tst_QCommandLineParser::parsingModes_data()

View File

@ -1407,9 +1407,6 @@ void tst_QLocale::macDefaultLocale()
QCOMPARE(locale.decimalPoint(), QChar('.')); QCOMPARE(locale.decimalPoint(), QChar('.'));
QCOMPARE(locale.groupSeparator(), QChar(',')); QCOMPARE(locale.groupSeparator(), QChar(','));
QCOMPARE(locale.dateFormat(QLocale::ShortFormat), QString("M/d/yy")); QCOMPARE(locale.dateFormat(QLocale::ShortFormat), QString("M/d/yy"));
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_6)
QCOMPARE(locale.dateFormat(QLocale::LongFormat), QString("MMMM d, y"));
else
QCOMPARE(locale.dateFormat(QLocale::LongFormat), QString("MMMM d, yyyy")); QCOMPARE(locale.dateFormat(QLocale::LongFormat), QString("MMMM d, yyyy"));
QCOMPARE(locale.timeFormat(QLocale::ShortFormat), QString("h:mm AP")); QCOMPARE(locale.timeFormat(QLocale::ShortFormat), QString("h:mm AP"));
QCOMPARE(locale.timeFormat(QLocale::LongFormat), QString("h:mm:ss AP t")); QCOMPARE(locale.timeFormat(QLocale::LongFormat), QString("h:mm:ss AP t"));

View File

@ -5240,6 +5240,18 @@ void tst_QString::resizeAfterReserve()
s += "hello world"; s += "hello world";
s.resize(0); s.resize(0);
QVERIFY(s.capacity() == 100); QVERIFY(s.capacity() == 100);
// reserve() can't be used to truncate data
s.fill('x', 100);
s.reserve(50);
QVERIFY(s.capacity() == 100);
QVERIFY(s.size() == 100);
// even with increased ref count truncation isn't allowed
QString t = s;
s.reserve(50);
QVERIFY(s.capacity() == 100);
QVERIFY(s.size() == 100);
} }
void tst_QString::resizeWithNegative() const void tst_QString::resizeWithNegative() const

View File

@ -768,7 +768,7 @@ void tst_QGuiApplication::genericPluginsAndWindowSystemEvents()
testPluginInfo.rawMetaData = qt_plugin_query_metadata; testPluginInfo.rawMetaData = qt_plugin_query_metadata;
qRegisterStaticPluginFunction(testPluginInfo); qRegisterStaticPluginFunction(testPluginInfo);
int argc = 3; int argc = 3;
char *argv[] = { const_cast<char*>("tst_qguiapplication"), const_cast<char*>("-plugin"), const_cast<char*>("testplugin") }; char *argv[] = { const_cast<char*>(QTest::currentAppName()), const_cast<char*>("-plugin"), const_cast<char*>("testplugin") };
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
QVERIFY(QGuiApplication::primaryScreen()); QVERIFY(QGuiApplication::primaryScreen());

View File

@ -1416,6 +1416,7 @@ void tst_QNetworkReply::initTestCase()
void tst_QNetworkReply::cleanupTestCase() void tst_QNetworkReply::cleanupTestCase()
{ {
#if !defined Q_OS_WIN #if !defined Q_OS_WIN
if (!wronlyFileName.isNull())
QFile::remove(wronlyFileName); QFile::remove(wronlyFileName);
#endif #endif
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT

View File

@ -114,8 +114,8 @@ void tst_QSql::cleanup()
void tst_QSql::basicDriverTest() void tst_QSql::basicDriverTest()
{ {
int argc = 1; int argc = 1;
const char *argv[] = {"test"}; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QGuiApplication app(argc, const_cast<char **>(argv), false); QGuiApplication app(argc, argv, false);
tst_Databases dbs; tst_Databases dbs;
dbs.open(); dbs.open();
@ -155,10 +155,10 @@ void tst_QSql::open()
{ {
int i; int i;
int argc = 1; int argc = 1;
const char *argv[] = {"test"}; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
int count = -1; int count = -1;
for (i = 0; i < 10; ++i) { for (i = 0; i < 10; ++i) {
QGuiApplication app(argc, const_cast<char **>(argv), false); QGuiApplication app(argc, argv, false);
tst_Databases dbs; tst_Databases dbs;
dbs.open(); dbs.open();
@ -184,8 +184,8 @@ void tst_QSql::openInvalid()
void tst_QSql::concurrentAccess() void tst_QSql::concurrentAccess()
{ {
int argc = 1; int argc = 1;
const char *argv[] = {"test"}; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QGuiApplication app(argc, const_cast<char **>(argv), false); QGuiApplication app(argc, argv, false);
tst_Databases dbs; tst_Databases dbs;
dbs.open(); dbs.open();
@ -213,8 +213,8 @@ void tst_QSql::concurrentAccess()
void tst_QSql::openErrorRecovery() void tst_QSql::openErrorRecovery()
{ {
int argc = 1; int argc = 1;
const char *argv[] = {"test"}; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QGuiApplication app(argc, const_cast<char **>(argv), false); QGuiApplication app(argc, argv, false);
tst_Databases dbs; tst_Databases dbs;
dbs.addDbs(); dbs.addDbs();
@ -261,8 +261,8 @@ void tst_QSql::openErrorRecovery()
void tst_QSql::registerSqlDriver() void tst_QSql::registerSqlDriver()
{ {
int argc = 1; int argc = 1;
const char *argv[] = {"test"}; char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QGuiApplication app(argc, const_cast<char **>(argv), false); QGuiApplication app(argc, argv, false);
QSqlDatabase::registerSqlDriver("QSQLTESTDRIVER", new QSqlDriverCreator<QSqlNullDriver>); QSqlDatabase::registerSqlDriver("QSQLTESTDRIVER", new QSqlDriverCreator<QSqlNullDriver>);
QVERIFY(QSqlDatabase::drivers().contains("QSQLTESTDRIVER")); QVERIFY(QSqlDatabase::drivers().contains("QSQLTESTDRIVER"));

View File

@ -439,14 +439,8 @@ void tst_QWizard::setPixmap()
QVERIFY(wizard.pixmap(QWizard::BannerPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::BannerPixmap).isNull());
QVERIFY(wizard.pixmap(QWizard::LogoPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::LogoPixmap).isNull());
QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).isNull());
#ifdef Q_OS_MAC #ifdef Q_OS_MACX
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_3) {
QEXPECT_FAIL("", "QTBUG-23701", Continue);
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull() == false); QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull() == false);
} else {
// fall through since the image doesn't exist on a 10.3 system.
QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull());
}
#else #else
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull());
#endif #endif
@ -454,14 +448,8 @@ void tst_QWizard::setPixmap()
QVERIFY(page->pixmap(QWizard::BannerPixmap).isNull()); QVERIFY(page->pixmap(QWizard::BannerPixmap).isNull());
QVERIFY(page->pixmap(QWizard::LogoPixmap).isNull()); QVERIFY(page->pixmap(QWizard::LogoPixmap).isNull());
QVERIFY(page->pixmap(QWizard::WatermarkPixmap).isNull()); QVERIFY(page->pixmap(QWizard::WatermarkPixmap).isNull());
#ifdef Q_OS_MAC #ifdef Q_OS_MACX
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_3) {
QEXPECT_FAIL("", "QTBUG-23701", Continue);
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull() == false); QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull() == false);
} else {
// fall through since the image doesn't exist on a 10.3 system.
QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull());
}
#else #else
QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull()); QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull());
#endif #endif

View File

@ -1543,7 +1543,7 @@ void Configure::desc(const char *option, const char *description, bool skipInden
if (!skipIndent) if (!skipIndent)
printf("%*s", optionIndent, ""); printf("%*s", optionIndent, "");
int remaining = descIndent - optionIndent - strlen(option); int remaining = descIndent - optionIndent - int(strlen(option));
int wrapIndent = descIndent + qMax(0, 1 - remaining); int wrapIndent = descIndent + qMax(0, 1 - remaining);
printf("%s", option); printf("%s", option);

View File

@ -347,7 +347,7 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv
if (envStrings) { if (envStrings) {
int strLen = 0; int strLen = 0;
for (LPWSTR envString = envStrings; *(envString); envString += strLen + 1) { for (LPWSTR envString = envStrings; *(envString); envString += strLen + 1) {
strLen = wcslen(envString); strLen = int(wcslen(envString));
QString str = QString((const QChar*)envString, strLen); QString str = QString((const QChar*)envString, strLen);
if (!str.startsWith("=")) { // These are added by the system if (!str.startsWith("=")) { // These are added by the system
int sepIndex = str.indexOf('='); int sepIndex = str.indexOf('=');