Merge remote-tracking branch 'origin/master' into api_changes

Conflicts:
	configure
	src/widgets/styles/qwindowsxpstyle.cpp
	tests/auto/gui/kernel/qwindow/qwindow.pro
	tests/auto/gui/kernel/qwindow/tst_qwindow.cpp

Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
This commit is contained in:
Oswald Buddenhagen 2012-04-10 12:48:01 +02:00
commit 143c4d3e13
364 changed files with 8166 additions and 10660 deletions

View File

@ -1,3 +1,3 @@
SOURCES = iconv.cpp
CONFIG -= qt dylib app_bundle
mac|win32-g++*|qnx-*-qcc:LIBS += -liconv
mac|win32-g++*|qnx:LIBS += -liconv

1551
configure vendored

File diff suppressed because it is too large Load Diff

7
dist/changes-5.0.0 vendored
View File

@ -246,7 +246,7 @@ information about a particular change.
- QSystemLocale has been removed from the public API.
- QSqlQueryModel::indexInQuery() is now virtual. See note below under QSql.
- QSqlQueryModel::indexInQuery() is now virtual. See note below under QtSql.
- QSqlDriver::subscribeToNotification, unsubscribeFromNotification,
subscribedToNotifications, isIdentifierEscaped, and stripDelimiters
@ -506,6 +506,11 @@ now that QSqlDriver subclasses can reimplement these directly.
* Database Drivers *
****************************************************************************
sqlite
------
* QVariant::Bool type now mapped to integers 0/1 in SQL instead of strings
'true' and 'false'. Sqlite does not have a boolean column type and it is
customary to use integer. QTBUG-23895
****************************************************************************
* Platform Specific Changes *

View File

@ -52,7 +52,7 @@ Receiver::Receiver(QWidget *parent)
quitButton = new QPushButton(tr("&Quit"));
udpSocket = new QUdpSocket(this);
udpSocket->bind(45454, QUdpSocket::ShareAddress);
udpSocket->bind(QHostAddress::AnyIPv4, 45454, QUdpSocket::ShareAddress);
udpSocket->joinMulticastGroup(groupAddress);
connect(udpSocket, SIGNAL(readyRead()),

View File

@ -1,5 +1,5 @@
get_filename_component(_qt5_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
set(Qt5$${CMAKE_MODULE_NAME}_VERSION_MAJOR "$$eval(QT.$${MODULE}.MAJOR_VERSION)")
set(Qt5$${CMAKE_MODULE_NAME}_VERSION_MINOR "$$eval(QT.$${MODULE}.MINOR_VERSION)")
@ -8,7 +8,7 @@ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_PATCH "$$eval(QT.$${MODULE}.PATCH_VERSION)"
set(Qt5$${CMAKE_MODULE_NAME}_LIBRARIES Qt5::$${CMAKE_MODULE_NAME})
!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${_qt5_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5_install_prefix}/$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\")
set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\")
!!ELSE
set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\" \"$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\")
!!ENDIF
@ -35,6 +35,8 @@ if (Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
endif()
set(Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES "$${CMAKE_QT5_MODULE_DEPS}")
!!IF !isEmpty(CMAKE_STATIC_TYPE)
# For static builds, we also list the dependencies of
# Qt so that consumers can build.
@ -84,8 +86,6 @@ list(APPEND Qt5Gui_LIB_DEPENDENCIES ${JPEG_LIBRARIES})
!!ENDIF # Static
list(APPEND Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES "$${CMAKE_QT5_MODULE_DEPS}")
if (NOT _Qt5$${CMAKE_MODULE_NAME}_target)
set(_Qt5$${CMAKE_MODULE_NAME}_target 1)
!!IF !isEmpty(CMAKE_STATIC_TYPE)
@ -98,29 +98,29 @@ if (NOT _Qt5$${CMAKE_MODULE_NAME}_target)
!!ENDIF
endif()
!!IF !isEmpty(debug_type)
!!IF !isEmpty(CMAKE_DEBUG_TYPE)
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG \"${Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
IMPORTED_LOCATION_DEBUG \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
IMPORTED_LOCATION_DEBUG \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
!!ELSE
IMPORTED_LOCATION_DEBUG \"$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
!!ENDIF
)
!!IF !isEmpty(CMAKE_IMPLIB_FILE_LOCATION_DEBUG)
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
IMPORTED_IMPLIB_DEBUG \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\"
IMPORTED_IMPLIB_DEBUG \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\"
)
!!ENDIF
!!ENDIF
!!IF !isEmpty(release_type)
!!IF !isEmpty(CMAKE_RELEASE_TYPE)
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE \"${Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
IMPORTED_LOCATION_RELEASE \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
IMPORTED_LOCATION_RELEASE \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
!!ELSE
IMPORTED_LOCATION_RELEASE \"$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
!!ENDIF
@ -128,7 +128,7 @@ set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
!!IF !isEmpty(CMAKE_IMPLIB_FILE_LOCATION_RELEASE)
set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
IMPORTED_IMPLIB_RELEASE \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\"
IMPORTED_IMPLIB_RELEASE \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\"
!!ELSE
IMPORTED_IMPLIB_RELEASE \"$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\"
!!ENDIF

View File

@ -4,6 +4,8 @@
include(qcc-base.conf)
CONFIG += qnx
QMAKE_LFLAGS_SHLIB += -shared
QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB
QMAKE_LFLAGS_SONAME += -Wl,-soname,

View File

@ -3,11 +3,14 @@
#
# - The QNX qcc compiler
#
# The only difference between this and gcc-base.conf is that -pipe is removed
# as it's on by default in qcc (and has an analogous -nopipe option)
# The differences between this and gcc-base.conf are that
#
# 1) -pipe is removed as it's on by default in qcc (and has an analogous -nopipe option)
# 2) -Wno-psabi is added to silence harmless warnings about va_list mangling
# 3) -fstack-protector -fstack-protector-all is added to enable stack smashing protection
#
QMAKE_CFLAGS += -Wno-psabi
QMAKE_CFLAGS += -Wno-psabi -fstack-protector -fstack-protector-all
QMAKE_CFLAGS_DEPS += -M
QMAKE_CFLAGS_WARN_ON += -Wall -W
QMAKE_CFLAGS_WARN_OFF += -w

View File

@ -3,7 +3,7 @@
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@ -39,45 +39,57 @@
**
****************************************************************************/
#ifndef Q_GLX_CONTEXT_H
#define Q_GLX_CONTEXT_H
#include "qeglfs_hooks.h"
#include <EGL/fbdev_window.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/fb.h>
#include "qxlibwindow.h"
#include <QtGui/QPlatformOpenGLContext>
#include <QtGui/qsurfaceformat.h>
#include <QtCore/QMutex>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
#include <GL/glx.h>
QT_BEGIN_NAMESPACE
class QGLXContext : public QPlatformOpenGLContext
void QEglFSHooks::platformInit()
{
public:
QGLXContext(QXlibScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share);
~QGLXContext();
}
QSurfaceFormat format() const;
void swapBuffers(QPlatformSurface *surface);
bool makeCurrent(QPlatformSurface *surface);
void doneCurrent();
virtual void (*getProcAddress(const QByteArray& procName))();
void QEglFSHooks::platformDestroy()
{
}
GLXContext glxContext() const {return m_context;}
EGLNativeDisplayType QEglFSHooks::platformDisplay() const
{
return EGL_DEFAULT_DISPLAY;
}
QSurfaceFormat surfaceFormat() const;
QSize QEglFSHooks::screenSize() const
{
int fd = open("/dev/fb0", O_RDONLY);
if (fd == -1) {
qFatal("Failed to open fb to detect screen resolution!");
}
private:
QXlibScreen *m_screen;
GLXContext m_context;
QSurfaceFormat m_windowFormat;
};
struct fb_var_screeninfo vinfo;
if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1) {
qFatal("Could not get variable screen info");
}
QT_END_NAMESPACE
close(fd);
#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
return QSize(vinfo.xres, vinfo.yres);
}
#endif
EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
{
fbdev_window *window = new fbdev_window;
window->width = size.width();
window->height = size.height();
return window;
}
void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window)
{
delete window;
}
QEglFSHooks platform_hooks;

View File

@ -0,0 +1,36 @@
#
# qmake configuration for linux-g++
#
MAKEFILE_GENERATOR = UNIX
TARGET_PLATFORM = unix
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib
include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
load(device_config)
isEmpty(CROSS_COMPILE): error("CROSS_COMPILE needs to be set via -device-option CROSS_COMPILE=<path>")
QMAKE_CC = $${CROSS_COMPILE}gcc
QMAKE_CXX = $${CROSS_COMPILE}g++
QMAKE_LINK = $${QMAKE_CXX}
QMAKE_LINK_SHLIB = $${QMAKE_CXX}
QMAKE_AR = $${CROSS_COMPILE}ar cqs
QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy
QMAKE_STRIP = $${CROSS_COMPILE}strip
QMAKE_CFLAGS_RELEASE += -O2 -mfloat-abi=softfp -mfpu=neon -mcpu=cortex-a9
QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
deviceSanityCheckCompiler()
EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfs_hooks_8726m.cpp
load(qt_config)

View File

@ -0,0 +1,43 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../../linux-g++/qplatformdefs.h"

View File

@ -0,0 +1,65 @@
#
# qmake configuration for linux-mipsel-broadcom-97425-g++
#
MAKEFILE_GENERATOR = UNIX
TARGET_PLATFORM = unix
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib
include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
load(device_config)
# Modify the defaults we loaded above
CROSS_COMPILE = mipsel-linux-
QMAKE_CC = $${CROSS_COMPILE}gcc
QMAKE_CXX = $${CROSS_COMPILE}g++
QMAKE_LINK = $${QMAKE_CXX}
QMAKE_LINK_SHLIB = $${QMAKE_CXX}
QMAKE_AR = $${CROSS_COMPILE}ar cqs
QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy
QMAKE_STRIP = $${CROSS_COMPILE}strip
QMAKE_CFLAGS_RELEASE += -O2
QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
#TODO: Clean Qt to work with uclibc not calling itself GLIBC.
#QMAKE_CFLAGS += -D__FORCE_NOGLIBC
#QMAKE_CXXFLAGS += -D__FORCE_NOGLIBC
BRCM_PLATFORM = 97425
# Sanity checks
deviceSanityCheckCompiler()
isEmpty(B_REFSW_DEBUG):error("B_REFSW_DEBUG needs to be set via -device-option B_REFSW_DEBUG=(y|n).")
isEmpty(BRCM_ROCKFORD_PATH):error("BRCM_ROCKFORD_PATH needs to be set via -device-option BRCM_ROCKFORD_PATH=path.")
isEmpty(BRCM_APPLIBS_PATH):error("BRCM_APPLIBS_PATH needs to be set via -device-option BRCM_APPLIBS_PATH=path.")
# Figure the kind of directfb build used.
BRCM_BUILD_TYPE = debug
contains(B_REFSW_DEBUG, [Nn]) {
BRCM_BUILD_TYPE = release
}
QMAKE_INCDIR_OPENGL_ES2 = $${BRCM_ROCKFORD_PATH}/middleware/v3d/interface/khronos/include
QMAKE_LIBDIR_OPENGL_ES2 = $${BRCM_ROCKFORD_PATH}/middleware/v3d/lib_$${BRCM_PLATFORM}_$${BRCM_BUILD_TYPE}
QMAKE_LIBS_OPENGL_ES2 = -lv3ddriver -lrt
INCLUDEPATH += $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3
QMAKE_LIBDIR += $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3
# DirectFB, needs to be changed once -directfb is added to configure
DIRECTFB_INCLUDEPATH = $${BRCM_APPLIBS_PATH}/opensource/directfb/bin/DirectFB-1.4.15_multi_$${BRCM_BUILD_TYPE}_build.97425B1/usr/local/include/directfb $${BRCM_ROCKFORD_PATH}/middleware/platform/directfb
DIRECTFB_LIBS = -L$${BRCM_APPLIBS_PATH}/opensource/directfb/bin/DirectFB-1.4.15_multi_$${BRCM_BUILD_TYPE}_build.97425B1/usr/local/lib -L$${BRCM_ROCKFORD_PATH}/middleware/platform/directfb/lib_$${BRCM_PLATFORM}_$${BRCM_BUILD_TYPE} -ldirectfb -lfusion -ldirect -lpthread -lnexus -ldbpl -lz
QMAKE_LFLAGS += -Wl,-rpath-link,$$QMAKE_LIBDIR_OPENGL_ES2 -Wl,-rpath-link,$${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3
load(qt_config)

View File

@ -0,0 +1,42 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../../linux-g++/qplatformdefs.h"

View File

@ -0,0 +1,143 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qeglfs_hooks.h"
#include <bcm_host.h>
#if 0 //fb size query
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/fb.h>
#endif
static DISPMANX_DISPLAY_HANDLE_T dispman_display = 0;
static DISPMANX_UPDATE_HANDLE_T dispman_update = 0;
void QEglFSHooks::platformInit()
{
bcm_host_init();
}
EGLNativeDisplayType QEglFSHooks::platformDisplay() const
{
dispman_display = vc_dispmanx_display_open(0/* LCD */);
return EGL_DEFAULT_DISPLAY;
}
void QEglFSHooks::platformDestroy()
{
vc_dispmanx_display_close(dispman_display);
}
QSize QEglFSHooks::screenSize() const
{
//both mechanisms work
#if 1
uint32_t width, height;
graphics_get_display_size(0 /* LCD */, &width, &height);
return QSize(width, height);
#else
int fd = open("/dev/fb0", O_RDONLY);
if (fd == -1) {
fprintf(stderr, "Failed to open fb to detect screen resolution!\n");
return QSize();
}
struct fb_var_screeninfo vinfo;
if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) = -1) {
fprintf(stderr, "Could not query screen info variable\n");
close(fd);
return QSize();
}
close(fd);
return QSize(vinfo.xres, vinfo.yres);
#endif
}
EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
{
VC_RECT_T dst_rect;
dst_rect.x = 0;
dst_rect.y = 0;
dst_rect.width = size.width();
dst_rect.height = size.height();
VC_RECT_T src_rect;
src_rect.x = 0;
src_rect.y = 0;
src_rect.width = size.width() << 16;
src_rect.height = size.height() << 16;
dispman_update = vc_dispmanx_update_start(0);
VC_DISPMANX_ALPHA_T alpha;
alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
alpha.opacity = 0xFF;
alpha.mask = 0;
DISPMANX_ELEMENT_HANDLE_T dispman_element = vc_dispmanx_element_add(
dispman_update, dispman_display, 0, &dst_rect, 0, &src_rect,
DISPMANX_PROTECTION_NONE, &alpha, (DISPMANX_CLAMP_T *)NULL, (DISPMANX_TRANSFORM_T)0);
vc_dispmanx_update_submit_sync(dispman_update);
EGL_DISPMANX_WINDOW_T *eglWindow = new EGL_DISPMANX_WINDOW_T;
eglWindow->element = dispman_element;
eglWindow->width = size.width();
eglWindow->height = size.height();
return eglWindow;
}
void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window)
{
EGL_DISPMANX_WINDOW_T *eglWindow = static_cast<EGL_DISPMANX_WINDOW_T *>(window);
vc_dispmanx_element_remove(dispman_update, eglWindow->element);
delete eglWindow;
}
QEglFSHooks platform_hooks;

View File

@ -0,0 +1,56 @@
#
# qmake configuration for Broadcom's Raspberry PI
# http://wiki.qt-project.org/Devices/RaspberryPi
!exists($$[QT_SYSROOT]/usr/include/libudev.h) {
message("Keyboard support requires udev")
message("Install libudev-dev in your rootfs")
error()
}
MAKEFILE_GENERATOR = UNIX
TARGET_PLATFORM = unix
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib
include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
load(device_config)
QMAKE_CC = $${CROSS_COMPILE}gcc
QMAKE_CXX = $${CROSS_COMPILE}g++
QMAKE_LINK = $${QMAKE_CXX}
QMAKE_LINK_SHLIB = $${QMAKE_CXX}
# modifications to linux.conf
QMAKE_AR = $${CROSS_COMPILE}ar cqs
QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy
QMAKE_STRIP = $${CROSS_COMPILE}strip
#Circular dependency in GLES2 <-> EGL requires the following abomination
QMAKE_LIBS_EGL = -L$$[QT_SYSROOT]/opt/vc/lib -lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil
QMAKE_LIBS_OPENGL_ES2 = $${QMAKE_LIBS_EGL}
QMAKE_LIBS_OPENVG = $${QMAKE_LIBS_EGL}
QMAKE_INCDIR_EGL = $$[QT_SYSROOT]/opt/vc/include
QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}
QMAKE_CFLAGS_RELEASE += \
-mfloat-abi=softfp \
-mfpu=vfp \
-mtune=arm1176jzf-s \
-march=armv6zk \
-mabi=aapcs-linux
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfs_hooks.cpp
# Sanity check
deviceSanityCheckCompiler()
load(qt_config)

View File

@ -0,0 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../../linux-g++/qplatformdefs.h"
#define QT_QPA_DEFAULT_PLATFORM_NAME "eglfs"

View File

@ -17,10 +17,6 @@ defineReplace(cmakeModuleList) {
CMAKE_MODULE_NAME = $$cmakeModuleName($${MODULE})
CMAKE_MODULE_DEPS = $$cmakeModuleList($$eval(QT.$${MODULE}.depends))
CMAKE_PARTIAL_MODULE_DEPS = $$replace(CMAKE_MODULE_DEPS, ";", ";Qt5::")
!isEmpty(CMAKE_PARTIAL_MODULE_DEPS):CMAKE_QT5_MODULE_DEPS = "Qt5::$${CMAKE_PARTIAL_MODULE_DEPS}"
CMAKE_QT_INSTALL_PREFIX = $$replace($$list($$[QT_INSTALL_PREFIX]), \\\\, /)/
CMAKE_QT_INSTALL_PREFIX_ESCAPED = "^$$re_escape($$CMAKE_QT_INSTALL_PREFIX)"
@ -114,11 +110,11 @@ macx {
}
}
debug_type =
release_type =
CMAKE_DEBUG_TYPE =
CMAKE_RELEASE_TYPE =
debug_and_release|debug:debug_type = debug
debug_and_release|release:release_type = release
debug_and_release|debug:CMAKE_DEBUG_TYPE = debug
debug_and_release|release:CMAKE_RELEASE_TYPE = release
INSTALLS += cmake_qt5_module_files

View File

@ -1 +1,2 @@
DEFINES += QT_DECLARATIVE_DEBUG
warning("CONFIG+=declarative_debug is deprecated. Use qml_debug instead!")

View File

@ -25,3 +25,14 @@ exists($$DEVICE_PRI):include($$DEVICE_PRI)
unset(DEVICE_PRI)
unset(DIR)
# Provide a function to be used by mkspecs
defineTest(deviceSanityCheckCompiler) {
# Check if the binary exists, e.g. with an absolute path
exists($$QMAKE_CXX):return()
# Check if the compiler is in the path
system("which $$QMAKE_CXX > /dev/null"):return()
error("Compiler $$QMAKE_CXX not found")
}

View File

@ -0,0 +1 @@
DEFINES += QT_QML_DEBUG

View File

@ -42,7 +42,7 @@ CONFIG -= fix_output_dirs
win32|mac:!macx-xcode:CONFIG += debug_and_release
linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
!isEmpty(MODULE):CONFIG += create_cmake
!isEmpty(DESTDIR):CONFIG += create_cmake
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions

View File

@ -5,7 +5,7 @@
MAKEFILE_GENERATOR = UNIX
TARGET_PLATFORM = unix
TEMPLATE = app
CONFIG += qt warn_on release link_prl qnx
CONFIG += qt warn_on release link_prl
QT += core gui
include(../../common/g++-unix.conf)

View File

@ -139,6 +139,7 @@ void BorlandMakefileGenerator::writeBuildRulesPart(QTextStream &t)
{
if (project->first("TEMPLATE") == "aux") {
t << "first:" << endl;
t << "all:" << endl;
return;
}

View File

@ -433,6 +433,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
{
if (project->first("TEMPLATE") == "aux") {
t << "first:" << endl;
t << "all:" << endl;
return;
}

View File

@ -344,6 +344,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t)
{
if (project->first("TEMPLATE") == "aux") {
t << "first:" << endl;
t << "all:" << endl;
return;
}

View File

@ -1721,7 +1721,8 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
function_blocks.push(defined);
QStringList ret;
defined->exec(args_list, this, place, ret);
Q_ASSERT(function_blocks.pop() == defined);
bool correct = function_blocks.pop() == defined;
Q_ASSERT(correct); Q_UNUSED(correct);
return ret;
}
@ -2206,7 +2207,8 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QHash<QS
QStringList ret;
function_blocks.push(defined);
defined->exec(args_list, this, place, ret);
Q_ASSERT(function_blocks.pop() == defined);
bool correct = function_blocks.pop() == defined;
Q_ASSERT(correct); Q_UNUSED(correct);
if(ret.isEmpty()) {
return true;

View File

@ -263,8 +263,13 @@ static HB_Bool HB_ThaiConvertStringToGlyphIndices (HB_ShaperItem *item)
// The only glyphs that should be passed to this function that cannot be mapped to
// tis620 are the ones of type Inherited class. Pass these glyphs untouched.
glyphString[slen++] = string[i];
if (string[i] == 0x200D || string[i] == 0x200C)
item->attributes[slen-1].dontPrint = true; // Hide ZWJ and ZWNJ characters
if (string[i] == 0x200D || string[i] == 0x200C) {
// Check that we do not run out of bounds when setting item->attributes. If we do
// run out of bounds then this function will return false, the necessary amount of
// memory is reallocated, and this function will then be called again.
if (slen <= item->num_glyphs)
item->attributes[slen-1].dontPrint = true; // Hide ZWJ and ZWNJ characters
}
} else {
glyphString[slen++] = (HB_UChar16) thai_get_glyph_index (font_type, rglyphs[lgi]);
}

View File

@ -30,9 +30,6 @@ list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE)
set(QT_LIBINFIX \"$${QT_LIBINFIX}\")
!!ENDIF
set(QT_CONFIG \"$${CONFIG}\")
set(QT_QCONFIG \"$${QT_CONFIG}\")
!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
set(Qt5Core_QTMAIN_LIBRARIES Qt5::WinMain)
@ -41,22 +38,22 @@ if (NOT _Qt5WinMain_target)
add_library(Qt5::WinMain STATIC IMPORTED)
endif()
!!IF !isEmpty(debug_type)
!!IF !isEmpty(CMAKE_DEBUG_TYPE)
set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(Qt5::WinMain PROPERTIES
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
IMPORTED_LOCATION_DEBUG "${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}"
IMPORTED_LOCATION_DEBUG "${_qt5_corelib_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}"
!!ELSE
IMPORTED_LOCATION_DEBUG "$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}"
!!ENDIF
)
!!ENDIF
!!IF !isEmpty(release_type)
!!IF !isEmpty(CMAKE_RELEASE_TYPE)
set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Qt5::WinMain PROPERTIES
!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
IMPORTED_LOCATION_RELEASE \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\"
IMPORTED_LOCATION_RELEASE \"${_qt5_corelib_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\"
!!ELSE
IMPORTED_LOCATION_RELEASE \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\"
!!ENDIF

View File

@ -38,7 +38,7 @@ unix {
contains(QT_CONFIG,iconv) {
HEADERS += codecs/qiconvcodec_p.h
SOURCES += codecs/qiconvcodec.cpp
qnx-*-qcc:LIBS_PRIVATE *= -liconv
qnx:LIBS_PRIVATE *= -liconv
} else:contains(QT_CONFIG,gnu-libiconv) {
HEADERS += codecs/qiconvcodec_p.h
SOURCES += codecs/qiconvcodec.cpp

View File

@ -90,6 +90,7 @@
# define Q_DECL_ALIGN(n) __declspec(align(n))
# define Q_ASSUME(expr) __assume(expr)
# define Q_UNREACHABLE() __assume(0)
# define Q_NORETURN __declspec(noreturn)
/* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
# if defined(__INTEL_COMPILER)
# define Q_CC_INTEL
@ -165,6 +166,7 @@
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
# define Q_LIKELY(expr) __builtin_expect(!!(expr), true)
# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false)
# define Q_NORETURN __attribute__((__noreturn__))
# if !defined(QT_MOC_CPP)
# define Q_PACKED __attribute__ ((__packed__))
# define Q_NO_PACKED_REFERENCE
@ -399,6 +401,10 @@
# error "Qt has not been tested with this compiler - see http://www.qt-project.org/"
#endif
#ifndef Q_NORETURN
# define Q_NORETURN
#endif
/*
* C++11 support
*

View File

@ -2886,4 +2886,203 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
otherwise.
*/
/*!
\macro qDebug(const char *message, ...)
\relates <QtGlobal>
Calls the message handler with the debug message \a message. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the console, if it is a
console application; otherwise, it is sent to the debugger. This
function does nothing if \c QT_NO_DEBUG_OUTPUT was defined
during compilation.
If you pass the function a format string and a list of arguments,
it works in similar way to the C printf() function. The format
should be a Latin-1 string.
Example:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 24
If you include \c <QtDebug>, a more convenient syntax is also
available:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 25
With this syntax, the function returns a QDebug object that is
configured to use the QtDebugMsg message type. It automatically
puts a single space between each item, and outputs a newline at
the end. It supports many C++ and Qt types.
To suppress the output at run-time, install your own message handler
with qInstallMessageHandler().
\sa qWarning(), qCritical(), qFatal(), qInstallMessageHandler(),
{Debugging Techniques}
*/
/*!
\macro qWarning(const char *message, ...)
\relates <QtGlobal>
Calls the message handler with the warning message \a message. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the debugger. This
function does nothing if \c QT_NO_WARNING_OUTPUT was defined
during compilation; it exits if the environment variable \c
QT_FATAL_WARNINGS is defined.
This function takes a format string and a list of arguments,
similar to the C printf() function. The format should be a Latin-1
string.
Example:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 26
If you include <QtDebug>, a more convenient syntax is
also available:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 27
This syntax inserts a space between each item, and
appends a newline at the end.
To suppress the output at runtime, install your own message handler
with qInstallMessageHandler().
\sa qDebug(), qCritical(), qFatal(), qInstallMessageHandler(),
{Debugging Techniques}
*/
/*!
\macro qCritical(const char *message, ...)
\relates <QtGlobal>
Calls the message handler with the critical message \a message. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the debugger.
This function takes a format string and a list of arguments,
similar to the C printf() function. The format should be a Latin-1
string.
Example:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 28
If you include <QtDebug>, a more convenient syntax is
also available:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 29
A space is inserted between the items, and a newline is
appended at the end.
To suppress the output at runtime, install your own message handler
with qInstallMessageHandler().
\sa qDebug(), qWarning(), qFatal(), qInstallMessageHandler(),
{Debugging Techniques}
*/
/*!
\macro qFatal(const char *message, ...)
\relates <QtGlobal>
Calls the message handler with the fatal message \a message. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the debugger.
If you are using the \b{default message handler} this function will
abort on Unix systems to create a core dump. On Windows, for debug builds,
this function will report a _CRT_ERROR enabling you to connect a debugger
to the application.
This function takes a format string and a list of arguments,
similar to the C printf() function.
Example:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 30
To suppress the output at runtime, install your own message handler
with qInstallMessageHandler().
\sa qDebug(), qCritical(), qWarning(), qInstallMessageHandler(),
{Debugging Techniques}
*/
/*!
\typedef QtMsgHandler
\relates <QtGlobal>
\deprecated
This is a typedef for a pointer to a function with the following
signature:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 7
This typedef is deprecated, you should use QMessageHandler instead.
\sa QtMsgType, QMessageHandler, qInstallMsgHandler(), qInstallMessageHandler()
*/
/*!
\typedef QMessageHandler
\relates <QtGlobal>
\since 5.0
This is a typedef for a pointer to a function with the following
signature:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 49
\sa QtMsgType, qInstallMessageHandler()
*/
/*!
\fn QMessageHandler qInstallMessageHandler(QMessageHandler handler)
\relates <QtGlobal>
\since 5.0
Installs a Qt message \a handler which has been defined
previously. Returns a pointer to the previous message handler
(which may be 0).
The message handler is a function that prints out debug messages,
warnings, critical and fatal error messages. The Qt library (debug
mode) contains hundreds of warning messages that are printed
when internal errors (usually invalid function arguments)
occur. Qt built in release mode also contains such warnings unless
QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during
compilation. If you implement your own message handler, you get total
control of these messages.
The default message handler prints the message to the standard
output under X11 or to the debugger under Windows. If it is a
fatal message, the application aborts immediately.
Only one message handler can be defined, since this is usually
done on an application-wide basis to control debug output.
To restore the message handler, call \c qInstallMessageHandler(0).
Example:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 23
\sa QMessageHandler, QtMsgType, qDebug(), qWarning(), qCritical(), qFatal(),
{Debugging Techniques}
*/
/*!
\fn QtMsgHandler qInstallMsgHandler(QtMsgHandler handler)
\relates <QtGlobal>
\deprecated
Installs a Qt message \a handler which has been defined
previously. This method is deprecated, use qInstallMessageHandler
instead.
\sa QtMsgHandler, qInstallMessageHandler
*/
QT_END_NAMESPACE

View File

@ -75,14 +75,14 @@ QT_BEGIN_NAMESPACE
\brief The QMessageLogger class generates log messages.
\since 5.0
QMessageLogger is used to generate messages for the Qt logging framework. Most of the time
is transparently used through the qDebug(), qWarning(), qCritical, or qFatal() functions,
QMessageLogger is used to generate messages for the Qt logging framework. Usually one uses
it through qDebug(), qWarning(), qCritical, or qFatal() functions,
which are actually macros that expand to QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debug()
et al.
One example of direct use is to forward errors that stem from a scripting language, e.g. QML:
\snippet doc/src/snippets/code/qlogging/qlogging.cpp 1
\snippet doc/src/snippets/code/qlogging/qloggingsnippet.cpp 1
\sa QMessageLogContext, qDebug(), qWarning(), qCritical(), qFatal()
*/
@ -132,41 +132,6 @@ static void qt_message(QtMsgType msgType, const QMessageLogContext &context, con
}
#undef qDebug
/*!
\fn qDebug(const char *message, ...)
\relates <QtGlobal>
Calls the message handler with the debug message \a msg. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the console, if it is a
console application; otherwise, it is sent to the debugger. This
function does nothing if \c QT_NO_DEBUG_OUTPUT was defined
during compilation.
If you pass the function a format string and a list of arguments,
it works in similar way to the C printf() function. The format
should be a Latin-1 string.
Example:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 24
If you include \c <QtDebug>, a more convenient syntax is also
available:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 25
With this syntax, the function returns a QDebug object that is
configured to use the QtDebugMsg message type. It automatically
puts a single space between each item, and outputs a newline at
the end. It supports many C++ and Qt types.
To suppress the output at run-time, install your own message handler
with qInstallMessageHandler().
\sa qWarning(), qCritical(), qFatal(), qInstallMessageHandler(),
{Debugging Techniques}
*/
void QMessageLogger::debug(const char *msg, ...)
{
@ -182,9 +147,7 @@ QDebug QMessageLogger::debug()
{
QDebug dbg = QDebug(QtDebugMsg);
QMessageLogContext &ctxt = dbg.stream->context;
ctxt.file = context.file;
ctxt.line = context.line;
ctxt.function = context.function;
ctxt.copy(context);
return dbg;
}
@ -196,39 +159,6 @@ QNoDebug QMessageLogger::noDebug()
#endif
#undef qWarning
/*!
\fn qWarning(const char *message, ...)
\relates <QtGlobal>
Calls the message handler with the warning message \a msg. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the debugger. This
function does nothing if \c QT_NO_WARNING_OUTPUT was defined
during compilation; it exits if the environment variable \c
QT_FATAL_WARNINGS is defined.
This function takes a format string and a list of arguments,
similar to the C printf() function. The format should be a Latin-1
string.
Example:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 26
If you include <QtDebug>, a more convenient syntax is
also available:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 27
This syntax inserts a space between each item, and
appends a newline at the end.
To suppress the output at runtime, install your own message handler
with qInstallMessageHandler().
\sa qDebug(), qCritical(), qFatal(), qInstallMessageHandler(),
{Debugging Techniques}
*/
void QMessageLogger::warning(const char *msg, ...)
{
va_list ap;
@ -242,43 +172,12 @@ QDebug QMessageLogger::warning()
{
QDebug dbg = QDebug(QtWarningMsg);
QMessageLogContext &ctxt = dbg.stream->context;
ctxt.file = context.file;
ctxt.line = context.line;
ctxt.function = context.function;
ctxt.copy(context);
return dbg;
}
#endif
#undef qCritical
/*!
\fn qCritical(const char *message, ...)
\relates <QtGlobal>
Calls the message handler with the critical message \a msg. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the debugger.
This function takes a format string and a list of arguments,
similar to the C printf() function. The format should be a Latin-1
string.
Example:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 28
If you include <QtDebug>, a more convenient syntax is
also available:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 29
A space is inserted between the items, and a newline is
appended at the end.
To suppress the output at runtime, install your own message handler
with qInstallMessageHandler().
\sa qDebug(), qWarning(), qFatal(), qInstallMessageHandler(),
{Debugging Techniques}
*/
void QMessageLogger::critical(const char *msg, ...)
{
@ -293,39 +192,12 @@ QDebug QMessageLogger::critical()
{
QDebug dbg = QDebug(QtCriticalMsg);
QMessageLogContext &ctxt = dbg.stream->context;
ctxt.file = context.file;
ctxt.line = context.line;
ctxt.function = context.function;
ctxt.copy(context);
return dbg;
}
#endif
#undef qFatal
/*!
\fn qFatal(const char *message, ...)
\relates <QtGlobal>
Calls the message handler with the fatal message \a msg. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the debugger.
If you are using the \b{default message handler} this function will
abort on Unix systems to create a core dump. On Windows, for debug builds,
this function will report a _CRT_ERROR enabling you to connect a debugger
to the application.
This function takes a format string and a list of arguments,
similar to the C printf() function.
Example:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 30
To suppress the output at runtime, install your own message handler
with qInstallMessageHandler().
\sa qDebug(), qCritical(), qWarning(), qInstallMessageHandler(),
{Debugging Techniques}
*/
void QMessageLogger::fatal(const char *msg, ...)
{
@ -491,6 +363,7 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info)
}
// tokens as recognized in QT_MESSAGE_PATTERN
static const char categoryTokenC[] = "%{category}";
static const char typeTokenC[] = "%{type}";
static const char messageTokenC[] = "%{message}";
static const char fileTokenC[] = "%{file}";
@ -560,7 +433,9 @@ QMessagePattern::QMessagePattern()
// placeholder
if (lexeme == QLatin1String(typeTokenC)) {
tokens[i] = typeTokenC;
} else if (lexeme == QLatin1String(messageTokenC))
} else if (lexeme == QLatin1String(categoryTokenC))
tokens[i] = categoryTokenC;
else if (lexeme == QLatin1String(messageTokenC))
tokens[i] = messageTokenC;
else if (lexeme == QLatin1String(fileTokenC))
tokens[i] = fileTokenC;
@ -627,6 +502,8 @@ Q_CORE_EXPORT QByteArray qMessageFormatString(QtMsgType type, const QMessageLogC
const char *token = pattern->tokens[i];
if (token == messageTokenC) {
message.append(str);
} else if (token == categoryTokenC) {
message.append(context.category);
} else if (token == typeTokenC) {
switch (type) {
case QtDebugMsg: message.append("debug"); break;
@ -775,68 +652,6 @@ extern Q_CORE_EXPORT void qWinMessageHandler(QtMsgType t, const QMessageLogConte
const char *str);
#endif
/*!
\typedef QtMsgHandler
\relates <QtGlobal>
\deprecated
This is a typedef for a pointer to a function with the following
signature:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 7
This typedef is deprecated, you should use QMessageHandler instead.
\sa QtMsgType, QMessageHandler, qInstallMsgHandler(), qInstallMessageHandler()
*/
/*!
\typedef QMessageHandler
\relates <QtGlobal>
\since 5.0
This is a typedef for a pointer to a function with the following
signature:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 49
\sa QtMsgType, qInstallMessageHandler()
*/
/*!
\fn QMessageHandler qInstallMessageHandler(QMessageHandler handler)
\relates <QtGlobal>
\since 5.0
Installs a Qt message \a handler which has been defined
previously. Returns a pointer to the previous message handler
(which may be 0).
The message handler is a function that prints out debug messages,
warnings, critical and fatal error messages. The Qt library (debug
mode) contains hundreds of warning messages that are printed
when internal errors (usually invalid function arguments)
occur. Qt built in release mode also contains such warnings unless
QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during
compilation. If you implement your own message handler, you get total
control of these messages.
The default message handler prints the message to the standard
output under X11 or to the debugger under Windows. If it is a
fatal message, the application aborts immediately.
Only one message handler can be defined, since this is usually
done on an application-wide basis to control debug output.
To restore the message handler, call \c qInstallMessageHandler(0).
Example:
\snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 23
\sa qDebug(), qWarning(), qCritical(), qFatal(), QtMsgType,
{Debugging Techniques}
*/
QMessageHandler qInstallMessageHandler(QMessageHandler h)
{
if (!messageHandler)
@ -850,17 +665,6 @@ QMessageHandler qInstallMessageHandler(QMessageHandler h)
return old;
}
/*!
\fn QtMsgHandler qInstallMsgHandler(QtMsgHandler handler)
\relates <QtGlobal>
\deprecated
Installs a Qt message \a handler which has been defined
previously. This method is deprecated, use qInstallMessageHandler
instead.
\sa QtMsgHandler, qInstallMessageHandler
*/
QtMsgHandler qInstallMsgHandler(QtMsgHandler h)
{
//if handler is 0, set it to the
@ -876,4 +680,11 @@ QtMsgHandler qInstallMsgHandler(QtMsgHandler h)
return old;
}
void QMessageLogContext::copy(const QMessageLogContext &logContext)
{
this->category = logContext.category;
this->file = logContext.file;
this->line = logContext.line;
this->function = logContext.function;
}
QT_END_NAMESPACE

View File

@ -66,15 +66,17 @@ class QMessageLogContext
{
Q_DISABLE_COPY(QMessageLogContext)
public:
QMessageLogContext() : version(1), line(0), file(0), function(0) {}
Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber,
const char *functionName)
: version(1), line(lineNumber), file(fileName), function(functionName) {}
QMessageLogContext() : version(1), line(0), file(0), function(0), category(0) {}
Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName)
: version(1), line(lineNumber), file(fileName), function(functionName), category(categoryName) {}
void copy(const QMessageLogContext &logContext);
int version;
int line;
const char *file;
const char *function;
const char *category;
private:
friend class QMessageLogger;
@ -87,7 +89,9 @@ class Q_CORE_EXPORT QMessageLogger
public:
QMessageLogger() : context() {}
Q_DECL_CONSTEXPR QMessageLogger(const char *file, int line, const char *function)
: context(file, line, function) {}
: context(file, line, function, "default") {}
Q_DECL_CONSTEXPR QMessageLogger(const char *file, int line, const char *function, const char *category)
: context(file, line, function, category) {}
void debug(const char *msg, ...)
#if defined(Q_CC_GNU) && !defined(__INSURE__)

View File

@ -191,7 +191,10 @@
# if !defined(MAC_OS_X_VERSION_10_7)
# define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1
# endif
# if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_7)
# if !defined(MAC_OS_X_VERSION_10_8)
# define MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_10_7 + 1
# endif
# if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_8)
# warning "This version of Mac OS X is unsupported"
# endif
#endif

View File

@ -1741,11 +1741,16 @@ bool QDir::remove(const QString &fileName)
true if successful; otherwise returns false.
On most file systems, rename() fails only if \a oldName does not
exist, if \a newName and \a oldName are not on the same
partition or if a file with the new name already exists.
exist, or if a file with the new name already exists.
However, there are also other reasons why rename() can
fail. For example, on at least one file system rename() fails if
\a newName points to an open file.
If \a oldName is a file (not a directory) that can't be renamed
right away, Qt will try to copy \a oldName to \a newName and remove
\a oldName.
\sa QFile::rename()
*/
bool QDir::rename(const QString &oldName, const QString &newName)
{

View File

@ -577,6 +577,11 @@ QFile::remove(const QString &fileName)
The file is closed before it is renamed.
If the rename operation fails, Qt will attempt to copy this file's
contents to \a newName, and then remove this file, keeping only
\a newName. If that copy operation fails or this file can't be removed,
the destination file \a newName is removed to restore the old state.
\sa setFileName()
*/

View File

@ -612,6 +612,13 @@ QString QFileSystemEngine::tempPath()
{
#ifdef QT_UNIX_TEMP_PATH_OVERRIDE
return QLatin1String(QT_UNIX_TEMP_PATH_OVERRIDE);
#elif defined(Q_OS_BLACKBERRY)
QString temp = QFile::decodeName(qgetenv("TEMP"));
if (temp.isEmpty()) {
qWarning("TEMP environment variable not set. Cannot determine temporary directory");
return QString();
}
return QDir::cleanPath(temp);
#else
QString temp = QFile::decodeName(qgetenv("TMPDIR"));
if (temp.isEmpty())

View File

@ -99,11 +99,11 @@ static char *mkdtemp(char *templateName)
{
static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const int length = strlen(templateName);
const size_t length = strlen(templateName);
char *XXXXXX = templateName + length - 6;
if ((length < 6) || strncmp(XXXXXX, "XXXXXX", 6))
if ((length < 6u) || strncmp(XXXXXX, "XXXXXX", 6))
return 0;
for (int i = 0; i < 256; ++i) {

View File

@ -745,7 +745,7 @@ public:
Data *clone(Base *b, int reserve = 0)
{
int size = sizeof(Header) + b->size;
if (ref.load() == 1 && alloc >= size + reserve)
if (b == header->root() && ref.load() == 1 && alloc >= size + reserve)
return this;
if (reserve) {

View File

@ -275,7 +275,7 @@ void QJsonArray::removeAt(int i)
detach();
a->removeItems(i, 1);
++d->compactionCounter;
if (d->compactionCounter > 32 && d->compactionCounter >= (int)a->length/2)
if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(a->length) / 2u)
compact();
}
@ -379,7 +379,7 @@ void QJsonArray::replace(int i, const QJsonValue &value)
QJsonPrivate::Value::copyData(value, (char *)a + valueOffset, compressed);
++d->compactionCounter;
if (d->compactionCounter > 32 && d->compactionCounter >= (int)a->length/2)
if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(a->length) / 2u)
compact();
}

View File

@ -224,23 +224,26 @@ const char *QJsonDocument::rawData(int *size) const
*/
QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidation validation)
{
if (data.size() < (int)(sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)))
return QJsonDocument();
QJsonPrivate::Header h;
memcpy(&h, data.constData(), sizeof(QJsonPrivate::Header));
QJsonPrivate::Base root;
memcpy(&root, data.constData() + sizeof(QJsonPrivate::Header), sizeof(QJsonPrivate::Base));
// do basic checks here, so we don't try to allocate more memory than we can.
if (data.size() < (int)(sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)) ||
h.tag != QJsonDocument::BinaryFormatTag || h.version != 1u ||
if (h.tag != QJsonDocument::BinaryFormatTag || h.version != 1u ||
sizeof(QJsonPrivate::Header) + root.size > (uint)data.size())
return QJsonDocument();
char *raw = (char *)malloc(data.size());
const uint size = sizeof(QJsonPrivate::Header) + root.size;
char *raw = (char *)malloc(size);
if (!raw)
return QJsonDocument();
memcpy(raw, data.constData(), data.size());
QJsonPrivate::Data *d = new QJsonPrivate::Data(raw, data.size());
memcpy(raw, data.constData(), size);
QJsonPrivate::Data *d = new QJsonPrivate::Data(raw, size);
if (validation != BypassValidation && !d->valid()) {
delete d;

View File

@ -63,14 +63,16 @@ struct Q_CORE_EXPORT QJsonParseError
UnterminatedArray,
MissingValueSeparator,
IllegalValue,
EndOfNumber,
TerminationByNumber,
IllegalNumber,
StringEscapeSequence,
StringUTF8Scan,
EndOfString,
IllegalEscapeSequence,
IllegalUTF8String,
UnterminatedString,
MissingObject
};
QString errorString() const;
int offset;
ParseError error;
};

View File

@ -335,7 +335,7 @@ void QJsonObject::remove(const QString &key)
detach();
o->removeItems(index, 1);
++d->compactionCounter;
if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2)
if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
compact();
}
@ -361,7 +361,7 @@ QJsonValue QJsonObject::take(const QString &key)
QJsonPrivate::Entry *e = o->entryAt(index);
o->removeItems(index, 1);
++d->compactionCounter;
if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2)
if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
compact();
return QJsonValue(d, o, e->value);
@ -432,7 +432,7 @@ QJsonObject::iterator QJsonObject::erase(QJsonObject::iterator it)
o->removeItems(index, 1);
++d->compactionCounter;
if (d->compactionCounter > 32 && d->compactionCounter >= (int)o->length/2)
if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
compact();
// iterator hasn't changed

View File

@ -39,6 +39,9 @@
**
****************************************************************************/
#ifndef QT_BOOTSTRAPPED
#include <qcoreapplication.h>
#endif
#include <qdebug.h>
#include "qjsonparser_p.h"
#include "qjson_p.h"
@ -57,6 +60,80 @@ static int indent = 0;
QT_BEGIN_NAMESPACE
// error strings for the JSON parser
#define JSONERR_OK QT_TRANSLATE_NOOP("QJsonParseError", "no error occurred")
#define JSONERR_UNTERM_OBJ QT_TRANSLATE_NOOP("QJsonParseError", "unterminated object")
#define JSONERR_MISS_NSEP QT_TRANSLATE_NOOP("QJsonParseError", "missing name separator")
#define JSONERR_UNTERM_AR QT_TRANSLATE_NOOP("QJsonParseError", "unterminated array")
#define JSONERR_MISS_VSEP QT_TRANSLATE_NOOP("QJsonParseError", "missing value separator")
#define JSONERR_ILLEGAL_VAL QT_TRANSLATE_NOOP("QJsonParseError", "illegal value")
#define JSONERR_END_OF_NUM QT_TRANSLATE_NOOP("QJsonParseError", "invalid termination by number")
#define JSONERR_ILLEGAL_NUM QT_TRANSLATE_NOOP("QJsonParseError", "illegal number")
#define JSONERR_STR_ESC_SEQ QT_TRANSLATE_NOOP("QJsonParseError", "invalid escape sequence")
#define JSONERR_STR_UTF8 QT_TRANSLATE_NOOP("QJsonParseError", "invalid UTF8 string")
#define JSONERR_UTERM_STR QT_TRANSLATE_NOOP("QJsonParseError", "unterminated string")
#define JSONERR_MISS_OBJ QT_TRANSLATE_NOOP("QJsonParseError", "object is missing after a comma")
/*!
\class QJsonParseError
\ingroup json
\reentrant
\since 5.0
\brief The QJsonParseError class is used to report errors during JSON parsing.
*/
/*!
Returns the human-readable message appropriate to the reported JSON parsing error.
*/
QString QJsonParseError::errorString() const
{
const char *sz = "";
switch (error) {
case NoError:
sz = JSONERR_OK;
break;
case UnterminatedObject:
sz = JSONERR_UNTERM_OBJ;
break;
case MissingNameSeparator:
sz = JSONERR_MISS_NSEP;
break;
case UnterminatedArray:
sz = JSONERR_UNTERM_AR;
break;
case MissingValueSeparator:
sz = JSONERR_MISS_VSEP;
break;
case IllegalValue:
sz = JSONERR_ILLEGAL_VAL;
break;
case TerminationByNumber:
sz = JSONERR_END_OF_NUM;
break;
case IllegalNumber:
sz = JSONERR_ILLEGAL_NUM;
break;
case IllegalEscapeSequence:
sz = JSONERR_STR_ESC_SEQ;
break;
case IllegalUTF8String:
sz = JSONERR_STR_UTF8;
break;
case UnterminatedString:
sz = JSONERR_UTERM_STR;
break;
case MissingObject:
sz = JSONERR_MISS_OBJ;
break;
}
#ifndef QT_BOOTSTRAPPED
return QCoreApplication::translate("QJsonParseError", sz);
#else
return QLatin1String(sz);
#endif
}
using namespace QJsonPrivate;
Parser::Parser(const char *json, int length)
@ -524,7 +601,7 @@ bool Parser::parseNumber(QJsonPrivate::Value *val, int baseOffset)
}
if (json >= end) {
lastError = QJsonParseError::EndOfNumber;
lastError = QJsonParseError::TerminationByNumber;
return false;
}
@ -717,12 +794,12 @@ bool Parser::parseString(bool *latin1)
break;
else if (*json == '\\') {
if (!scanEscapeSequence(json, end, &ch)) {
lastError = QJsonParseError::StringEscapeSequence;
lastError = QJsonParseError::IllegalEscapeSequence;
return false;
}
} else {
if (!scanUtf8Char(json, end, &ch)) {
lastError = QJsonParseError::StringUTF8Scan;
lastError = QJsonParseError::IllegalUTF8String;
return false;
}
}
@ -737,14 +814,14 @@ bool Parser::parseString(bool *latin1)
++json;
DEBUG << "end of string";
if (json >= end) {
lastError = QJsonParseError::EndOfString;
lastError = QJsonParseError::UnterminatedString;
return false;
}
// no unicode string, we are done
if (*latin1) {
// write string length
*(QJsonPrivate::qle_ushort *)(data + stringPos) = current - outStart - sizeof(ushort);
*(QJsonPrivate::qle_ushort *)(data + stringPos) = ushort(current - outStart - sizeof(ushort));
int pos = reserveSpace((4 - current) & 3);
while (pos & 3)
data[pos++] = 0;
@ -764,12 +841,12 @@ bool Parser::parseString(bool *latin1)
break;
else if (*json == '\\') {
if (!scanEscapeSequence(json, end, &ch)) {
lastError = QJsonParseError::StringEscapeSequence;
lastError = QJsonParseError::IllegalEscapeSequence;
return false;
}
} else {
if (!scanUtf8Char(json, end, &ch)) {
lastError = QJsonParseError::StringUTF8Scan;
lastError = QJsonParseError::IllegalUTF8String;
return false;
}
}
@ -785,7 +862,7 @@ bool Parser::parseString(bool *latin1)
++json;
if (json >= end) {
lastError = QJsonParseError::EndOfString;
lastError = QJsonParseError::UnterminatedString;
return false;
}

View File

@ -337,14 +337,37 @@ void QAbstractEventDispatcher::closingDown()
{ }
/*!
\typedef QAbstractEventDispatcher::TimerInfo
\class QAbstractEventDispatcher::TimerInfo
Typedef for QPair<int, int>. The first component of
the pair is the timer ID; the second component is
the interval.
This struct represents information about a timer:
\l{QAbstractEventDispatcher::TimerInfo::timerId}{timerId},
\l{QAbstractEventDispatcher::TimerInfo::interval}{interval}, and
\l{QAbstractEventDispatcher::TimerInfo::timerType}{timerType}.
\sa registeredTimers()
*/
/*! \fn QAbstractEventDispatcher::TimerInfo::TimerInfo(int timerId, int interval, Qt::TimerType timerType)
Constructs a TimerInfo struct with the given \a timerId, \a interval, and
\a timerType.
*/
/*!
\variable QAbstractEventDispatcher::TimerInfo::timerId
The timer's unique id.
*/
/*!
\variable QAbstractEventDispatcher::TimerInfo::interval
The timer's interval.
*/
/*!
\variable QAbstractEventDispatcher::TimerInfo::timerType
The timer's type
\sa Qt::TimerType
*/
/*!
\typedef QAbstractEventDispatcher::EventFilter

View File

@ -1950,7 +1950,9 @@ QString QCoreApplication::organizationDomain()
using the empty constructor. This saves having to repeat this
information each time a QSettings object is created.
\sa organizationName organizationDomain applicationVersion
If not set, the application name defaults to the executable name (since 5.0).
\sa organizationName organizationDomain applicationVersion applicationFilePath
*/
void QCoreApplication::setApplicationName(const QString &application)
{
@ -1958,6 +1960,15 @@ void QCoreApplication::setApplicationName(const QString &application)
}
QString QCoreApplication::applicationName()
{
QString appname = coreappdata()->application;
if (appname.isEmpty() && QCoreApplication::self)
appname = QCoreApplication::self->d_func()->appName();
return appname;
}
// Exported for QDesktopServices (Qt4 behavior compatibility)
Q_CORE_EXPORT QString qt_applicationName_noFallback()
{
return coreappdata()->application;
}

View File

@ -109,7 +109,7 @@ Q_CORE_EXPORT QString qAppFileName() // get application file name
size = MAX_PATH * i;
b = reinterpret_cast<wchar_t *>(realloc(b, (size + 1) * sizeof(wchar_t)));
if (b)
v = GetModuleFileName(NULL, b, size);
v = GetModuleFileName(NULL, b, DWORD(size));
} while (b && v == size);
if (b)

View File

@ -141,6 +141,13 @@ template <typename T1, typename T2>
inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {}
#endif // QT_NO_QOBJECT_CHECK
#if defined(Q_CC_INTEL)
// Cannot redefine the visibility of a method in an exported class
# define Q_DECL_HIDDEN_STATIC_METACALL
#else
# define Q_DECL_HIDDEN_STATIC_METACALL Q_DECL_HIDDEN
#endif
/* tmake ignore Q_OBJECT */
#define Q_OBJECT \
public: \
@ -152,7 +159,7 @@ public: \
virtual int qt_metacall(QMetaObject::Call, int, void **); \
private: \
Q_DECL_HIDDEN static const QMetaObjectExtraData staticMetaObjectExtraData; \
Q_DECL_HIDDEN static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);
/* tmake ignore Q_OBJECT */
#define Q_OBJECT_FAKE Q_OBJECT

View File

@ -1544,7 +1544,6 @@ void QVariant::detach()
\internal
*/
// ### Qt 5: change typeName()(and froends= to return a QString. Suggestion from Harald.
/*!
Returns the name of the type stored in the variant. The returned
strings describe the C++ datatype used to store the data: for

View File

@ -491,6 +491,7 @@ public:
void delegate(const T*)
{
Filtered<T> streamIt(m_debugStream, m_d);
Q_UNUSED(streamIt);
}
void delegate(const QMetaTypeSwitcher::NotBuiltinType*)

View File

@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QWinEventNotifier
\since 5.0
\brief The QWinEventNotifier class provides support for the Windows Wait functions.
The QWinEventNotifier class makes it possible to use the wait

View File

@ -430,7 +430,6 @@ QMimeType QMimeDatabase::mimeTypeForFile(const QString &fileName, MatchMode mode
}
/*!
\fn QMimeType QMimeDatabase::findMimeTypesByFileName(const QString &fileName) const;
Returns the MIME types for the file name \a fileName.
If the file name doesn't match any known pattern, an empty list is returned.

View File

@ -39,12 +39,10 @@
**
****************************************************************************/
#ifndef QMIMEDATABASE_H
#define QMIMEDATABASE_H
#include "qmimetype.h"
#include <QtCore/qmimetype.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE

View File

@ -39,7 +39,6 @@
**
****************************************************************************/
#ifndef QMIMEDATABASE_P_H
#define QMIMEDATABASE_P_H

View File

@ -267,7 +267,7 @@ QMimeMagicRule::QMimeMagicRule(QMimeMagicRule::Type theType,
d->mask = QByteArray::fromHex(QByteArray::fromRawData(d->mask.constData() + 2, d->mask.size() - 2));
Q_ASSERT(d->mask.size() == d->pattern.size());
} else {
d->mask.fill(static_cast<char>(0xff), d->pattern.size());
d->mask.fill(char(-1), d->pattern.size());
}
d->mask.squeeze();
d->matchFunction = matchString;

View File

@ -39,7 +39,6 @@
**
****************************************************************************/
#ifndef QMIMEMAGICRULE_P_H
#define QMIMEMAGICRULE_P_H

View File

@ -39,7 +39,6 @@
**
****************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "qmimemagicrulematcher_p.h"

View File

@ -39,7 +39,6 @@
**
****************************************************************************/
#ifndef QMIMEMAGICRULEMATCHER_P_H
#define QMIMEMAGICRULEMATCHER_P_H

View File

@ -39,7 +39,6 @@
**
****************************************************************************/
#include "qmimetype.h"
#include "qmimetype_p.h"

View File

@ -39,7 +39,6 @@
**
****************************************************************************/
#ifndef QMIMETYPE_H
#define QMIMETYPE_H

View File

@ -39,7 +39,6 @@
**
****************************************************************************/
#ifndef QMIMETYPE_P_H
#define QMIMETYPE_P_H

View File

@ -39,7 +39,6 @@
**
****************************************************************************/
#define QT_NO_CAST_FROM_ASCII
#include "qmimetypeparser_p.h"
@ -93,9 +92,9 @@ static const char matchMaskAttributeC[] = "mask";
\sa QMimeTypeParser
*/
/*!
\class QMimeTypeParserBase
\internal
\brief The QMimeTypeParserBase class parses for a sequence of <mime-type> in a generic way.
Calls abstract handler function process for QMimeType it finds.

View File

@ -188,7 +188,8 @@ void QFactoryLoader::update()
}
if (!metaDataOk) {
library->unload();
if (library->compatPlugin)
library->unload();
library->release();
continue;
}

View File

@ -84,6 +84,13 @@ public:
Sha1 = 5 // 0 1 0 1
};
#ifdef Q_COMPILER_INITIALIZER_LISTS // UNIFORM_INITIALIZATION
Q_DECL_CONSTEXPR QUuid()
: data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8)
: data1(l), data2(w1), data3(w2), data4{b1, b2, b3, b4, b5, b6, b7, b8} {}
#else
QUuid()
{
data1 = 0;
@ -106,6 +113,8 @@ public:
data4[6] = b7;
data4[7] = b8;
}
#endif
#ifndef QT_NO_QUUID_STRING
QUuid(const QString &);
QUuid(const char *);
@ -142,6 +151,12 @@ public:
#if defined(Q_OS_WIN)
// On Windows we have a type GUID that is used by the platform API, so we
// provide convenience operators to cast from and to this type.
#ifdef Q_COMPILER_INITIALIZER_LISTS // UNIFORM_INITIALIZATION
Q_DECL_CONSTEXPR QUuid(const GUID &guid)
: data1(guid.Data1), data2(guid.Data2), data3(guid.Data3),
data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]} {}
#else
QUuid(const GUID &guid)
{
data1 = guid.Data1;
@ -150,6 +165,7 @@ public:
for(int i = 0; i < 8; i++)
data4[i] = guid.Data4[i];
}
#endif
QUuid &operator=(const GUID &guid)
{

View File

@ -90,7 +90,7 @@
# endif
#endif
#if defined(Q_OS_LINUX)
#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
#include <sys/prctl.h>
#endif
@ -110,7 +110,8 @@ QT_BEGIN_NAMESPACE
enum { ThreadPriorityResetFlag = 0x80000000 };
#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL))
#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_LINUXBASE)
/* LSB doesn't have __thread, https://lsbbugs.linuxfoundation.org/show_bug.cgi?id=993 */
#define HAVE_TLS
#endif
#if defined(Q_CC_XLC) || defined (Q_CC_SUN)
@ -294,7 +295,7 @@ void *QThreadPrivate::start(void *arg)
if (objectName.isEmpty())
objectName = thr->metaObject()->className();
#if defined(Q_OS_LINUX)
#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
prctl(PR_SET_NAME, (unsigned long)objectName.constData(), 0, 0, 0);
#elif defined(Q_OS_MAC)
pthread_setname_np(objectName.constData());

View File

@ -238,6 +238,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID)
QThread *thread = data->thread;
Q_ASSERT(thread);
QThreadPrivate *thread_p = static_cast<QThreadPrivate *>(QObjectPrivate::get(thread));
Q_UNUSED(thread_p)
Q_ASSERT(!thread_p->finished);
thread_p->finish(thread);
}

View File

@ -63,8 +63,8 @@ public:
QWaitCondition();
~QWaitCondition();
bool wait(QMutex *mutex, unsigned long time = ULONG_MAX);
bool wait(QReadWriteLock *readWriteLock, unsigned long time = ULONG_MAX);
bool wait(QMutex *lockedMutex, unsigned long time = ULONG_MAX);
bool wait(QReadWriteLock *lockedReadWriteLock, unsigned long time = ULONG_MAX);
void wakeOne();
void wakeAll();

View File

@ -119,13 +119,13 @@
*/
/*!
\fn bool QWaitCondition::wait(QMutex *mutex, unsigned long time)
\fn bool QWaitCondition::wait(QMutex *lockedMutex, unsigned long time)
Releases the locked \a mutex and waits on the wait condition. The
\a mutex must be initially locked by the calling thread. If \a
mutex is not in a locked state, this function returns
immediately. If \a mutex is a recursive mutex, this function
returns immediately. The \a mutex will be unlocked, and the
Releases the \a lockedMutex and waits on the wait condition. The
\a lockedMutex must be initially locked by the calling thread. If \a
lockedMutex is not in a locked state, this function returns
immediately. If \a lockedMutex is a recursive mutex, this function
returns immediately. The \a lockedMutex will be unlocked, and the
calling thread will block until either of these conditions is met:
\list
@ -137,7 +137,7 @@
wait timed out.
\endlist
The mutex will be returned to the same locked state. This
The \a lockedMutex will be returned to the same locked state. This
function is provided to allow the atomic transition from the
locked state to the wait state.
@ -145,15 +145,15 @@
*/
/*!
\fn bool QWaitCondition::wait(QReadWriteLock *readWriteLock, unsigned long time)
\fn bool QWaitCondition::wait(QReadWriteLock *lockedReadWriteLock, unsigned long time)
\since 4.4
Releases the locked \a readWriteLock and waits on the wait
condition. The \a readWriteLock must be initially locked by the
calling thread. If \a readWriteLock is not in a locked state, this
function returns immediately. The \a readWriteLock must not be
Releases the \a lockedReadWriteLock and waits on the wait
condition. The \a lockedReadWriteLock must be initially locked by the
calling thread. If \a lockedReadWriteLock is not in a locked state, this
function returns immediately. The \a lockedReadWriteLock must not be
locked recursively, otherwise this function will not release the
lock properly. The \a readWriteLock will be unlocked, and the
lock properly. The \a lockedReadWriteLock will be unlocked, and the
calling thread will block until either of these conditions is met:
\list
@ -165,7 +165,7 @@
wait timed out.
\endlist
The \a readWriteLock will be returned to the same locked
The \a lcokedReadWriteLock will be returned to the same locked
state. This function is provided to allow the atomic transition
from the locked state to the wait state.

View File

@ -72,7 +72,6 @@ public:
inline int size() const { return (d.size() << 3) - *d.constData(); }
inline int count() const { return (d.size() << 3) - *d.constData(); }
int count(bool on) const;
// ### Qt 5: Store the number of set bits separately
inline bool isEmpty() const { return d.isEmpty(); }
inline bool isNull() const { return d.isNull(); }

View File

@ -150,8 +150,8 @@ qint64 QElapsedTimer::msecsSinceReference() const
/*!
Returns the number of milliseconds between this QElapsedTimer and \a
other. If \a other was started before this object, the returned value
will be positive. If it was started later, the returned value will be
negative.
will be negative. If it was started later, the returned value will be
positive.
The return value is undefined if this object or \a other were invalidated.
@ -166,7 +166,7 @@ qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const
/*!
Returns the number of seconds between this QElapsedTimer and \a other. If
\a other was started before this object, the returned value will be
positive. If it was started later, the returned value will be negative.
negative. If it was started later, the returned value will be positive.
The return value is undefined if this object or \a other were invalidated.

View File

@ -2153,30 +2153,30 @@ QDebug operator<<(QDebug debug, const QRegularExpression &re)
*/
QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOptions)
{
QStringList flags;
QByteArray flags;
if (patternOptions == QRegularExpression::NoPatternOption) {
flags << QLatin1String("NoPatternOption");
flags = "NoPatternOption";
} else {
flags.reserve(200); // worst case...
if (patternOptions & QRegularExpression::CaseInsensitiveOption)
flags << QLatin1String("CaseInsensitiveOption");
flags.append("CaseInsensitiveOption|");
if (patternOptions & QRegularExpression::DotMatchesEverythingOption)
flags << QLatin1String("DotMatchesEverythingOption");
flags.append("DotMatchesEverythingOption|");
if (patternOptions & QRegularExpression::MultilineOption)
flags << QLatin1String("MultilineOption");
flags.append("MultilineOption|");
if (patternOptions & QRegularExpression::ExtendedPatternSyntaxOption)
flags << QLatin1String("ExtendedPatternSyntaxOption");
flags.append("ExtendedPatternSyntaxOption|");
if (patternOptions & QRegularExpression::InvertedGreedinessOption)
flags << QLatin1String("InvertedGreedinessOption");
flags.append("InvertedGreedinessOption|");
if (patternOptions & QRegularExpression::DontCaptureOption)
flags << QLatin1String("DontCaptureOption");
flags.append("DontCaptureOption|");
if (patternOptions & QRegularExpression::UseUnicodePropertiesOption)
flags << QLatin1String("UseUnicodePropertiesOption");
flags.append("UseUnicodePropertiesOption|");
flags.chop(1);
}
debug.nospace() << "QRegularExpression::PatternOptions("
<< qPrintable(flags.join(QLatin1String("|")))
<< ")";
debug.nospace() << "QRegularExpression::PatternOptions(" << flags << ")";
return debug.space();
}

View File

@ -588,16 +588,6 @@
\sa subtract(), operator-=(), operator|(), operator&()
*/
/*!
\fn QSet<T> QSet::operator-(const QSet<T> &other)
\fn QSet<T> QSet::operator|(const QSet<T> &other)
\fn QSet<T> QSet::operator+(const QSet<T> &other)
\fn QSet<T> QSet::operator&(const QSet<T> &other)
\internal
These will go away in Qt 5.
*/
/*!
\class QSet::iterator
\since 4.2

View File

@ -5349,7 +5349,7 @@ QString QString::toUpper() const
return *this;
}
// ### Qt 5: Consider whether this function shouldn't be removed See task 202871.
// ### Qt 6: Consider whether this function shouldn't be removed See task 202871.
/*!
Safely builds a formatted string from the format string \a cformat
and an arbitrary list of arguments.

View File

@ -650,6 +650,7 @@ void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
Q_ASSERT(object);
QAccessibleEvent ev(object, reason);
ev.setChild(child);
updateAccessibility(&ev);
}

View File

@ -51,6 +51,7 @@
#include "qvariant.h"
#include "qimagepixmapcleanuphooks_p.h"
#include "qplatformintegration_qpa.h"
#include <private/qguiapplication_p.h>
#include <ctype.h>
#include <stdlib.h>
#include <limits.h>
@ -3303,10 +3304,10 @@ extern const uchar *qt_pow_rgb_gamma();
void qGamma_correct_back_to_linear_cs(QImage *image)
{
const uchar *gamma = qt_pow_rgb_gamma();
if (!gamma)
const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables();
if (!tables)
return;
const uchar *gamma = tables->qt_pow_rgb_gamma;
// gamma correct the pixels back to linear color space...
int h = image->height();
int w = image->width();

View File

@ -125,8 +125,14 @@ void QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(QPlatformPi
void QImagePixmapCleanupHooks::executeImageHooks(qint64 key)
{
for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->imageHooks.count(); ++i)
qt_image_and_pixmap_cleanup_hooks()->imageHooks[i](key);
QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
// the global destructor for the pixmap and image hooks might have
// been called already if the app is "leaking" global
// pixmaps/images
if (!h)
return;
for (int i = 0; i < h->imageHooks.count(); ++i)
h->imageHooks[i](key);
if (qt_image_cleanup_hook_64)
qt_image_cleanup_hook_64(key);

View File

@ -15,6 +15,7 @@ HEADERS += \
kernel/qplatformscreen_qpa.h \
kernel/qplatformscreen_qpa_p.h \
kernel/qplatforminputcontext_qpa.h \
kernel/qplatforminputcontext_qpa_p.h \
kernel/qplatformintegrationfactory_qpa_p.h \
kernel/qplatformintegrationplugin_qpa.h \
kernel/qplatformtheme_qpa.h\

View File

@ -205,6 +205,13 @@ QT_BEGIN_NAMESPACE
You can call QWidget::mapFromGlobal() to translate it to widget
coordinates.
\note The position is queried from the windowing system. If mouse events are generated
via other means (e.g., via QWindowSystemInterface in a unit test), those fake mouse
moves will not be reflected in the returned value.
\note On platforms where there is no windowing system or cursors are not available, the returned
position is based on the mouse move events generated via QWindowSystemInterface.
\sa setPos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal(), QGuiApplication::primaryScreen()
*/
@ -218,6 +225,16 @@ QT_BEGIN_NAMESPACE
You can call QWidget::mapToGlobal() to translate widget
coordinates to global screen coordinates.
\note Calling this function results in changing the cursor position through the windowing
system. The windowing system will typically respond by sending mouse events to the application's
window. This means that the usage of this function should be avoided in unit tests and
everywhere where fake mouse events are being injected via QWindowSystemInterface because the
windowing system's mouse state (with regards to buttons for example) may not match the state in
the application-generated events.
\note On platforms where there is no windowing system or cursors are not available, this
function may do nothing.
\sa pos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal()
*/

View File

@ -52,6 +52,7 @@
#include "qplatformintegration_qpa.h"
#include <QtCore/QAbstractEventDispatcher>
#include <QtCore/QVariant>
#include <QtCore/private/qcoreapplication_p.h>
#include <QtCore/private/qabstracteventdispatcher_p.h>
#include <QtCore/qmutex.h>
@ -61,13 +62,15 @@
#include <qpalette.h>
#include <qscreen.h>
#include <private/qscreen_p.h>
#include <private/qdrawhelper_p.h>
#include <QtGui/QPlatformIntegration>
#include <QtGui/QGenericPluginFactory>
#include <QtGui/qstylehints.h>
#include <QtGui/qinputpanel.h>
#include <QtGui/qplatformtheme_qpa.h>
#include <QtGui/qplatforminputcontext_qpa.h>
#include <private/qplatforminputcontext_qpa_p.h>
#include <QWindowSystemInterface>
#include "private/qwindowsysteminterface_qpa_p.h"
@ -142,6 +145,8 @@ static QBasicMutex applicationFontMutex;
QFont *QGuiApplicationPrivate::app_font = 0;
bool QGuiApplicationPrivate::obey_desktop_settings = true;
static qreal fontSmoothingGamma = 1.7;
extern void qRegisterGuiVariant();
extern void qInitDrawhelperAsm();
extern void qInitImageConversions();
@ -575,13 +580,13 @@ static void init_platform(const QString &pluginArgument, const QString &platform
nativeInterface->setProperty(name.constData(), value);
}
}
fontSmoothingGamma = QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FontSmoothingGamma).toReal();
}
static void init_plugins(const QList<QByteArray> &pluginList)
{
for (int i = 0; i < pluginList.count(); ++i) {
QByteArray pluginSpec = pluginList.at(i);
qDebug() << "init_plugins" << i << pluginSpec;
int colonPos = pluginSpec.indexOf(':');
QObject *plugin;
if (colonPos < 0)
@ -589,7 +594,6 @@ static void init_plugins(const QList<QByteArray> &pluginList)
else
plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)),
QLatin1String(pluginSpec.mid(colonPos+1)));
qDebug() << " created" << plugin;
if (plugin)
QGuiApplicationPrivate::generic_plugin_list.append(plugin);
}
@ -597,12 +601,10 @@ static void init_plugins(const QList<QByteArray> &pluginList)
void QGuiApplicationPrivate::createPlatformIntegration()
{
Q_Q(QGuiApplication);
// Use the Qt menus by default. Platform plugins that
// want to enable a native menu implementation can clear
// this flag.
q->setAttribute(Qt::AA_DontUseNativeMenuBar, true);
QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);
// Load the platform integration
QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
@ -706,6 +708,10 @@ void QGuiApplicationPrivate::init()
argc = j;
}
// Load environment exported generic plugins
foreach (const QByteArray &plugin, qgetenv("QT_QPA_GENERIC_PLUGINS").split(','))
pluginList << plugin;
if (platform_integration == 0)
createPlatformIntegration();
@ -761,6 +767,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
delete platform_theme;
delete platform_integration;
platform_integration = 0;
delete m_gammaTables.load();
}
#if 0
@ -1168,7 +1175,7 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
QFocusEvent focusOut(QEvent::FocusOut);
QCoreApplication::sendSpontaneousEvent(previous, &focusOut);
QObject::disconnect(previous, SIGNAL(focusObjectChanged(QObject*)),
qApp, SIGNAL(focusObjectChanged(QObject*)));
qApp, SLOT(q_updateFocusObject(QObject*)));
} else {
QEvent appActivate(QEvent::ApplicationActivate);
qApp->sendSpontaneousEvent(qApp, &appActivate);
@ -1178,17 +1185,18 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
QFocusEvent focusIn(QEvent::FocusIn);
QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
QObject::connect(QGuiApplicationPrivate::focus_window, SIGNAL(focusObjectChanged(QObject*)),
qApp, SIGNAL(focusObjectChanged(QObject*)));
qApp, SLOT(q_updateFocusObject(QObject*)));
} else {
QEvent appActivate(QEvent::ApplicationDeactivate);
qApp->sendSpontaneousEvent(qApp, &appActivate);
}
if (self)
if (self) {
self->notifyActiveWindowChange(previous);
if (previousFocusObject != qApp->focusObject())
emit qApp->focusObjectChanged(qApp->focusObject());
if (previousFocusObject != qApp->focusObject())
self->q_updateFocusObject(qApp->focusObject());
}
}
void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse)
@ -2160,4 +2168,36 @@ void QGuiApplicationPrivate::notifyThemeChanged()
}
}
const QDrawHelperGammaTables *QGuiApplicationPrivate::gammaTables()
{
QDrawHelperGammaTables *result = m_gammaTables.load();
if (!result){
QDrawHelperGammaTables *tables = new QDrawHelperGammaTables(fontSmoothingGamma);
if (!m_gammaTables.testAndSetRelease(0, tables))
delete tables;
result = m_gammaTables.load();
}
return result;
}
void QGuiApplicationPrivate::q_updateFocusObject(QObject *object)
{
Q_Q(QGuiApplication);
bool enabled = false;
if (object) {
QInputMethodQueryEvent query(Qt::ImEnabled);
QGuiApplication::sendEvent(object, &query);
enabled = query.value(Qt::ImEnabled).toBool();
}
QPlatformInputContextPrivate::setInputMethodAccepted(enabled);
QPlatformInputContext *inputContext = platformIntegration()->inputContext();
if (inputContext)
inputContext->setFocusObject(object);
emit q->focusObjectChanged(object);
}
#include "moc_qguiapplication.cpp"
QT_END_NAMESPACE

View File

@ -155,6 +155,8 @@ private:
Q_DISABLE_COPY(QGuiApplication)
Q_DECLARE_PRIVATE(QGuiApplication)
Q_PRIVATE_SLOT(d_func(), void q_updateFocusObject(QObject *object))
#ifndef QT_NO_GESTURES
friend class QGestureManager;
#endif

View File

@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
class QPlatformIntegration;
class QPlatformTheme;
struct QDrawHelperGammaTables;
class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate
{
@ -141,6 +142,8 @@ public:
QPixmap getPixmapCursor(Qt::CursorShape cshape);
void q_updateFocusObject(QObject *object);
static QGuiApplicationPrivate *instance() { return self; }
static QString *platform_name;
@ -200,6 +203,8 @@ public:
};
QHash<QWindow *, SynthesizedMouseData> synthesizedMousePoints;
const QDrawHelperGammaTables *gammaTables();
protected:
virtual void notifyThemeChanged();
@ -209,6 +214,7 @@ private:
static QGuiApplicationPrivate *self;
static QTouchDevice *m_fakeTouchDevice;
static int m_fakeMouseSourcePointId;
QAtomicPointer<QDrawHelperGammaTables> m_gammaTables;
};
Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);

View File

@ -43,6 +43,7 @@
#include <private/qinputmethod_p.h>
#include <qguiapplication.h>
#include <qtimer.h>
#include <private/qplatforminputcontext_qpa_p.h>
QT_BEGIN_NAMESPACE
@ -72,7 +73,7 @@ QInputMethod::~QInputMethod()
information like virtual keyboard visibility and keyboard dimensions.
Qt Quick also provides access to QInputMethod in QML through \l{QmlGlobalQtObject}{Qt global object}
as \c Qt.application.inputPanel property.
as \c Qt.inputMethod property.
*/
/*!
@ -295,8 +296,12 @@ void QInputMethod::update(Qt::InputMethodQueries queries)
{
Q_D(QInputMethod);
if (queries & Qt::ImEnabled)
d->q_checkFocusObject(qApp->focusObject());
if (queries & Qt::ImEnabled) {
QObject *focus = qApp->focusObject();
bool enabled = d->objectAcceptsInputMethod(focus);
setInputItem(enabled ? focus : 0);
QPlatformInputContextPrivate::setInputMethodAccepted(enabled);
}
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
@ -361,14 +366,20 @@ void QInputMethodPrivate::q_connectFocusObject()
void QInputMethodPrivate::q_checkFocusObject(QObject *object)
{
Q_Q(QInputMethod);
bool enabled = objectAcceptsInputMethod(object);
q->setInputItem(enabled ? object : 0);
}
bool QInputMethodPrivate::objectAcceptsInputMethod(QObject *object)
{
bool enabled = false;
if (object) {
QInputMethodQueryEvent query(Qt::ImEnabled);
QGuiApplication::sendEvent(object, &query);
enabled = query.value(Qt::ImEnabled).toBool();
}
q->setInputItem(enabled ? object : 0);
return enabled;
}
QT_END_NAMESPACE

View File

@ -71,6 +71,7 @@ public:
}
void q_connectFocusObject();
void q_checkFocusObject(QObject *object);
bool objectAcceptsInputMethod(QObject *object);
QTransform inputItemTransform;
QWeakPointer<QObject> inputItem;

View File

@ -86,12 +86,12 @@ public:
enum ColorRole { WindowText, Button, Light, Midlight, Dark, Mid,
Text, BrightText, ButtonText, Base, Window, Shadow,
Highlight, HighlightedText,
Link, LinkVisited, // ### Qt 5: remove
Link, LinkVisited,
AlternateBase,
NoRole, // ### Qt 5: value should be 0 or -1
NoRole,
ToolTipBase, ToolTipText,
NColorRoles = ToolTipText + 1,
Foreground = WindowText, Background = Window // ### Qt 5: remove
Foreground = WindowText, Background = Window
};
inline ColorGroup currentColorGroup() const { return static_cast<ColorGroup>(current_group); }

View File

@ -43,6 +43,7 @@
#include <qguiapplication.h>
#include <QRect>
#include "private/qkeymapper_p.h"
#include "private/qplatforminputcontext_qpa_p.h"
QT_BEGIN_NAMESPACE
@ -75,6 +76,7 @@ QT_BEGIN_NAMESPACE
\internal
*/
QPlatformInputContext::QPlatformInputContext()
: QObject(*(new QPlatformInputContextPrivate))
{
}
@ -228,5 +230,29 @@ void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDir
emit qApp->inputMethod()->inputDirectionChanged(newDirection);
}
/*!
This virtual method gets called to notify updated focus to \a object.
\warning Input methods must not call this function directly.
*/
void QPlatformInputContext::setFocusObject(QObject *object)
{
Q_UNUSED(object)
}
/*!
Returns true if current focus object supports input method events.
*/
bool QPlatformInputContext::inputMethodAccepted() const
{
return QPlatformInputContextPrivate::s_inputMethodAccepted;
}
bool QPlatformInputContextPrivate::s_inputMethodAccepted = false;
void QPlatformInputContextPrivate::setInputMethodAccepted(bool accepted)
{
QPlatformInputContextPrivate::s_inputMethodAccepted = accepted;
}
QT_END_NAMESPACE

View File

@ -48,13 +48,13 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QWindow;
class QMouseEvent;
class QPlatformInputContextPrivate;
class Q_GUI_EXPORT QPlatformInputContext : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QPlatformInputContext)
public:
QPlatformInputContext();
virtual ~QPlatformInputContext();
@ -81,6 +81,14 @@ public:
void emitLocaleChanged();
virtual Qt::LayoutDirection inputDirection() const;
void emitInputDirectionChanged(Qt::LayoutDirection newDirection);
virtual void setFocusObject(QObject *object);
bool inputMethodAccepted() const;
private:
friend class QGuiApplication;
friend class QGuiApplicationPrivate;
friend class QInputMethod;
};
QT_END_NAMESPACE

View File

@ -3,7 +3,7 @@
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@ -39,31 +39,29 @@
**
****************************************************************************/
#ifndef QTESTLITECURSOR_H
#define QTESTLITECURSOR_H
#ifndef QPLATFORMINPUTCONTEXT_P_H
#define QPLATFORMINPUTCONTEXT_P_H
#include <QtGui/QPlatformCursor>
#include <private/qobject_p.h>
#include "qxlibintegration.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QXlibCursor : public QPlatformCursor
class QPlatformInputContextPrivate: public QObjectPrivate
{
public:
QXlibCursor(QXlibScreen *screen);
QPlatformInputContextPrivate() {}
~QPlatformInputContextPrivate() {}
void changeCursor(QCursor * cursor, QWindow * widget);
private:
static void setInputMethodAccepted(bool accepted);
static bool inputMethodAccepted();
Cursor createCursorBitmap(QCursor * cursor);
Cursor createCursorShape(int cshape);
QXlibScreen *testLiteScreen() const { return m_screen; }
QMap<int, Cursor> cursorMap;
QXlibScreen *m_screen;
static bool s_inputMethodAccepted;
};
QT_END_NAMESPACE
#endif // QTESTLITECURSOR_H
QT_END_HEADER
#endif

View File

@ -247,6 +247,7 @@ QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphics
*/
QPaintEngine *QPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDevice) const
{
Q_UNUSED(paintDevice)
return 0;
}
@ -293,6 +294,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return false;
case PasswordMaskDelay:
return 0;
case FontSmoothingGamma:
return qreal(1.7);
}
return 0;

View File

@ -122,7 +122,8 @@ public:
StartDragTime,
KeyboardAutoRepeatRate,
ShowIsFullScreen,
PasswordMaskDelay
PasswordMaskDelay,
FontSmoothingGamma
};
virtual QVariant styleHint(StyleHint hint) const;

View File

@ -76,17 +76,18 @@ public:
const QVector<QImage> &items) = 0;
Q_INVOKABLE virtual void releaseItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) = 0;
virtual void serializeBuffer(void *bufferId, QByteArray *serializedData, int *fileDescriptor) const = 0;
virtual uint textureIdForBuffer(void *bufferId) = 0;
virtual void referenceBuffer(void *bufferId) = 0;
virtual bool dereferenceBuffer(void *bufferId) = 0;
virtual QSize sizeOfBuffer(void *bufferId) = 0;
virtual void *eglImageForBuffer(void *bufferId) = 0;
Q_SIGNALS:
void itemsMissing(const QByteArray &cacheId, const QVector<quint32> &itemIds);
void itemsAvailable(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize,
void itemsAvailable(const QByteArray &cacheId, void *bufferId,
const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer);
void itemsInvalidated(const QByteArray &cacheId, const QVector<quint32> &itemIds);
void itemsUpdated(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize,
void itemsUpdated(const QByteArray &cacheId, void *bufferId,
const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer);
};

View File

@ -101,4 +101,9 @@ int QStyleHints::passwordMaskDelay() const
return hint(QPlatformIntegration::PasswordMaskDelay).toInt();
}
qreal QStyleHints::fontSmoothingGamma() const
{
return hint(QPlatformIntegration::FontSmoothingGamma).toReal();
}
QT_END_NAMESPACE

View File

@ -63,6 +63,7 @@ public:
int cursorFlashTime() const;
bool showIsFullScreen() const;
int passwordMaskDelay() const;
qreal fontSmoothingGamma() const;
private:
friend class QGuiApplication;

View File

@ -375,6 +375,8 @@ bool QWindow::isTopLevel() const
Returns whether the window is modal.
A modal window prevents other windows from getting any input.
\sa QWindow::windowModality
*/
bool QWindow::isModal() const
{
@ -382,26 +384,37 @@ bool QWindow::isModal() const
return d->modality != Qt::NonModal;
}
/*!
Returns the window's modality.
/*! \property QWindow::windowModality
\brief the modality of the window
\sa setWindowModality()
A modal window prevents other windows from receiving input events. Qt
supports two types of modality: Qt::WindowModal and Qt::ApplicationModal.
By default, this property is Qt::NonModal
\sa Qt::WindowModality
*/
Qt::WindowModality QWindow::windowModality() const
{
Q_D(const QWindow);
return d->modality;
}
/*!
Sets the window's modality to \a windowModality.
*/
void QWindow::setWindowModality(Qt::WindowModality windowModality)
void QWindow::setWindowModality(Qt::WindowModality modality)
{
Q_D(QWindow);
d->modality = windowModality;
if (d->modality == modality)
return;
d->modality = modality;
emit windowModalityChanged(modality);
}
/*! \fn void QWindow::windowModalityChanged(Qt::WindowModality windowModality)
This signal is emitted when the Qwindow::windowModality property changes to \a windowModality.
*/
/*!
Sets the window's surface \a format.

View File

@ -85,6 +85,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_DECLARE_PRIVATE(QWindow)
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality NOTIFY windowModalityChanged)
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
@ -255,6 +256,7 @@ public Q_SLOTS:
Q_SIGNALS:
void backBufferReady();
void screenChanged(QScreen *screen);
void windowModalityChanged(Qt::WindowModality windowModality);
void xChanged(int arg);
void yChanged(int arg);

View File

@ -75,6 +75,7 @@ SOURCES += \
SOURCES += \
painting/qpaintengine_raster.cpp \
painting/qdrawhelper.cpp \
painting/qgammatables.cpp \
painting/qimagescale.cpp \
painting/qgrayraster.c \
painting/qpaintengine_blitter.cpp \

View File

@ -39,6 +39,18 @@
**
****************************************************************************/
#if defined(__OPTIMIZE__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) \
&& (__GNUC__ * 100 + __GNUC_MINOR__ >= 404)
// GCC 4.4 supports #pragma GCC optimize and #pragma GCC target
# pragma GCC optimize "O3"
# if defined(__i386__) && defined(__SSE2__) && !defined(__SSE2_MATH__)
# pragma GCC target "fpmath=sse"
# endif
#endif
#include <qstylehints.h>
#include <qguiapplication.h>
#include <qatomic.h>
#include <private/qdrawhelper_p.h>
#include <private/qpaintengine_raster_p.h>
#include <private/qpainter_p.h>
@ -51,6 +63,7 @@
#include <private/qdrawhelper_mips_dsp_p.h>
#endif
#include <private/qmath_p.h>
#include <private/qguiapplication_p.h>
#include <qmath.h>
QT_BEGIN_NAMESPACE
@ -5313,54 +5326,6 @@ inline static void qt_bitmapblit_quint16(QRasterBuffer *rasterBuffer,
map, mapWidth, mapHeight, mapStride);
}
struct QDrawHelperGammaTables
{
QDrawHelperGammaTables();
uchar qt_pow_rgb_gamma[256];
uchar qt_pow_rgb_invgamma[256];
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
uint qt_pow_gamma[256];
uchar qt_pow_invgamma[2048];
#endif
};
QDrawHelperGammaTables::QDrawHelperGammaTables()
{
qreal smoothing = qreal(1.7);
for (int i=0; i<256; ++i) {
qt_pow_rgb_gamma[i] = uchar(qRound(qPow(i / qreal(255.0), smoothing) * 255));
qt_pow_rgb_invgamma[i] = uchar(qRound(qPow(i / qreal(255.), 1 / smoothing) * 255));
}
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
const qreal gray_gamma = 2.31;
for (int i=0; i<256; ++i)
qt_pow_gamma[i] = uint(qRound(qPow(i / qreal(255.), gray_gamma) * 2047));
for (int i=0; i<2048; ++i)
qt_pow_invgamma[i] = uchar(qRound(qPow(i / qreal(2047.0), 1 / gray_gamma) * 255));
#endif
}
Q_GLOBAL_STATIC(QDrawHelperGammaTables, qt_gamma_tables);
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
const uint *qt_pow_gamma()
{
QDrawHelperGammaTables *tables = qt_gamma_tables();
return tables ? tables->qt_pow_gamma : 0;
}
#endif
const uchar *qt_pow_rgb_gamma()
{
QDrawHelperGammaTables *tables = qt_gamma_tables();
return tables ? tables->qt_pow_rgb_gamma : 0;
}
static void qt_alphamapblit_quint16(QRasterBuffer *rasterBuffer,
int x, int y, quint32 color,
const uchar *map,
@ -5473,7 +5438,7 @@ static void qt_alphamapblit_quint32(QRasterBuffer *rasterBuffer,
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32);
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
QDrawHelperGammaTables *tables = qt_gamma_tables();
const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables();
if (!tables)
return;
@ -5570,7 +5535,7 @@ static void qt_alphargbblit_quint32(QRasterBuffer *rasterBuffer,
int sb = qBlue(color);
int sa = qAlpha(color);
QDrawHelperGammaTables *tables = qt_gamma_tables();
const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables();
if (!tables)
return;

View File

@ -328,6 +328,18 @@ struct QSpanData
void adjustSpanMethods();
};
struct QDrawHelperGammaTables
{
explicit QDrawHelperGammaTables(qreal smoothing);
void refresh(qreal smoothing);
uchar qt_pow_rgb_gamma[256];
uchar qt_pow_rgb_invgamma[256];
uint qt_pow_gamma[256];
uchar qt_pow_invgamma[2048];
};
static inline uint qt_gradient_clamp(const QGradientData *data, int ipos)
{
if (ipos < 0 || ipos >= GRADIENT_STOPTABLE_SIZE) {

View File

@ -3,7 +3,7 @@
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the plugins of the Qt Toolkit.
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@ -39,36 +39,28 @@
**
****************************************************************************/
#include <QtGui/QPlatformIntegrationPlugin>
#include "qxlibintegration.h"
#include <private/qdrawhelper_p.h>
QT_BEGIN_NAMESPACE
class QXlibIntegrationPlugin : public QPlatformIntegrationPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPlatformIntegrationFactoryInterface" FILE "xlib.json")
public:
QStringList keys() const;
QPlatformIntegration *create(const QString&, const QStringList&);
};
QStringList QXlibIntegrationPlugin::keys() const
QDrawHelperGammaTables::QDrawHelperGammaTables(qreal smoothing)
{
QStringList list;
list << "xlib";
return list;
const qreal gray_gamma = 2.31;
for (int i=0; i<256; ++i)
qt_pow_gamma[i] = uint(qRound(qPow(i / qreal(255.), gray_gamma) * 2047));
for (int i=0; i<2048; ++i)
qt_pow_invgamma[i] = uchar(qRound(qPow(i / qreal(2047.0), 1 / gray_gamma) * 255));
refresh(smoothing);
}
QPlatformIntegration* QXlibIntegrationPlugin::create(const QString& system, const QStringList& paramList)
void QDrawHelperGammaTables::refresh(qreal smoothing)
{
Q_UNUSED(paramList);
if (system.toLower() == "xlib")
return new QXlibIntegration;
return 0;
for (int i=0; i<256; ++i) {
qt_pow_rgb_gamma[i] = uchar(qRound(qPow(i / qreal(255.0), smoothing) * 255));
qt_pow_rgb_invgamma[i] = uchar(qRound(qPow(i / qreal(255.), 1 / smoothing) * 255));
}
}
QT_END_NAMESPACE
#include "main.moc"

View File

@ -737,7 +737,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen)
s->flags.fast_pen = pen_style > Qt::NoPen
&& s->penData.blend
&& ((pen.isCosmetic() && penWidth <= 1)
|| (s->flags.tx_noshear && penWidth * s->txscale <= 1));
|| (!pen.isCosmetic() && s->flags.tx_noshear && penWidth * s->txscale <= 1));
s->flags.non_complex_pen = qpen_capStyle(s->lastPen) <= Qt::SquareCap && s->flags.tx_noshear;

View File

@ -194,7 +194,7 @@ public:
void clip(const QVectorPath &path, Qt::ClipOperation op);
void clip(const QRect &rect, Qt::ClipOperation op);
void clip(const QRegion &region, Qt::ClipOperation op);
inline const QClipData *clip() const;
inline const QClipData *clipData() const;
void drawStaticTextItem(QStaticTextItem *textItem);
virtual bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions,
@ -492,7 +492,7 @@ inline const QClipData *QRasterPaintEnginePrivate::clip() const {
return baseClip.data();
}
inline const QClipData *QRasterPaintEngine::clip() const {
inline const QClipData *QRasterPaintEngine::clipData() const {
Q_D(const QRasterPaintEngine);
if (state() && state()->clip && state()->clip->enabled)
return state()->clip;

View File

@ -7248,6 +7248,7 @@ void QPainter::setRedirected(const QPaintDevice *device,
const QPoint &offset)
{
Q_ASSERT(device != 0);
Q_UNUSED(device)
Q_UNUSED(replacement)
Q_UNUSED(offset)
qWarning("QPainter::setRedirected(): ignoring call to deprecated function, use QWidget::render() instead");

Some files were not shown because too many files have changed in this diff Show More