Merge remote-tracking branch 'origin/stable' into dev

Conflicts:
	mkspecs/features/qt.prf
	src/plugins/platforms/xcb/qxcbwindow.h
	src/tools/qdoc/qdocindexfiles.cpp
	src/widgets/kernel/qwidget_qpa.cpp

Change-Id: I214f57b03bc2ff86cf3b7dfe2966168af93a5a67
This commit is contained in:
J-P Nurmi 2014-06-05 22:26:44 +02:00
commit 0fcce50af0
158 changed files with 2121 additions and 850 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@ -28,4 +28,14 @@
/*!
\example chat
\title D-Bus Chat Example
\ingroup examples-dbus
\brief Demonstrates communication among instances of an application.
\e Chat is a \l{Qt D-Bus} example which demonstrates a simple chat system
among instances of an application. Users connect and send message to
each other.
\image dbus-chat-example.png
\include examples-run.qdocinc
*/

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@ -28,4 +28,16 @@
/*!
\example complexpingpong
\title D-Bus Complex Ping Pong Example
\ingroup examples-dbus
\brief Demonstrates usage of the Qt D-Bus typesystem.
\e{Complex Ping Pong Example} demonstrates the use of \l{Qt D-Bus}
typesystem with QDBusVariant and QDBusReply. The example consists of the
main application \c complexping which starts the other application, \c
complexpong. Entering keywords such as \c hello and \c ping is handled by
complexpong and the reply is printed to the standard output.
\include examples-run.qdocinc
To run, execute the \c complexping application.
*/

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@ -28,4 +28,12 @@
/*!
\example listnames
\title D-Bus List Names Example
\ingroup examples-dbus
\brief Shows how to access the D-Bus bus daemon service.
\e{List Names} is a command-line example which shows how to
access the \l{Qt D-Bus} bus daemon service. The example prints various
information about the bus daemon service.
\include examples-run.qdocinc
*/

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@ -28,4 +28,21 @@
/*!
\example pingpong
\title D-Bus Ping Pong Example
\ingroup examples-dbus
\brief Demonstrates a simple message system using D-Bus.
\e{Ping Pong} is a command-line example that demonstrates the basics of
\l{Qt D-Bus}. A message is sent to another application and there is a
confirmation of the message.
\include examples-run.qdocinc
Run the \c pong application and run the \c ping application with the message
as the argument.
\badcode
$ ./pong &
$ ./ping Hello
Reply was: ping("Hello") got called
\endcode
*/

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@ -28,9 +28,13 @@
/*!
\example remotecontrolledcar
\title D-Bus Remote Controlled Car Example
\ingroup examples-dbus
\brief Shows how to use Qt D-Bus to control a car from another application.
The Remote Controlled Car example shows how to use D-Bus to control one
application using another.
The Remote Controlled Car example shows how to use \l{Qt D-Bus} to control
one application from another.
\image remotecontrolledcar-car-example.png
\include examples-run.qdocinc
*/

View File

@ -2,6 +2,6 @@ TEMPLATE = subdirs
macx {
SUBDIRS = \
qmacnativewidget \
qmaccocoaviewcontainer \
qmacnativewidget
}

View File

@ -39,8 +39,8 @@
**
****************************************************************************/
#include <QtWidgets>
#include <Cocoa/Cocoa.h>
#include <QtWidgets>
#include <QMacCocoaViewContainer>
class WindowWidget : public QWidget

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1,5 +1,5 @@
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\" xmlns:v2=\"http://schemas.microsoft.com/appx/2013/manifest\">
<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\" xmlns:m2=\"http://schemas.microsoft.com/appx/2013/manifest\">
<Identity
Name=\"$${WINRT_MANIFEST.identity}\"
ProcessorArchitecture=\"$${WINRT_MANIFEST.architecture}\"
@ -22,20 +22,20 @@
Id=\"App\"
Executable=\"$${WINRT_MANIFEST.target}.exe\"
EntryPoint=\"$${WINRT_MANIFEST.target}.App\">
<v2:VisualElements
<m2:VisualElements
DisplayName=\"$${WINRT_MANIFEST.name}\"
Description=\"$${WINRT_MANIFEST.description}\"
BackgroundColor=\"$${WINRT_MANIFEST.background}\"
ForegroundText=\"$${WINRT_MANIFEST.foreground}\"
Square150x150Logo=\"$${WINRT_MANIFEST.logo_large}\"
Square30x30Logo=\"$${WINRT_MANIFEST.logo_small}\">
<v2:DefaultTile>
<v2:ShowNameOnTiles>
<v2:ShowOn Tile=\"square150x150Logo\" />
</v2:ShowNameOnTiles>
</v2:DefaultTile>
<v2:SplashScreen Image=\"$${WINRT_MANIFEST.logo_splash}\" />
</v2:VisualElements>
<m2:DefaultTile>
<m2:ShowNameOnTiles>
<m2:ShowOn Tile=\"square150x150Logo\" />
</m2:ShowNameOnTiles>
</m2:DefaultTile>
<m2:SplashScreen Image=\"$${WINRT_MANIFEST.logo_splash}\" />
</m2:VisualElements>
</Application>
</Applications>$${WINRT_MANIFEST.capabilities}$${WINRT_MANIFEST.dependencies}
</Package>

View File

@ -0,0 +1,45 @@
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\" xmlns:m3=\"http://schemas.microsoft.com/appx/2014/manifest\" xmlns:mp=\"http://schemas.microsoft.com/appx/2014/phone/manifest\">
<Identity
Name=\"$${WINRT_MANIFEST.identity}\"
ProcessorArchitecture=\"$${WINRT_MANIFEST.architecture}\"
Publisher=\"$${WINRT_MANIFEST.publisherid}\"
Version=\"$${WINRT_MANIFEST.version}\" />
<mp:PhoneIdentity
PhoneProductId=\"$${WINRT_MANIFEST.phone_product_id}\"
PhonePublisherId=\"$${WINRT_MANIFEST.phone_publisher_id}\" />
<Properties>
<DisplayName>$${WINRT_MANIFEST.name}</DisplayName>
<PublisherDisplayName>$${WINRT_MANIFEST.publisher}</PublisherDisplayName>
<Logo>$${WINRT_MANIFEST.logo_store}</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.3.1</OSMinVersion>
<OSMaxVersionTested>6.3.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language=\"en\" />
</Resources>
<Applications>
<Application
Id=\"App\"
Executable=\"$${WINRT_MANIFEST.target}.exe\"
EntryPoint=\"$${WINRT_MANIFEST.target}.App\">
<m3:VisualElements
DisplayName=\"$${WINRT_MANIFEST.name}\"
Description=\"$${WINRT_MANIFEST.description}\"
BackgroundColor=\"$${WINRT_MANIFEST.background}\"
ForegroundText=\"$${WINRT_MANIFEST.foreground}\"
Square150x150Logo=\"$${WINRT_MANIFEST.logo_large}\"
Square44x44Logo=\"$${WINRT_MANIFEST.logo_44x44}\">
<m3:DefaultTile Square71x71Logo=\"$${WINRT_MANIFEST.logo_71x71}\">
<m3:ShowNameOnTiles>
<m3:ShowOn Tile=\"square150x150Logo\" />
</m3:ShowNameOnTiles>
</m3:DefaultTile>
<m3:SplashScreen Image=\"$${WINRT_MANIFEST.logo_480x800}\" />
</m3:VisualElements>
</Application>
</Applications>$${WINRT_MANIFEST.capabilities}$${WINRT_MANIFEST.dependencies}
</Package>
<!-- Generated by qmake using the $$[QMAKE_XSPEC] mkspec. -->

View File

@ -239,6 +239,10 @@ mac {
CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.prl
CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl
} else:unversioned_libname {
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.so
CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.so
CMAKE_LIB_SONAME = lib$${CMAKE_QT_STEM}.so
} else {
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.so.$$eval(QT.$${MODULE}.VERSION)
CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.so.$$eval(QT.$${MODULE}.VERSION)

View File

@ -75,18 +75,22 @@ load(qt_common)
}
load(resolve_target)
qml1_target: \
qml1_target {
qmlplugindump = qml1plugindump
else: \
importpath.name = QML_IMPORT_PATH
} else {
qmlplugindump = qmlplugindump
importpath.name = QML2_IMPORT_PATH
}
qtPrepareTool(QMLPLUGINDUMP, $$qmlplugindump)
importpath.value =
for(qmod, QMAKEMODULES) {
qmod = $$section(qmod, /, 0, -3)/imports
qml1_target: qmod = $$qmod/QtDeclarative
for(qmod, QTREPOS) {
qml1_target: \
qmod = $$qmod/imports
else: \
qmod = $$qmod/qml
exists($$qmod): importpath.value += $$shell_path($$qmod)
}
importpath.name = QML_IMPORT_PATH
importpath.value = $$unique(importpath.value)
qtAddToolEnv(QMLPLUGINDUMP, importpath)
TARGETPATHBASE = $$replace(TARGETPATH, \\.\\d+\$, )

View File

@ -80,13 +80,16 @@ qt_module_deps = $$resolve_depends(qt_module_deps, "QT.")
# static builds: link qml import plugins into the app.
contains(qt_module_deps, qml): \
contains(QT_CONFIG, static):contains(TEMPLATE, .*app):!host_build:!no_import_scan {
!isEmpty(QTREPOS) {
for (qrep, QTREPOS): \
exists($$qrep/qml): \
QMLPATHS += $$qrep/qml
} else {
QMLPATHS += $$[QT_INSTALL_QML/get]
}
# run qmlimportscanner
qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner, _SYS)
for (MODULE, QT_MODULES) {
PATH = $$eval(QT.$${MODULE}.qml)
!isEmpty(PATH):exists($$PATH): QMLPATHS += $$PATH
}
QMLPATHS = $$unique(QMLPATHS)
for (QMLPATH, QMLPATHS): \
IMPORTPATHS += -importPath $$QMLPATH

View File

@ -59,7 +59,6 @@ CONFIG += \
create_prl link_prl \
prepare_docs qt_docs_targets \
no_private_qt_headers_warning QTDIR_build \
no_dll \
# Qt modules get compiled without exceptions enabled by default.
# However, testcases should be still built with exceptions.
exceptions_off testcase_exceptions

View File

@ -22,10 +22,27 @@ qtPrepareTool(QDOC, qdoc)
QDOC += -outputdir $$QMAKE_DOCS_OUTPUTDIR
!build_online_docs: \
QDOC += -installdir $$[QT_INSTALL_DOCS]
PREP_DOC_INDEXES =
DOC_INDEXES =
for(qrep, QTREPOS): \
exists($$qrep/doc): \
!isEmpty(QTREPOS) {
prepare_docs {
# This is not for linking, but for providing type information.
mps =
deps = $$replace(QT, -private$, )
deps = $$resolve_depends(deps, "QT.")
for (d, deps): \
mps += $$dirname(QT.$${d}.libs)
mps = $$unique(mps)
for (mp, mps): \
PREP_DOC_INDEXES += -indexdir $$mp/doc
}
for(qrep, QTREPOS): \
DOC_INDEXES += -indexdir $$qrep/doc
} else {
prepare_docs: \
PREP_DOC_INDEXES += -indexdir $$[QT_INSTALL_DOCS/get]
DOC_INDEXES += -indexdir $$[QT_INSTALL_DOCS/get]
}
qtver.name = QT_VERSION
qtver.value = $$VERSION
isEmpty(qtver.value): qtver.value = $$MODULE_VERSION
@ -39,7 +56,7 @@ qtdocs.value = $$[QT_INSTALL_DOCS/src]
qtAddToolEnv(QDOC, qtver qtmver qtvertag qtdocs)
doc_command = $$QDOC $$QMAKE_DOCS
prepare_docs {
prepare_docs.commands += $$doc_command -prepare -no-link-errors
prepare_docs.commands += $$doc_command -prepare $$PREP_DOC_INDEXES -no-link-errors
generate_docs.commands += $$doc_command -generate $$DOC_INDEXES
} else {
html_docs.commands += $$doc_command $$DOC_INDEXES

View File

@ -191,26 +191,30 @@ defineTest(qtAddRpathLink) {
# variable, default, [suffix for variable for system() use]
defineTest(qtPrepareTool) {
$$1 = $$eval(QT_TOOL.$${2}.binary)
isEmpty($$1) {
$$1 = $$[QT_HOST_BINS]/$$2
exists($$eval($$1).pl) {
$$1 = perl -w $$eval($$1).pl
cmd = $$eval(QT_TOOL.$${2}.binary)
isEmpty(cmd) {
cmd = $$[QT_HOST_BINS]/$$2
exists($${cmd}.pl) {
cmd = perl -w $$system_path($${cmd}.pl)
} else: contains(QMAKE_HOST.os, Windows) {
$$1 = $$eval($$1).exe
cmd = $$system_path($${cmd}.exe)
} else:contains(QMAKE_HOST.os, Darwin) {
BUNDLENAME = $$eval($$1).app/Contents/MacOS/$$2
BUNDLENAME = $${cmd}.app/Contents/MacOS/$$2
exists($$BUNDLENAME) {
$$1 = $$BUNDLENAME
cmd = $$BUNDLENAME
}
}
}
QT_TOOL_ENV += $$eval(QT_TOOL.$${2}.envvars)
!isEmpty(3) {
$$1$$3 = $$system_path($$eval($$1))
$$1$$3 =
for (arg, cmd): \
$$1$$3 += $$system_quote($$arg)
qtAddTargetEnv($$1$$3, QT_TOOL.$${2}.depends, system)
}
$$1 = $$system_path($$eval($$1))
$$1 =
for (arg, cmd): \
$$1 += $$shell_quote($$arg)
qtAddTargetEnv($$1, QT_TOOL.$${2}.depends, )
}
@ -249,11 +253,13 @@ defineTest(qtAddTargetEnv) {
deps = $$replace($$2, -private$, _private)
deps = $$resolve_depends(deps, "QT.", ".depends" ".private_depends" ".run_depends")
!isEmpty(deps) {
ptypes =
for(dep, deps) {
isEmpty(3): \
deppath += $$shell_path($$eval(QT.$${dep}.libs))
else: \
deppath += $$system_path($$eval(QT.$${dep}.libs))
ptypes += $$eval(QT.$${dep}.plugin_types)
}
equals(QMAKE_HOST.os, Windows) {
deppath.name = PATH
@ -273,14 +279,16 @@ defineTest(qtAddTargetEnv) {
deppath.CONFIG = prepend
pluginpath.value =
for(qmod, QMAKEMODULES) {
qmod = $$section(qmod, /, 0, -3)/plugins
exists($$qmod) {
isEmpty(3): \
pluginpath.value += $$shell_path($$qmod)
else: \
pluginpath.value += $$system_path($$qmod)
}
ppaths = $$[QT_INSTALL_PLUGINS/get]
for(qplug, QT_PLUGINS): \
contains(ptypes, QT_PLUGIN.$${qplug}.TYPE): \
ppaths += $$eval(QT_PLUGIN.$${qplug}.PATH)
ppaths = $$unique(ppaths)
for(qplug, ppaths) {
isEmpty(3): \
pluginpath.value += $$shell_path($$qplug)
else: \
pluginpath.value += $$system_path($$qplug)
}
pluginpath.name = QT_PLUGIN_PATH

View File

@ -22,6 +22,7 @@
target.path = $$[QT_HOST_LIBS]
else: \
target.path = $$[QT_INSTALL_LIBS]
target.CONFIG = no_dll
INSTALLS += target
}

View File

@ -24,7 +24,7 @@ tool_plugin {
contains(QT_CONFIG, build_all):CONFIG += build_all
}
CONFIG(static, static|shared) {
CONFIG(static, static|shared)|prefix_build {
isEmpty(MODULE): MODULE = $$basename(TARGET)
mod_work_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules
@ -66,9 +66,11 @@ CONFIG(static, static|shared) {
cache(QT_PLUGINS, transient)
}
pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
pritarget.files = $$MODULE_PRI
INSTALLS += pritarget
CONFIG(static, static|shared) {
pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
pritarget.files = $$MODULE_PRI
INSTALLS += pritarget
}
}
target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE

View File

@ -45,8 +45,9 @@ CONFIG += console
} else {
module_envvars =
}
bin = $$system_path($$QMAKE_RESOLVED_TARGET)
TOOL_PRI_CONT = \
"QT_TOOL.$${MODULE}.binary = $$QMAKE_RESOLVED_TARGET" \
"QT_TOOL.$${MODULE}.binary = $$val_escape(bin)" \
"QT_TOOL.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \
$$module_envvars
write_file($$TOOL_PRI, TOOL_PRI_CONT)|error("Aborting.")

View File

@ -14,10 +14,12 @@
# WINRT_MANIFEST.version: The version number of the package. Defaults to "1.0.0.0".
# WINRT_MANIFEST.arguments: Allows arguments to be passed to the executable.
# WINRT_MANIFEST.publisher: Display name of the publisher. Defaults to "Default publisher display name".
# WINRT_MANIFEST.publisher_id: On Windows 8/RT, the publisher's distinguished name (default: CN=MyCN). On Windows Phone, the publisher's UUID (default: invalid UUID string).
# WINRT_MANIFEST.publisher_id: On Windows 8/RT/Phone 8.1, the publisher's distinguished name (default: CN=MyCN). On Windows Phone 8.0, the publisher's UUID (default: invalid UUID string).
# WINRT_MANIFEST.phone_product_id): On Windows Phone 8.1, the GUID of the product. Defaults to the value of WINRT_MANIFEST.identity.
# WINRT_MANIFEST.phone_publisher_id: On Windows Phone 8.1, the GUID of the publiser. Defaults to an invalid GUID.
# WINRT_MANIFEST.description: Package description. Defaults to "Default package description".
# WINRT_MANIFEST.author: Package author (Windows Phone only). Defaults to "Default package author".
# WINRT_MANIFEST.genre: Package genre (Windows Phone only). Defaults to "apps.normal".
# WINRT_MANIFEST.author: Package author (Windows Phone 8.0 only). Defaults to "Default package author".
# WINRT_MANIFEST.genre: Package genre (Windows Phone 8.0 only). Defaults to "apps.normal".
# WINRT_MANIFEST.background: Tile background color. Defaults to "green".
# WINRT_MANIFEST.foreground: Tile foreground (text) color (Windows 8/RT only). Defaults to "light".
# WINRT_MANIFEST.logo_store: Logo image file for Windows Store. Default provided by the mkspec.
@ -49,7 +51,7 @@
BUILD_DIR = $$dirname(QMAKE_RESOLVED_TARGET)
}
winphone: \
winphone:equals(WINSDK_VER, 8.0): \
manifest_file.output = $$BUILD_DIR/WMAppManifest.xml
else: contains(TEMPLATE, "vc.*"): \
manifest_file.output = $$BUILD_DIR/Package.appxmanifest
@ -59,6 +61,7 @@
# Provide the C-runtime dependency
equals(TEMPLATE, "app") {
VCLIBS = Microsoft.VCLibs.$$replace(MSVC_VER, \\., ).00
winphone: VCLIBS = $${VCLIBS}.Phone
CONFIG(debug, debug|release): \
WINRT_MANIFEST.dependencies += $${VCLIBS}.Debug
else: \
@ -77,16 +80,18 @@
write_file($$UUID_CACHE, WINRT_UUID)|error("Unable to write the UUID cache; aborting.")
eval($$WINRT_UUID)
}
winphone: WINRT_MANIFEST.identity = {$$WINRT_MANIFEST.identity}
winphone:equals(WINSDK_VER, 8.0): WINRT_MANIFEST.identity = {$$WINRT_MANIFEST.identity}
}
isEmpty(WINRT_MANIFEST.name): WINRT_MANIFEST.name = $$TARGET
isEmpty(WINRT_MANIFEST.architecture): WINRT_MANIFEST.architecture = $$VCPROJ_ARCH
isEmpty(WINRT_MANIFEST.version): WINRT_MANIFEST.version = 1.0.0.0
isEmpty(WINRT_MANIFEST.publisher): WINRT_MANIFEST.publisher = Default publisher display name
isEmpty(WINRT_MANIFEST.publisherid) {
winphone: WINRT_MANIFEST.publisherid = {00000000-0000-0000-0000-000000000000}
winphone:equals(WINSDK_VER, 8.0): WINRT_MANIFEST.publisherid = {00000000-0000-0000-0000-000000000000}
else: WINRT_MANIFEST.publisherid = CN=$$(USERNAME)
}
isEmpty(WINRT_MANIFEST.phone_product_id): WINRT_MANIFEST.phone_product_id = $$WINRT_MANIFEST.identity
isEmpty(WINRT_MANIFEST.phone_publisher_id): WINRT_MANIFEST.phone_publisher_id = 00000000-0000-0000-0000-000000000000
isEmpty(WINRT_MANIFEST.description): WINRT_MANIFEST.description = Default package description
isEmpty(WINRT_MANIFEST.author): WINRT_MANIFEST.author = Default package author
isEmpty(WINRT_MANIFEST.genre): WINRT_MANIFEST.genre = apps.normal
@ -94,7 +99,7 @@
isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light
isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en
winphone: INDENT = "$$escape_expand(\\r\\n) "
winphone:equals(WINSDK_VER, 8.0): INDENT = "$$escape_expand(\\r\\n) "
else: INDENT = "$$escape_expand(\\r\\n) "
# Languages are given as a string list
@ -142,16 +147,12 @@
ICONS_FOUND ~= s/.*\\\$\\\$\\{WINRT_MANIFEST\\.((logo|tile)_[^\}]+)\\}.*/\\1/g
for (ICON_NAME, ICONS_FOUND) {
ICON_FILE = $$eval(WINRT_MANIFEST.$$ICON_NAME)
isEmpty(ICON_FILE) {
icon_$${ICON_NAME}.input = $$WINRT_ASSETS_PATH/$${ICON_NAME}.png
icon_$${ICON_NAME}.output = $$BUILD_DIR/assets/$${ICON_NAME}.png
WINRT_MANIFEST.$${ICON_NAME} = assets/$${ICON_NAME}.png
} else {
icon_$${ICON_NAME}.input = $$ICON_FILE
icon_$${ICON_NAME}.output = $$BUILD_DIR/$$ICON_FILE
}
isEmpty(ICON_FILE): ICON_FILE = $$WINRT_ASSETS_PATH/$${ICON_NAME}.png
icon_$${ICON_NAME}.input = $$ICON_FILE
icon_$${ICON_NAME}.output = $$BUILD_DIR/assets/$$basename(ICON_FILE)
icon_$${ICON_NAME}.CONFIG = verbatim
QMAKE_SUBSTITUTES += icon_$${ICON_NAME}
WINRT_MANIFEST.$${ICON_NAME} = assets/$$basename(ICON_FILE)
}
QMAKE_SUBSTITUTES += manifest_file

View File

@ -54,7 +54,7 @@ QMAKE_CXXFLAGS_STL_OFF =
QMAKE_CXXFLAGS_RTTI_ON = -GR
QMAKE_CXXFLAGS_RTTI_OFF =
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0
QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
QMAKE_INCDIR =

View File

@ -0,0 +1,23 @@
#
# qmake configuration for winphone-arm-msvc2013
#
# Written for Microsoft Visual C++ 2013
#
include(../common/winrt_winphone/qmake.conf)
QMAKE_COMPILER_DEFINES += _MSC_VER=1800
QMAKE_PLATFORM = winphone $$QMAKE_PLATFORM
DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP ARM __ARM__ __ARM__
QMAKE_CFLAGS += -FS
QMAKE_CXXFLAGS += -FS
QMAKE_LFLAGS += /MACHINE:ARM /NODEFAULTLIB:kernel32.lib
QMAKE_LIBS += WindowsPhoneCore.lib PhoneAppModelHost.lib
VCPROJ_ARCH = ARM
MSVC_VER = 12.0
WINSDK_VER = 8.1
WINTARGET_VER = WP81
WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/8.1_wp/AppxManifest.xml.in
WINRT_MANIFEST.architecture = arm

View File

@ -0,0 +1,42 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../common/winrt_winphone/qplatformdefs.h"

View File

@ -0,0 +1,23 @@
#
# qmake configuration for winphone-x86-msvc2013
#
# Written for Microsoft Visual C++ 2013
#
include(../common/winrt_winphone/qmake.conf)
QMAKE_COMPILER_DEFINES += _MSC_VER=1800
QMAKE_PLATFORM = winphone $$QMAKE_PLATFORM
DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP X86 __X86__ __x86__
QMAKE_CFLAGS += -FS
QMAKE_CXXFLAGS += -FS
QMAKE_LFLAGS += /MACHINE:X86 /NODEFAULTLIB:kernel32.lib
QMAKE_LIBS += WindowsPhoneCore.lib PhoneAppModelHost.lib
VCPROJ_ARCH = Win32
MSVC_VER = 12.0
WINSDK_VER = 8.1
WINTARGET_VER = WP81
WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/8.1_wp/AppxManifest.xml.in
WINRT_MANIFEST.architecture = x86

View File

@ -0,0 +1,42 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../common/winrt_winphone/qplatformdefs.h"

View File

@ -809,8 +809,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QString icon = fileFixify(var("ICON"));
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
if (bundlePrefix.isEmpty())
bundlePrefix = "com.yourcompany.";
QString bundleIdentifier = bundlePrefix + var("QMAKE_BUNDLE");
bundlePrefix = "com.yourcompany";
if (bundlePrefix.endsWith("."))
bundlePrefix.chop(1);
QString bundleIdentifier = bundlePrefix + "." + var("QMAKE_BUNDLE");
if (bundleIdentifier.endsWith(".app"))
bundleIdentifier.chop(4);
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake application of the Qt Toolkit.
@ -615,7 +615,8 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< attrTag("Label", "ProjectConfigurations");
bool isWinRT = false;
bool isPhone = false;
bool isWinPhone = false;
bool isWinPhone80 = false; // ### Windows Phone 8.0, remove in Qt 5.4
for (int i = 0; i < tool.SingleProjects.count(); ++i) {
xml << tag("ProjectConfiguration")
<< attrTag("Include" , tool.SingleProjects.at(i).Configuration.Name)
@ -623,7 +624,8 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< tagValue("Platform", tool.SingleProjects.at(i).PlatformName)
<< closetag();
isWinRT = isWinRT || tool.SingleProjects.at(i).Configuration.WinRT;
isPhone = isPhone || tool.SingleProjects.at(i).Configuration.WinPhone;
isWinPhone = isWinPhone = tool.SingleProjects.at(i).Configuration.WinPhone;
isWinPhone80 = isWinPhone80 || tool.SingleProjects.at(i).Configuration.WinPhone80;
}
xml << closetag()
@ -635,7 +637,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
if (isWinRT) {
xml << tagValue("MinimumVisualStudioVersion", tool.Version);
if (isPhone) {
if (isWinPhone80) {
xml << tagValue("WinMDAssembly", "true");
if (tool.SingleProjects.at(0).Configuration.ConfigurationType == typeApplication) {
xml << tagValue("XapOutputs", "true");
@ -643,7 +645,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
}
} else {
xml << tagValue("AppContainerApplication", "true")
<< tagValue("ApplicationType", "Windows Store")
<< tagValue("ApplicationType", isWinPhone ? "Windows Phone" : "Windows Store")
<< tagValue("ApplicationTypeRevision", tool.SdkVersion);
}
}
@ -823,7 +825,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
}
outputFilter(tool, xml, xmlFilter, "Root Files");
if (tool.SingleProjects.at(0).Configuration.WinPhone) {
if (isWinPhone80) {
xml << tag("ItemGroup")
<< tag("Reference")
<< attrTag("Include", "platform")
@ -835,7 +837,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
// App manifest
if (isWinRT) {
QString manifest = isPhone ? QStringLiteral("WMAppManifest.xml") : QStringLiteral("Package.appxmanifest");
QString manifest = isWinPhone80 ? QStringLiteral("WMAppManifest.xml") : QStringLiteral("Package.appxmanifest");
// Find all icons referenced in the manifest
QSet<QString> icons;
@ -856,7 +858,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
// Write out manifest + icons as content items
xml << tag(_ItemGroup)
<< tag(isPhone ? "Xml" : "AppxManifest")
<< tag(isWinPhone80 ? "Xml" : "AppxManifest")
<< attrTag("Include", manifest)
<< closetag();
foreach (const QString &icon, icons) {
@ -869,7 +871,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets");
if (isPhone)
if (isWinPhone80)
xml << import("Project", "$(MSBuildExtensionsPath)\\Microsoft\\WindowsPhone\\v8.0\\Microsoft.Cpp.WindowsPhone.8.0.targets");
xml << tag("ImportGroup")

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake application of the Qt Toolkit.
@ -166,10 +166,17 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return false;
}
regKey = regKeyPrefix
+ (isPhone ? QStringLiteral("Microsoft\\Microsoft SDKs\\WindowsPhone\\v")
: QStringLiteral("Microsoft\\Microsoft SDKs\\Windows\\v"))
+ winsdkVer + QStringLiteral("\\InstallationFolder");
QString windowsPath;
if (isPhone) {
if (targetVer == "WP80") // ### Windows Phone 8.0, remove in Qt 5.4
windowsPath = "Microsoft\\Microsoft SDKs\\WindowsPhone\\v";
else
windowsPath = "Microsoft\\Microsoft SDKs\\WindowsPhoneApp\\v";
} else {
windowsPath = "Microsoft\\Microsoft SDKs\\Windows\\v";
}
regKey = regKeyPrefix + windowsPath + winsdkVer + QStringLiteral("\\InstallationFolder");
const QString kitDir = qt_readRegistryKey(HKEY_LOCAL_MACHINE, regKey);
if (kitDir.isEmpty()) {
fprintf(stderr, "Failed to find the Windows Kit installation directory.\n");
@ -184,7 +191,9 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
QStringList libDirs;
QStringList binDirs;
if (isPhone) {
QString sdkDir = vcInstallDir + QStringLiteral("/WPSDK/") + targetVer;
QString sdkDir = vcInstallDir;
if (targetVer == "WP80")
sdkDir += QStringLiteral("/WPSDK/") + targetVer;
if (!QDir(sdkDir).exists()) {
fprintf(stderr, "Failed to find the Windows Phone SDK in %s.\n"
"Check that it is properly installed.\n",
@ -192,7 +201,8 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return false;
}
incDirs << sdkDir + QStringLiteral("/include");
libDirs << sdkDir + QStringLiteral("/lib/") + compilerArch;
libDirs << sdkDir + QStringLiteral("/lib/store/") + compilerArch
<< sdkDir + QStringLiteral("/lib/") + compilerArch;
binDirs << sdkDir + QStringLiteral("/bin/") + compiler;
libDirs << kitDir + QStringLiteral("/lib/") + arch;
incDirs << kitDir + QStringLiteral("/include")
@ -260,10 +270,7 @@ QString NmakeMakefileGenerator::defaultInstall(const QString &t)
targetdir += Option::dir_sep;
if (project->isActiveConfig("debug_info")) {
if (t == "dlltarget"
|| project->first("TEMPLATE") != "lib"
|| (project->isActiveConfig("shared")
&& project->values(ProKey(t + ".CONFIG")).indexOf("no_dll") == -1)) {
if (t == "dlltarget" || project->values(ProKey(t + ".CONFIG")).indexOf("no_dll") == -1) {
QString pdb_target = getPdbTarget();
pdb_target.remove('"');
QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target;

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake application of the Qt Toolkit.
@ -2129,6 +2129,7 @@ VCPreLinkEventTool::VCPreLinkEventTool()
VCConfiguration::VCConfiguration()
: WinRT(false),
WinPhone(false),
WinPhone80(false),
ATLMinimizesCRunTimeLibraryUsage(unset),
BuildBrowserInformation(unset),
CharacterSet(charSetNotSet),

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake application of the Qt Toolkit.
@ -886,7 +886,7 @@ public:
~VCConfiguration(){}
DotNET CompilerVersion;
bool WinRT, WinPhone;
bool WinRT, WinPhone, WinPhone80;
// Variables
triState ATLMinimizesCRunTimeLibraryUsage;

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake application of the Qt Toolkit.
@ -902,7 +902,7 @@ void VcprojGenerator::initProject()
initResourceFiles();
initExtraCompilerOutputs();
if (vcProject.Configuration.WinRT) {
if (vcProject.Configuration.WinPhone
if (vcProject.Configuration.WinPhone80
&& vcProject.Configuration.ConfigurationType == typeApplication)
initWMAppManifest();
}
@ -1012,6 +1012,7 @@ void VcprojGenerator::initConfiguration()
conf.WinRT = project->isActiveConfig("winrt");
if (conf.WinRT) {
conf.WinPhone = project->isActiveConfig("winphone");
conf.WinPhone80 = project->first("WINTARGET_VER") == "WP80";
// Saner defaults
conf.compiler.UsePrecompiledHeader = pchNone;
conf.compiler.CompileAsWinRT = _False;

View File

@ -24,8 +24,83 @@
#include "libEGL/Display.h"
#if defined(ANGLE_OS_WINRT)
#include <wrl.h>
#include <windows.foundation.h>
#include <windows.ui.core.h>
#include <windows.graphics.display.h>
static bool getCoreWindowSize(const EGLNativeWindowType win, int *width, int *height)
{
Microsoft::WRL::ComPtr<ABI::Windows::UI::Core::ICoreWindow> window;
HRESULT hr = win->QueryInterface(IID_PPV_ARGS(&window));
if (FAILED(hr))
{
ERR("Failed to cast native display pointer to ICoreWindow *.");
return false;
}
#if _MSC_VER<=1700
Microsoft::WRL::ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> displayInformation;
hr = RoGetActivationFactory(Microsoft::WRL::Wrappers::HString::MakeReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(),
IID_PPV_ARGS(&displayInformation));
#else
Microsoft::WRL::ComPtr<ABI::Windows::Graphics::Display::IDisplayInformationStatics> displayInformationFactory;
hr = RoGetActivationFactory(Microsoft::WRL::Wrappers::HString::MakeReference(RuntimeClass_Windows_Graphics_Display_DisplayInformation).Get(),
IID_PPV_ARGS(&displayInformationFactory));
if (FAILED(hr))
{
ERR("Failed to get display information factory.");
return false;
}
Microsoft::WRL::ComPtr<ABI::Windows::Graphics::Display::IDisplayInformation> displayInformation;
hr = displayInformationFactory->GetForCurrentView(&displayInformation);
#endif
if (FAILED(hr))
{
ERR("Failed to get display information.");
return false;
}
#if defined(ANGLE_OS_WINPHONE) && _MSC_VER>=1800 // Windows Phone 8.1
Microsoft::WRL::ComPtr<ABI::Windows::Graphics::Display::IDisplayInformation2> displayInformation2;
hr = displayInformation.As(&displayInformation2);
if (FAILED(hr))
{
ERR("Failed to get extended display information.");
return false;
}
DOUBLE scaleFactor;
hr = displayInformation2->get_RawPixelsPerViewPixel(&scaleFactor);
if (FAILED(hr))
{
ERR("Failed to get raw pixels per view pixel.");
return false;
}
#else
ABI::Windows::Graphics::Display::ResolutionScale resolutionScale;
hr = displayInformation->get_ResolutionScale(&resolutionScale);
if (FAILED(hr))
{
ERR("Failed to get resolution scale.");
return false;
}
DOUBLE scaleFactor = DOUBLE(resolutionScale) / 100.0;
#endif
ABI::Windows::Foundation::Rect windowRect;
hr = window->get_Bounds(&windowRect);
if (FAILED(hr))
{
ERR("Failed to get ICoreWindow bounds.");
return false;
}
*width = std::floor(windowRect.Width * scaleFactor + 0.5);
*height = std::floor(windowRect.Height * scaleFactor + 0.5);
return true;
}
#endif
namespace egl
@ -117,14 +192,10 @@ bool Surface::resetSwapChain()
width = windowRect.right - windowRect.left;
height = windowRect.bottom - windowRect.top;
#else
ABI::Windows::Foundation::Rect windowRect;
ABI::Windows::UI::Core::ICoreWindow *window;
HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window));
if (FAILED(hr))
if (!getCoreWindowSize(mWindow, &width, &height))
{
return false;
window->get_Bounds(&windowRect);
width = windowRect.Width;
height = windowRect.Height;
}
#endif
}
else
@ -336,14 +407,12 @@ bool Surface::checkForOutOfDateSwapChain()
int clientWidth = client.right - client.left;
int clientHeight = client.bottom - client.top;
#else
ABI::Windows::Foundation::Rect windowRect;
ABI::Windows::UI::Core::ICoreWindow *window;
HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window));
if (FAILED(hr))
int clientWidth;
int clientHeight;
if (!getCoreWindowSize(mWindow, &clientWidth, &clientHeight))
{
return false;
window->get_Bounds(&windowRect);
int clientWidth = windowRect.Width;
int clientHeight = windowRect.Height;
}
#endif
bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();

View File

@ -119,6 +119,7 @@ public class QtActivityDelegate
private InputMethodManager m_imm = null;
private boolean m_quitApp = true;
private Process m_debuggerProcess = null; // debugger process
private View m_dummyView = null;
private boolean m_keyboardIsVisible = false;
public boolean m_backKeyPressedSent = false;
@ -673,7 +674,7 @@ public class QtActivityDelegate
DisplayMetrics metrics = new DisplayMetrics();
m_activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
QtNative.setApplicationDisplayMetrics(metrics.widthPixels, metrics.heightPixels,
metrics.widthPixels, metrics.heightPixels,
0, 0,
metrics.xdpi, metrics.ydpi, metrics.scaledDensity);
}
m_layout = new QtLayout(m_activity);
@ -683,6 +684,10 @@ public class QtActivityDelegate
m_nativeViews = new HashMap<Integer, View>();
m_activity.registerForContextMenu(m_layout);
m_activity.setContentView(m_layout,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
int orientation = m_activity.getResources().getConfiguration().orientation;
int rotation = m_activity.getWindowManager().getDefaultDisplay().getRotation();
boolean rot90 = (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270);
@ -1007,6 +1012,11 @@ public class QtActivityDelegate
}
public void insertNativeView(int id, View view, int x, int y, int w, int h) {
if (m_dummyView != null) {
m_layout.removeView(m_dummyView);
m_dummyView = null;
}
if (m_nativeViews.containsKey(id))
m_layout.removeView(m_nativeViews.remove(id));
@ -1032,9 +1042,10 @@ public class QtActivityDelegate
m_activity.getWindow().setBackgroundDrawable(m_activity.getResources().getDrawable(attr.resourceId));
}
m_activity.setContentView(m_layout,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
if (m_dummyView != null) {
m_layout.removeView(m_dummyView);
m_dummyView = null;
}
}
if (m_surfaces.containsKey(id))
@ -1071,12 +1082,22 @@ public class QtActivityDelegate
}
public void destroySurface(int id) {
View view = null;
if (m_surfaces.containsKey(id)) {
m_layout.removeView(m_surfaces.remove(id));
view = m_surfaces.remove(id);
} else if (m_nativeViews.containsKey(id)) {
m_layout.removeView(m_nativeViews.remove(id));
view = m_nativeViews.remove(id);
} else {
Log.e(QtNative.QtTAG, "Surface " + id +" not found!");
}
// Keep last frame in stack until it is replaced to get correct
// shutdown transition
if (m_surfaces.size() == 0 && m_nativeViews.size() == 0) {
m_dummyView = view;
} else if (view != null) {
m_layout.removeView(view);
}
}
}

View File

@ -69,6 +69,7 @@ import android.content.res.Resources.Theme;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@ -889,6 +890,8 @@ public class QtActivity extends Activity
// if splash screen is defined, then show it
if (m_activityInfo.metaData.containsKey("android.app.splash_screen_drawable"))
getWindow().setBackgroundDrawableResource(m_activityInfo.metaData.getInt("android.app.splash_screen_drawable"));
else
getWindow().setBackgroundDrawable(new ColorDrawable(0xff000000));
startApp(true);
}
}

View File

@ -0,0 +1,145 @@
From 59c6d4c94acb4735a73f50f46f91a6cce7389f94 Mon Sep 17 00:00:00 2001
From: Andrew Knight <andrew.knight@digia.com>
Date: Wed, 21 May 2014 00:58:21 +0300
Subject: [PATCH] ANGLE WinRT: Create swap chain using physical resolution
ANGLE has been creating the framebuffer in logical pixels instead of
physical pixels, which leads to unexpected results and side effects like
smudged anti-aliased text. This fixes the issue by multiplying the DIP
resolution by the scale factor, making the framebuffer match the physical
pixel resolution of the screen.
Change-Id: I3594995ce8e18a31b47e27165f72bc6a391b97b6
---
src/3rdparty/angle/src/libEGL/Surface.cpp | 97 ++++++++++++++++++++++++++-----
1 file changed, 83 insertions(+), 14 deletions(-)
diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp
index 3443355..a2e2306 100644
--- a/src/3rdparty/angle/src/libEGL/Surface.cpp
+++ b/src/3rdparty/angle/src/libEGL/Surface.cpp
@@ -24,8 +24,83 @@
#include "libEGL/Display.h"
#if defined(ANGLE_OS_WINRT)
+#include <wrl.h>
#include <windows.foundation.h>
#include <windows.ui.core.h>
+#include <windows.graphics.display.h>
+
+static bool getCoreWindowSize(const EGLNativeWindowType win, int *width, int *height)
+{
+ Microsoft::WRL::ComPtr<ABI::Windows::UI::Core::ICoreWindow> window;
+ HRESULT hr = win->QueryInterface(IID_PPV_ARGS(&window));
+ if (FAILED(hr))
+ {
+ ERR("Failed to cast native display pointer to ICoreWindow *.");
+ return false;
+ }
+
+#if _MSC_VER<=1700
+ Microsoft::WRL::ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> displayInformation;
+ hr = RoGetActivationFactory(Microsoft::WRL::Wrappers::HString::MakeReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(),
+ IID_PPV_ARGS(&displayInformation));
+#else
+ Microsoft::WRL::ComPtr<ABI::Windows::Graphics::Display::IDisplayInformationStatics> displayInformationFactory;
+ hr = RoGetActivationFactory(Microsoft::WRL::Wrappers::HString::MakeReference(RuntimeClass_Windows_Graphics_Display_DisplayInformation).Get(),
+ IID_PPV_ARGS(&displayInformationFactory));
+ if (FAILED(hr))
+ {
+ ERR("Failed to get display information factory.");
+ return false;
+ }
+
+ Microsoft::WRL::ComPtr<ABI::Windows::Graphics::Display::IDisplayInformation> displayInformation;
+ hr = displayInformationFactory->GetForCurrentView(&displayInformation);
+#endif
+ if (FAILED(hr))
+ {
+ ERR("Failed to get display information.");
+ return false;
+ }
+
+#if defined(ANGLE_OS_WINPHONE) && _MSC_VER>=1800 // Windows Phone 8.1
+ Microsoft::WRL::ComPtr<ABI::Windows::Graphics::Display::IDisplayInformation2> displayInformation2;
+ hr = displayInformation.As(&displayInformation2);
+ if (FAILED(hr))
+ {
+ ERR("Failed to get extended display information.");
+ return false;
+ }
+
+ DOUBLE scaleFactor;
+ hr = displayInformation2->get_RawPixelsPerViewPixel(&scaleFactor);
+ if (FAILED(hr))
+ {
+ ERR("Failed to get raw pixels per view pixel.");
+ return false;
+ }
+#else
+ ABI::Windows::Graphics::Display::ResolutionScale resolutionScale;
+ hr = displayInformation->get_ResolutionScale(&resolutionScale);
+ if (FAILED(hr))
+ {
+ ERR("Failed to get resolution scale.");
+ return false;
+ }
+ DOUBLE scaleFactor = DOUBLE(resolutionScale) / 100.0;
+#endif
+
+ ABI::Windows::Foundation::Rect windowRect;
+ hr = window->get_Bounds(&windowRect);
+ if (FAILED(hr))
+ {
+ ERR("Failed to get ICoreWindow bounds.");
+ return false;
+ }
+
+ *width = std::floor(windowRect.Width * scaleFactor + 0.5);
+ *height = std::floor(windowRect.Height * scaleFactor + 0.5);
+ return true;
+}
#endif
namespace egl
@@ -117,14 +192,10 @@ bool Surface::resetSwapChain()
width = windowRect.right - windowRect.left;
height = windowRect.bottom - windowRect.top;
#else
- ABI::Windows::Foundation::Rect windowRect;
- ABI::Windows::UI::Core::ICoreWindow *window;
- HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window));
- if (FAILED(hr))
+ if (!getCoreWindowSize(mWindow, &width, &height))
+ {
return false;
- window->get_Bounds(&windowRect);
- width = windowRect.Width;
- height = windowRect.Height;
+ }
#endif
}
else
@@ -336,14 +407,12 @@ bool Surface::checkForOutOfDateSwapChain()
int clientWidth = client.right - client.left;
int clientHeight = client.bottom - client.top;
#else
- ABI::Windows::Foundation::Rect windowRect;
- ABI::Windows::UI::Core::ICoreWindow *window;
- HRESULT hr = mWindow->QueryInterface(IID_PPV_ARGS(&window));
- if (FAILED(hr))
+ int clientWidth;
+ int clientHeight;
+ if (!getCoreWindowSize(mWindow, &clientWidth, &clientHeight))
+ {
return false;
- window->get_Bounds(&windowRect);
- int clientWidth = windowRect.Width;
- int clientHeight = windowRect.Height;
+ }
#endif
bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
--
1.9.0.msysgit.0

View File

@ -74,25 +74,22 @@ static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const
__m128i packed = _mm_packus_epi16(data1, data2);
__m128i nonAscii = _mm_cmpgt_epi8(packed, _mm_setzero_si128());
// store, even if there are non-ASCII characters here
_mm_storeu_si128((__m128i*)dst, packed);
// n will contain 1 bit set per character in [data1, data2] that is non-ASCII (or NUL)
ushort n = ~_mm_movemask_epi8(nonAscii);
if (n) {
// copy the front part that is still ASCII
while (!(n & 1)) {
*dst++ = *src++;
n >>= 1;
}
// find the next probable ASCII character
// we don't want to load 32 bytes again in this loop if we know there are non-ASCII
// characters still coming
n = _bit_scan_reverse(n);
nextAscii = src + n + 1;
nextAscii = src + _bit_scan_reverse(n) + 1;
n = _bit_scan_forward(n);
dst += n;
src += n;
return false;
}
// pack
_mm_storeu_si128((__m128i*)dst, packed);
}
return src == end;
}

View File

@ -121,7 +121,7 @@ process.start("dir \"My Documents\"");
//! [7]
QProcess process;
process.start("dir \"\"\"My Documents\"\"\"");
process.start("dir \"Epic 12\"\"\" Singles\"");
//! [7]

View File

@ -124,7 +124,7 @@ QMetaMethod::invoke: Unable to handle unregistered datatype 'MyType'
QString retVal;
QByteArray normalizedSignature = QMetaObject::normalizedSignature("compute(QString, int, double)");
int methodIndex = obj->metaObject()->indexOfMethod(normalizedSignature);
QMetaMethod method = metaObject->method(methodIndex);
QMetaMethod method = obj->metaObject()->method(methodIndex);
method.invoke(obj,
Qt::DirectConnection,
Q_RETURN_ARG(QString, retVal),

View File

@ -1841,8 +1841,9 @@ QSysInfo::MacVersion QSysInfo::macVersion()
{
#if defined(Q_OS_OSX)
SInt32 gestalt_version;
if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) {
return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2);
if (Gestalt(gestaltSystemVersionMinor, &gestalt_version) == noErr) {
// add 2 because OS X 10.0 is 0x02 in the enum
return QSysInfo::MacVersion(gestalt_version + 2);
}
#elif defined(Q_OS_IOS)
return qt_ios_version(); // qtcore_mac_objc.mm
@ -1992,6 +1993,8 @@ QSysInfo::WinVersion QSysInfo::windowsVersion()
winver = QSysInfo::WV_WINDOWS7;
else if (override == "WINDOWS8")
winver = QSysInfo::WV_WINDOWS8;
else if (override == "WINDOWS8_1")
winver = QSysInfo::WV_WINDOWS8_1;
}
#endif
#endif // !Q_OS_WINRT

View File

@ -1219,11 +1219,11 @@ QString QFileSystemEngine::rootPath()
if (FAILED(installedLocation.As(&item)))
return ret;
HSTRING finalWinPath;
if (FAILED(item->get_Path(&finalWinPath)))
HString finalWinPath;
if (FAILED(item->get_Path(finalWinPath.GetAddressOf())))
return ret;
ret = QDir::fromNativeSeparators(QString::fromWCharArray(WindowsGetStringRawBuffer(finalWinPath, nullptr)));
ret = QDir::fromNativeSeparators(QString::fromWCharArray(finalWinPath.GetRawBuffer(nullptr)));
#else
QString ret = QString::fromLatin1(qgetenv("SystemDrive").constData());
@ -1319,10 +1319,10 @@ QString QFileSystemEngine::tempPath()
ComPtr<IStorageItem> tempFolderItem;
if (FAILED(tempFolder.As(&tempFolderItem)))
return ret;
HSTRING path;
if (FAILED(tempFolderItem->get_Path(&path)))
HString path;
if (FAILED(tempFolderItem->get_Path(path.GetAddressOf())))
return ret;
ret = QDir::fromNativeSeparators(QString::fromWCharArray(WindowsGetStringRawBuffer(path, nullptr)));
ret = QDir::fromNativeSeparators(QString::fromWCharArray(path.GetRawBuffer(nullptr)));
#endif // Q_OS_WINRT
if (ret.isEmpty()) {
#if !defined(Q_OS_WINCE)

View File

@ -2015,15 +2015,12 @@ QByteArray QProcess::readAllStandardError()
}
/*!
Starts the given \a program in a new process, if none is already
running, passing the command line arguments in \a arguments. The OpenMode
is set to \a mode.
Starts the given \a program in a new process, passing the command line
arguments in \a arguments.
The QProcess object will immediately enter the Starting state. If the
process starts successfully, QProcess will emit started(); otherwise,
error() will be emitted. If the QProcess object is already running a
process, a warning may be printed at the console, and the existing
process will continue running.
error() will be emitted.
\note Processes are started asynchronously, which means the started()
and error() signals may be delayed. Call waitForStarted() to make
@ -2032,9 +2029,18 @@ QByteArray QProcess::readAllStandardError()
\note No further splitting of the arguments is performed.
\b{Windows:} Arguments that contain spaces are wrapped in quotes.
\b{Windows:} The arguments are quoted and joined into a command line
that is compatible with the CommandLineToArgvW() Windows function.
For programs that have different command line quoting requirements,
you need to use setNativeArguments().
\sa pid(), started(), waitForStarted()
The OpenMode is set to \a mode.
If the QProcess object is already running a process, a warning may be
printed at the console, and the existing process will continue running
unaffected.
\sa pid(), started(), waitForStarted(), setNativeArguments()
*/
void QProcess::start(const QString &program, const QStringList &arguments, OpenMode mode)
{
@ -2057,8 +2063,6 @@ void QProcess::start(const QString &program, const QStringList &arguments, OpenM
Starts the program set by setProgram() with arguments set by setArguments().
The OpenMode is set to \a mode.
This method is a convenient alias to open().
\sa open(), setProgram(), setArguments()
*/
void QProcess::start(OpenMode mode)
@ -2077,22 +2081,13 @@ void QProcess::start(OpenMode mode)
}
/*!
Starts the program set by setProgram() in a new process, if none is already
running, passing the command line arguments set by setArguments(). The OpenMode
is set to \a mode.
Starts the program set by setProgram() with arguments set by setArguments().
The OpenMode is set to \a mode.
The QProcess object will immediately enter the Starting state. If the
process starts successfully, QProcess will emit started(); otherwise,
error() will be emitted. If the QProcess object is already running a
process, a warning may be printed at the console, the function will return false,
and the existing process will continue running.
\note Processes are started asynchronously, which means the started()
and error() signals may be delayed. Call waitForStarted() to make
sure the process has started (or has failed to start) and those signals
have been emitted. In this regard, a true return value merly means the process
was correcty initialized, not that the program was actually started.
This method is an alias for start(), and exists only to fully implement
the interface defined by QIODevice.
\sa start(), setProgram(), setArguments()
*/
bool QProcess::open(OpenMode mode)
{
@ -2185,29 +2180,28 @@ static QStringList parseCombinedArgString(const QString &program)
/*!
\overload
Starts the command \a command in a new process, if one is not already
running. \a command is a single string of text containing both the
program name and its arguments. The arguments are separated by one or
more spaces. For example:
Starts the command \a command in a new process.
The OpenMode is set to \a mode.
\a command is a single string of text containing both the program name
and its arguments. The arguments are separated by one or more spaces.
For example:
\snippet code/src_corelib_io_qprocess.cpp 5
The \a command string can also contain quotes, to ensure that arguments
containing spaces are correctly supplied to the new process. For example:
Arguments containing spaces must be quoted to be correctly supplied to
the new process. For example:
\snippet code/src_corelib_io_qprocess.cpp 6
If the QProcess object is already running a process, a warning may be
printed at the console, and the existing process will continue running.
Note that, on Windows, quotes need to be both escaped and quoted.
For example, the above code would be specified in the following
way to ensure that \c{"My Documents"} is used as the argument to
the \c dir executable:
Literal quotes in the \a command string are represented by triple quotes.
For example:
\snippet code/src_corelib_io_qprocess.cpp 7
The OpenMode is set to \a mode.
After the \a command string has been split and unquoted, this function
behaves like the overload which takes the arguments as a string list.
*/
void QProcess::start(const QString &command, OpenMode mode)
{
@ -2243,7 +2237,7 @@ QString QProcess::program() const
\since 5.1
Set the \a program to use when starting the process.
That function must be call before open()
This function must be called before start().
\sa start(), setArguments(), program()
*/
@ -2274,7 +2268,7 @@ QStringList QProcess::arguments() const
\since 5.1
Set the \a arguments to pass to the called program when starting the process.
That function must be call before open()
This function must be called before start().
\sa start(), setProgram(), arguments()
*/
@ -2359,11 +2353,13 @@ QProcess::ExitStatus QProcess::exitStatus() const
The environment and working directory are inherited from the calling
process.
On Windows, arguments that contain spaces are wrapped in quotes.
Argument handling is identical to the respective start() overload.
If the process cannot be started, -2 is returned. If the process
crashes, -1 is returned. Otherwise, the process' exit code is
returned.
\sa start()
*/
int QProcess::execute(const QString &program, const QStringList &arguments)
{
@ -2378,15 +2374,21 @@ int QProcess::execute(const QString &program, const QStringList &arguments)
/*!
\overload
Starts the program \a program in a new process. \a program is a
single string of text containing both the program name and its
arguments. The arguments are separated by one or more spaces.
Starts the program \a command in a new process, waits for it to finish,
and then returns the exit code.
Argument handling is identical to the respective start() overload.
After the \a command string has been split and unquoted, this function
behaves like the overload which takes the arguments as a string list.
\sa start()
*/
int QProcess::execute(const QString &program)
int QProcess::execute(const QString &command)
{
QProcess process;
process.setReadChannelMode(ForwardedChannels);
process.start(program);
process.start(command);
if (!process.waitForFinished(-1))
return -2;
return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
@ -2396,24 +2398,24 @@ int QProcess::execute(const QString &program)
Starts the program \a program with the arguments \a arguments in a
new process, and detaches from it. Returns \c true on success;
otherwise returns \c false. If the calling process exits, the
detached process will continue to live.
detached process will continue to run unaffected.
Note that arguments that contain spaces are not passed to the
process as separate arguments.
Argument handling is identical to the respective start() overload.
\b{Unix:} The started process will run in its own session and act
like a daemon.
\b{Windows:} Arguments that contain spaces are wrapped in quotes.
The started process will run as a regular standalone process.
The process will be started in the directory \a workingDirectory.
If \a workingDirectory is empty, the working directory is inherited
from the calling process.
\note On QNX, this may cause all application threads to
temporarily freeze.
If the function is successful then *\a pid is set to the process
identifier of the started process.
\sa start()
*/
bool QProcess::startDetached(const QString &program,
const QStringList &arguments,
@ -2427,19 +2429,7 @@ bool QProcess::startDetached(const QString &program,
}
/*!
Starts the program \a program with the given \a arguments in a
new process, and detaches from it. Returns \c true on success;
otherwise returns \c false. If the calling process exits, the
detached process will continue to live.
\note Arguments that contain spaces are not passed to the
process as separate arguments.
\b{Unix:} The started process will run in its own session and act
like a daemon.
\b{Windows:} Arguments that contain spaces are wrapped in quotes.
The started process will run as a regular standalone process.
\internal
*/
bool QProcess::startDetached(const QString &program,
const QStringList &arguments)
@ -2450,16 +2440,19 @@ bool QProcess::startDetached(const QString &program,
/*!
\overload
Starts the program \a program in a new process. \a program is a
single string of text containing both the program name and its
arguments. The arguments are separated by one or more spaces.
Starts the command \a command in a new process, and detaches from it.
Returns \c true on success; otherwise returns \c false.
The \a program string can also contain quotes, to ensure that arguments
containing spaces are correctly supplied to the new process.
Argument handling is identical to the respective start() overload.
After the \a command string has been split and unquoted, this function
behaves like the overload which takes the arguments as a string list.
\sa start()
*/
bool QProcess::startDetached(const QString &program)
bool QProcess::startDetached(const QString &command)
{
QStringList args = parseCombinedArgString(program);
QStringList args = parseCombinedArgString(command);
if (args.isEmpty())
return false;

View File

@ -209,12 +209,18 @@ public:
bool atEnd() const;
static int execute(const QString &program, const QStringList &arguments);
static int execute(const QString &program);
static int execute(const QString &command);
static bool startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory,
qint64 *pid = 0);
static bool startDetached(const QString &program, const QStringList &arguments);
static bool startDetached(const QString &program);
static bool startDetached(const QString &program, const QStringList &arguments,
const QString &workingDirectory
#if defined(Q_QDOC)
= QString()
#endif
, qint64 *pid = 0);
#if !defined(Q_QDOC)
static bool startDetached(const QString &program, const QStringList &arguments); // ### Qt6: merge overloads
#endif
static bool startDetached(const QString &command);
static QStringList systemEnvironment();

View File

@ -696,6 +696,9 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
{
bool needsQuotes = false;
bool escapeNextIfDigit = false;
bool useCodec = codec && !str.startsWith(QLatin1String("@ByteArray("))
&& !str.startsWith(QLatin1String("@Variant("));
int i;
int startPos = result.size();
@ -748,12 +751,12 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
result += (char)ch;
break;
default:
if (ch <= 0x1F || (ch >= 0x7F && !codec)) {
if (ch <= 0x1F || (ch >= 0x7F && !useCodec)) {
result += "\\x";
result += QByteArray::number(ch, 16);
escapeNextIfDigit = true;
#ifndef QT_NO_TEXTCODEC
} else if (codec) {
} else if (useCodec) {
// slow
result += codec->fromUnicode(str.at(i));
#endif
@ -1084,10 +1087,10 @@ static QString windowsConfigPath(int type)
ComPtr<IStorageItem> localFolderItem;
if (FAILED(localFolder.As(&localFolderItem)))
return result;
HSTRING path;
if (FAILED(localFolderItem->get_Path(&path)))
HString path;
if (FAILED(localFolderItem->get_Path(path.GetAddressOf())))
return result;
result = QString::fromWCharArray(WindowsGetStringRawBuffer(path, nullptr));
result = QString::fromWCharArray(path.GetRawBuffer(nullptr));
}
switch (type) {

View File

@ -90,10 +90,10 @@ QString QStandardPaths::writableLocation(StandardLocation type)
ComPtr<IStorageItem> settingsFolderItem;
if (FAILED(settingsFolder.As(&settingsFolderItem)))
break;
HSTRING path;
if (FAILED(settingsFolderItem->get_Path(&path)))
HString path;
if (FAILED(settingsFolderItem->get_Path(path.GetAddressOf())))
break;
result = convertCharArray(WindowsGetStringRawBuffer(path, nullptr));
result = convertCharArray(path.GetRawBuffer(nullptr));
if (isTestModeEnabled())
result += QLatin1String("/qttest");
break;

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -1504,10 +1504,10 @@ QAbstractItemModel::~QAbstractItemModel()
*/
/*!
\fn void QAbstractItemModel::rowsInserted(const QModelIndex &parent, int start, int end)
\fn void QAbstractItemModel::rowsInserted(const QModelIndex &parent, int first, int last)
This signal is emitted after rows have been inserted into the
model. The new items are those between \a start and \a end
model. The new items are those between \a first and \a last
inclusive, under the given \a parent item.
\note Components connected to this signal use it to adapt to changes in the
@ -1532,10 +1532,10 @@ QAbstractItemModel::~QAbstractItemModel()
*/
/*!
\fn void QAbstractItemModel::rowsRemoved(const QModelIndex &parent, int start, int end)
\fn void QAbstractItemModel::rowsRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted after rows have been removed from the model. The
removed items are those between \a start and \a end inclusive, under the
removed items are those between \a first and \a last inclusive, under the
given \a parent item.
\note Components connected to this signal use it to adapt to changes
@ -1546,10 +1546,10 @@ QAbstractItemModel::~QAbstractItemModel()
*/
/*!
\fn void QAbstractItemModel::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
\fn void QAbstractItemModel::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted just before rows are removed from the model. The
items that will be removed are those between \a start and \a end inclusive,
items that will be removed are those between \a first and \a last inclusive,
under the given \a parent item.
\note Components connected to this signal use it to adapt to changes
@ -1624,10 +1624,10 @@ QAbstractItemModel::~QAbstractItemModel()
*/
/*!
\fn void QAbstractItemModel::columnsInserted(const QModelIndex &parent, int start, int end)
\fn void QAbstractItemModel::columnsInserted(const QModelIndex &parent, int first, int last)
This signal is emitted after columns have been inserted into the model. The
new items are those between \a start and \a end inclusive, under the given
new items are those between \a first and \a last inclusive, under the given
\a parent item.
\note Components connected to this signal use it to adapt to changes in the
@ -1638,10 +1638,10 @@ QAbstractItemModel::~QAbstractItemModel()
*/
/*!
\fn void QAbstractItemModel::columnsAboutToBeInserted(const QModelIndex &parent, int start, int end)
\fn void QAbstractItemModel::columnsAboutToBeInserted(const QModelIndex &parent, int first, int last)
This signal is emitted just before columns are inserted into the model. The
new items will be positioned between \a start and \a end inclusive, under
new items will be positioned between \a first and \a last inclusive, under
the given \a parent item.
\note Components connected to this signal use it to adapt to changes in the
@ -1652,10 +1652,10 @@ QAbstractItemModel::~QAbstractItemModel()
*/
/*!
\fn void QAbstractItemModel::columnsRemoved(const QModelIndex &parent, int start, int end)
\fn void QAbstractItemModel::columnsRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted after columns have been removed from the model.
The removed items are those between \a start and \a end inclusive,
The removed items are those between \a first and \a last inclusive,
under the given \a parent item.
\note Components connected to this signal use it to adapt to changes in
@ -1666,10 +1666,10 @@ QAbstractItemModel::~QAbstractItemModel()
*/
/*!
\fn void QAbstractItemModel::columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
\fn void QAbstractItemModel::columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
This signal is emitted just before columns are removed from the model. The
items to be removed are those between \a start and \a end inclusive, under
items to be removed are those between \a first and \a last inclusive, under
the given \a parent item.
\note Components connected to this signal use it to adapt to changes in the

View File

@ -377,8 +377,7 @@ bool QAbstractProxyModel::hasChildren(const QModelIndex &parent) const
*/
QModelIndex QAbstractProxyModel::sibling(int row, int column, const QModelIndex &idx) const
{
Q_D(const QAbstractProxyModel);
return mapFromSource(d->model->sibling(row, column, mapToSource(idx)));
return index(row, column, idx.parent());
}
/*!

View File

@ -515,7 +515,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object)
\code
const bool wasBlocked = someQObject->blockSignals(true);
// no signals here
someQObject->blockSignals(false);
someQObject->blockSignals(wasBlocked);
\endcode
except the code using QSignalBlocker is safe in the face of

View File

@ -148,6 +148,7 @@ bool QSharedMemoryPrivate::create(int size)
// Create the file mapping.
#if defined(Q_OS_WINPHONE)
Q_UNIMPLEMENTED();
Q_UNUSED(size)
hand = 0;
#elif defined(Q_OS_WINRT)
hand = CreateFileMappingFromApp(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, size, (PCWSTR)nativeKey.utf16());
@ -169,6 +170,7 @@ bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode)
int permissions = (mode == QSharedMemory::ReadOnly ? FILE_MAP_READ : FILE_MAP_ALL_ACCESS);
#if defined(Q_OS_WINPHONE)
Q_UNIMPLEMENTED();
Q_UNUSED(mode)
memory = 0;
#elif defined(Q_OS_WINRT)
memory = (void *)MapViewOfFileFromApp(handle(), permissions, 0, 0);

View File

@ -92,7 +92,7 @@ public:
bool wait(int timeout = -1);
void wakeUp() Q_DECL_NOTHROW;
// Conrol the lifetime of the privates
// Control the lifetime of the privates
QAtomicInt refCount;
int id;

View File

@ -155,6 +155,7 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const
#elif defined(Q_OS_WINPHONE)
int size = 0;
Q_UNIMPLEMENTED();
Q_UNUSED(string)
#else // Q_OS_WINPHONE
int size = LCMapStringEx(LOCALE_NAME_USER_DEFAULT, LCMAP_SORTKEY | d->collator,
reinterpret_cast<LPCWSTR>(string.constData()), string.size(),

View File

@ -73,7 +73,7 @@ struct QFreeListElement
typedef T &ReferenceType;
T _t;
int next;
QAtomicInt next;
inline ConstReferenceType t() const { return _t; }
inline ReferenceType t() { return _t; }
@ -81,7 +81,7 @@ struct QFreeListElement
/*! \internal
Element in a QFreeList without a paylout. ConstReferenceType and
Element in a QFreeList without a payload. ConstReferenceType and
ReferenceType are void, the t() functions return void and are empty.
*/
template <>
@ -90,7 +90,7 @@ struct QFreeListElement<void>
typedef void ConstReferenceType;
typedef void ReferenceType;
int next;
QAtomicInt next;
inline void t() const { }
inline void t() { }
@ -172,7 +172,7 @@ class QFreeList
// qDebug("QFreeList: allocating %d elements (%ld bytes) with offset %d", size, size * sizeof(ElementType), offset);
ElementType *v = new ElementType[size];
for (int i = 0; i < size; ++i)
v[i].next = offset + i + 1;
v[i].next.store(offset + i + 1);
return v;
}
@ -254,7 +254,7 @@ inline int QFreeList<T, ConstantsType>::next()
}
}
newid = v[at].next | (id & ~ConstantsType::IndexMask);
newid = v[at].next.load() | (id & ~ConstantsType::IndexMask);
} while (!_next.testAndSetRelaxed(id, newid));
// qDebug("QFreeList::next(): returning %d (_next now %d, serial %d)",
// id & ConstantsType::IndexMask,
@ -273,7 +273,7 @@ inline void QFreeList<T, ConstantsType>::release(int id)
int x, newid;
do {
x = _next.loadAcquire();
v[at].next = x & ConstantsType::IndexMask;
v[at].next.store(x & ConstantsType::IndexMask);
newid = incrementserial(x, id);
} while (!_next.testAndSetRelease(x, newid));

View File

@ -663,10 +663,10 @@ QVariant QSystemLocalePrivate::uiLanguages()
unsigned int size;
languageList->get_Size(&size);
for (unsigned int i = 0; i < size; ++i) {
HSTRING language;
languageList->GetAt(i, &language);
HString language;
languageList->GetAt(i, language.GetAddressOf());
UINT32 length;
PCWSTR rawString = WindowsGetStringRawBuffer(language, &length);
PCWSTR rawString = language.GetRawBuffer(&length);
result << QString::fromWCharArray(rawString, length);
}
#else // !Q_OS_WINPHONE

View File

@ -102,9 +102,6 @@ struct Q_CORE_EXPORT QMapNodeBase
void setColor(Color c) { if (c == Black) p |= Black; else p &= ~Black; }
QMapNodeBase *parent() const { return reinterpret_cast<QMapNodeBase *>(p & ~Mask); }
void setParent(QMapNodeBase *pp) { p = (p & Mask) | quintptr(pp); }
QMapNodeBase *minimumNode() { QMapNodeBase *n = this; while (n->left) n = n->left; return n; }
const QMapNodeBase *minimumNode() const { const QMapNodeBase *n = this; while (n->left) n = n->left; return n; }
};
template <class Key, class T>
@ -121,9 +118,6 @@ struct QMapNode : public QMapNodeBase
inline QMapNode *nextNode() { return static_cast<QMapNode *>(QMapNodeBase::nextNode()); }
inline QMapNode *previousNode() { return static_cast<QMapNode *>(QMapNodeBase::previousNode()); }
QMapNode *minimumNode() { return static_cast<QMapNode *>(QMapNodeBase::minimumNode()); }
const QMapNode *minimumNode() const { return static_cast<QMapNode *>(QMapNodeBase::minimumNode()); }
QMapNode<Key, T> *copy(QMapData<Key, T> *d) const;
void destroySubTree();

View File

@ -13,7 +13,8 @@ exampledirs += ../../../examples/dbus \
snippets
headerdirs += ..
imagedirs += images
imagedirs += images \
../../../examples/dbus/doc/images
sourcedirs += .. \
../../../examples/dbus/doc/src
excludedirs += ../../../examples/widgets/doc
@ -44,11 +45,18 @@ qhp.QtDBus.indexTitle = Qt D-Bus
# Only update the name of the project for the next variables.
qhp.QtDBus.virtualFolder = qtdbus
qhp.QtDBus.subprojects = classes
qhp.QtDBus.subprojects = classes examples
qhp.QtDBus.subprojects.classes.title = C++ Classes
qhp.QtDBus.subprojects.classes.indexTitle = Qt D-Bus C++ Classes
qhp.QtDBus.subprojects.classes.selectors = class fake:headerfile
qhp.QtDBus.subprojects.classes.sortPages = true
qhp.QtDBus.subprojects.examples.title = Examples
qhp.QtDBus.subprojects.examples.indexTitle = Qt D-Bus Examples
qhp.QtDBus.subprojects.examples.selectors = fake:example
navigation.landingpage = "Qt D-Bus"
navigation.cppclassespage = "Qt D-Bus C++ Classes"
manifestmeta.thumbnail.names = "QtDBus/D-Bus List Names Example" \
"QtDBus/D-Bus Ping Pong Example" \
"QtDBus/D-Bus Complex Ping Pong Example" \

View File

@ -0,0 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\group examples-dbus
\title Qt D-Bus Examples
\brief Using D-Bus from Qt applications.
\ingroup all-examples
\l{Qt D-Bus} allows applications to send messages to each other using
D-Bus. This page lists examples which specifically use D-Bus for
inter-process communication (IPC).
*/

View File

@ -211,5 +211,6 @@
\li \l{The Qt D-Bus Type System}
\li \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
\li \l{Qt D-Bus C++ Classes}
\li \l{Qt D-Bus Examples}
\endlist
*/

View File

@ -107,7 +107,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
set(Qt5Gui_${_cmake_lib_name}_LIBRARY "${Qt5Gui_${_cmake_lib_name}_LIBRARY}/${_lib}")
!!ENDIF
if (WIN32 AND NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
# The above find_library call doesn't work for finding
# The above find_library call doesn\'t work for finding
# libraries in Windows SDK paths outside of the proper
# environment. Just add the library name to the result
# variable instead.

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@ -133,6 +133,68 @@ int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID l
}
#endif
static inline void initBitMapInfoHeader(int width, int height, bool topToBottom, BITMAPINFOHEADER *bih)
{
memset(bih, 0, sizeof(BITMAPINFOHEADER));
bih->biSize = sizeof(BITMAPINFOHEADER);
bih->biWidth = width;
bih->biHeight = topToBottom ? -height : height;
bih->biPlanes = 1;
bih->biBitCount = 32;
bih->biCompression = BI_RGB;
bih->biSizeImage = width * height * 4;
}
static inline void initBitMapInfo(int width, int height, bool topToBottom, BITMAPINFO *bmi)
{
initBitMapInfoHeader(width, height, topToBottom, &bmi->bmiHeader);
memset(bmi->bmiColors, 0, sizeof(RGBQUAD));
}
static inline uchar *getDiBits(HDC hdc, HBITMAP bitmap, int width, int height, bool topToBottom = true)
{
BITMAPINFO bmi;
initBitMapInfo(width, height, topToBottom, &bmi);
uchar *result = new uchar[bmi.bmiHeader.biSizeImage];
if (!GetDIBits(hdc, bitmap, 0, height, result, &bmi, DIB_RGB_COLORS)) {
delete [] result;
qErrnoWarning("%s: GetDIBits() failed to get bitmap bits.", __FUNCTION__);
return 0;
}
return result;
}
static inline void copyImageDataCreateAlpha(const uchar *data, QImage *target)
{
const uint mask = target->format() == QImage::Format_RGB32 ? 0xff000000 : 0;
const int height = target->height();
const int width = target->width();
const int bytesPerLine = width * int(sizeof(QRgb));
for (int y = 0; y < height; ++y) {
QRgb *dest = reinterpret_cast<QRgb *>(target->scanLine(y));
const QRgb *src = reinterpret_cast<const QRgb *>(data + y * bytesPerLine);
for (int x = 0; x < width; ++x) {
const uint pixel = src[x];
if ((pixel & 0xff000000) == 0 && (pixel & 0x00ffffff) != 0)
dest[x] = pixel | 0xff000000;
else
dest[x] = pixel | mask;
}
}
}
static inline void copyImageData(const uchar *data, QImage *target)
{
const int height = target->height();
const int bytesPerLine = target->bytesPerLine();
for (int y = 0; y < height; ++y) {
void *dest = static_cast<void *>(target->scanLine(y));
const void *src = data + y * bytesPerLine;
memcpy(dest, src, bytesPerLine);
}
}
enum HBitmapFormat
{
HBitmapNoAlpha,
@ -176,14 +238,7 @@ Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat =
// Define the header
BITMAPINFO bmi;
memset(&bmi, 0, sizeof(bmi));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = w;
bmi.bmiHeader.biHeight = -h;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = w * h * 4;
initBitMapInfo(w, h, true, &bmi);
// Create the pixmap
uchar *pixels = 0;
@ -227,31 +282,16 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat =
const int w = bitmap_info.bmWidth;
const int h = bitmap_info.bmHeight;
BITMAPINFO bmi;
memset(&bmi, 0, sizeof(bmi));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = w;
bmi.bmiHeader.biHeight = -h;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = w * h * 4;
// Get bitmap bits
QScopedArrayPointer<uchar> data(new uchar[bmi.bmiHeader.biSizeImage]);
HDC display_dc = GetDC(0);
if (!GetDIBits(display_dc, bitmap, 0, h, data.data(), &bmi, DIB_RGB_COLORS)) {
QScopedArrayPointer<uchar> data(getDiBits(display_dc, bitmap, w, h, true));
if (data.isNull()) {
ReleaseDC(0, display_dc);
qWarning("%s, failed to get bitmap bits", __FUNCTION__);
return QPixmap();
}
QImage::Format imageFormat = QImage::Format_ARGB32_Premultiplied;
uint mask = 0;
if (hbitmapFormat == HBitmapNoAlpha) {
imageFormat = QImage::Format_RGB32;
mask = 0xff000000;
}
const QImage::Format imageFormat = hbitmapFormat == HBitmapNoAlpha ?
QImage::Format_RGB32 : QImage::Format_ARGB32_Premultiplied;
// Create image and copy data into image.
QImage image(w, h, imageFormat);
@ -260,18 +300,7 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat =
qWarning("%s, failed create image of %dx%d", __FUNCTION__, w, h);
return QPixmap();
}
const int bytes_per_line = w * sizeof(QRgb);
for (int y = 0; y < h; ++y) {
QRgb *dest = (QRgb *) image.scanLine(y);
const QRgb *src = (const QRgb *) (data.data() + y * bytes_per_line);
for (int x = 0; x < w; ++x) {
const uint pixel = src[x];
if ((pixel & 0xff000000) == 0 && (pixel & 0x00ffffff) != 0)
dest[x] = pixel | 0xff000000;
else
dest[x] = pixel | mask;
}
}
copyImageDataCreateAlpha(data.data(), &image);
ReleaseDC(0, display_dc);
return QPixmap::fromImage(image);
}
@ -307,32 +336,25 @@ Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p)
Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h)
{
BITMAPINFO bmi;
memset(&bmi, 0, sizeof(bmi));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = w;
bmi.bmiHeader.biHeight = -h;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = w * h * 4;
QImage image(w, h, QImage::Format_ARGB32_Premultiplied);
if (image.isNull())
return image;
// Get bitmap bits
QScopedArrayPointer<uchar> data(new uchar [bmi.bmiHeader.biSizeImage]);
if (!GetDIBits(hdc, bitmap, 0, h, data.data(), &bmi, DIB_RGB_COLORS)) {
qErrnoWarning("%s: failed to get bitmap bits", __FUNCTION__);
QScopedArrayPointer<uchar> data(getDiBits(hdc, bitmap, w, h, true));
if (data.isNull())
return QImage();
}
// Create image and copy data into image.
for (int y = 0; y < h; ++y) {
void *dest = (void *) image.scanLine(y);
void *src = data.data() + y * image.bytesPerLine();
memcpy(dest, src, image.bytesPerLine());
}
copyImageDataCreateAlpha(data.data(), &image);
return image;
}
static QImage qt_imageFromWinIconHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h)
{
QImage image(w, h, QImage::Format_ARGB32_Premultiplied);
if (image.isNull())
return image;
QScopedArrayPointer<uchar> data(getDiBits(hdc, bitmap, w, h, true));
if (data.isNull())
return QImage();
copyImageData(data.data(), &image);
return image;
}
@ -354,23 +376,13 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon)
const int h = iconinfo.yHotspot * 2;
BITMAPINFOHEADER bitmapInfo;
bitmapInfo.biSize = sizeof(BITMAPINFOHEADER);
bitmapInfo.biWidth = w;
bitmapInfo.biHeight = h;
bitmapInfo.biPlanes = 1;
bitmapInfo.biBitCount = 32;
bitmapInfo.biCompression = BI_RGB;
bitmapInfo.biSizeImage = 0;
bitmapInfo.biXPelsPerMeter = 0;
bitmapInfo.biYPelsPerMeter = 0;
bitmapInfo.biClrUsed = 0;
bitmapInfo.biClrImportant = 0;
initBitMapInfoHeader(w, h, false, &bitmapInfo);
DWORD* bits;
HBITMAP winBitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bitmapInfo, DIB_RGB_COLORS, (VOID**)&bits, NULL, 0);
HGDIOBJ oldhdc = (HBITMAP)SelectObject(hdc, winBitmap);
DrawIconEx( hdc, 0, 0, icon, iconinfo.xHotspot * 2, iconinfo.yHotspot * 2, 0, 0, DI_NORMAL);
QImage image = qt_imageFromWinHBITMAP(hdc, winBitmap, w, h);
QImage image = qt_imageFromWinIconHBITMAP(hdc, winBitmap, w, h);
for (int y = 0 ; y < h && !foundAlpha ; y++) {
const QRgb *scanLine= reinterpret_cast<const QRgb *>(image.scanLine(y));
@ -384,7 +396,7 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon)
if (!foundAlpha) {
//If no alpha was found, we use the mask to set alpha values
DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_MASK);
const QImage mask = qt_imageFromWinHBITMAP(hdc, winBitmap, w, h);
const QImage mask = qt_imageFromWinIconHBITMAP(hdc, winBitmap, w, h);
for (int y = 0 ; y < h ; y++){
QRgb *scanlineImage = reinterpret_cast<QRgb *>(image.scanLine(y));

View File

@ -40,6 +40,7 @@
****************************************************************************/
#include "qsurface.h"
#include "qopenglcontext.h"
QT_BEGIN_NAMESPACE
@ -130,6 +131,11 @@ QSurface::QSurface(SurfaceClass type)
*/
QSurface::~QSurface()
{
#ifndef QT_NO_OPENGL
QOpenGLContext *context = QOpenGLContext::currentContext();
if (context && context->surface() == this)
context->doneCurrent();
#endif
}
/*!

View File

@ -453,10 +453,19 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi
if (samples == 0) {
initTexture(texture_target, internal_format, size, mipmap);
} else {
GLenum storageFormat = internal_format;
#ifdef GL_RGBA8_OES
// Correct the internal format used by the render buffer when using ANGLE
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES && internal_format == GL_RGBA
&& strstr((const char *)funcs.glGetString(GL_RENDERER), "ANGLE") != 0) {
storageFormat = GL_RGBA8_OES;
}
#endif
mipmap = false;
funcs.glGenRenderbuffers(1, &color_buffer);
funcs.glBindRenderbuffer(GL_RENDERBUFFER, color_buffer);
funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, internal_format, size.width(), size.height());
funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, storageFormat, size.width(), size.height());
funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER, color_buffer);
QT_CHECK_GLERROR();

View File

@ -381,6 +381,10 @@ static int qt_gl_resolve_extensions()
// TODO: Consider matching GL_APPLE_texture_format_BGRA8888 as well, but it needs testing.
if (extensionMatcher.match("GL_IMG_texture_format_BGRA8888") || extensionMatcher.match("GL_EXT_texture_format_BGRA8888"))
extensions |= QOpenGLExtensions::BGRATextureFormat;
if (extensionMatcher.match("GL_ANGLE_framebuffer_blit"))
extensions |= QOpenGLExtensions::FramebufferBlit;
if (extensionMatcher.match("GL_ANGLE_framebuffer_multisample"))
extensions |= QOpenGLExtensions::FramebufferMultisample;
} else {
extensions |= QOpenGLExtensions::ElementIndexUint | QOpenGLExtensions::MapBuffer;
@ -3150,7 +3154,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveBlitFramebuffer(GLint srcX0, GLint
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter)
{
RESOLVE_FUNC_VOID(ResolveEXT, BlitFramebuffer)
RESOLVE_FUNC_VOID_WITH_ALTERNATE(ResolveEXT, BlitFramebuffer, BlitFramebufferANGLE)
(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
}
@ -3158,7 +3162,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveRenderbufferStorageMultisample(GLen
GLenum internalFormat,
GLsizei width, GLsizei height)
{
RESOLVE_FUNC_VOID(ResolveEXT, RenderbufferStorageMultisample)
RESOLVE_FUNC_VOID_WITH_ALTERNATE(ResolveEXT, RenderbufferStorageMultisample, RenderbufferStorageMultisampleANGLE)
(target, samples, internalFormat, width, height);
}

View File

@ -2447,7 +2447,9 @@ bool QOpenGLTexture::isFixedSamplePositions() const
void QOpenGLTexture::allocateStorage()
{
Q_D(QOpenGLTexture);
d->allocateStorage();
if (d->create()) {
d->allocateStorage();
}
}
/*!
@ -2805,33 +2807,49 @@ bool QOpenGLTexture::hasFeature(Feature feature)
if (!ctx->isOpenGLES()) {
switch (feature) {
case ImmutableMultisampleStorage:
supported = f.version() >= qMakePair(4, 3)
|| ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_storage_multisample"));
break;
case TextureBuffer:
supported = f.version() >= qMakePair(4, 3)
|| (ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_buffer_object"))
&& ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_buffer_range")));
break;
case StencilTexturing:
supported = f.version() >= qMakePair(4, 3);
supported = f.version() >= qMakePair(4, 3)
|| ctx->hasExtension(QByteArrayLiteral("GL_ARB_stencil_texturing"));
break;
case ImmutableStorage:
supported = f.version() >= qMakePair(4, 2);
supported = f.version() >= qMakePair(4, 2)
|| ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_storage"));
break;
case TextureCubeMapArrays:
supported = f.version() >= qMakePair(4, 0);
supported = f.version() >= qMakePair(4, 0)
|| ctx->hasExtension(QByteArrayLiteral("ARB_texture_cube_map_array"));
break;
case Swizzle:
supported = f.version() >= qMakePair(3, 3);
supported = f.version() >= qMakePair(3, 3)
|| ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_swizzle"));
break;
case TextureMultisample:
supported = f.version() >= qMakePair(3, 2);
supported = f.version() >= qMakePair(3, 2)
|| ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_multisample"));
break;
case TextureArrays:
supported = f.version() >= qMakePair(3, 0);
supported = f.version() >= qMakePair(3, 0)
|| ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_array"));
break;
case TextureRectangle:
supported = f.version() >= qMakePair(2, 1);
supported = f.version() >= qMakePair(2, 1)
|| ctx->hasExtension(QByteArrayLiteral("ARB_texture_rectangle"));
break;
case Texture3D:
@ -3162,7 +3180,7 @@ void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode)
Q_ASSERT(d->texFuncs);
Q_ASSERT(d->textureId);
if (!d->features.testFlag(StencilTexturing)) {
qWarning("QOpenGLTexture::setDepthStencilMode() requires OpenGL >= 4.3");
qWarning("QOpenGLTexture::setDepthStencilMode() requires OpenGL >= 4.3 or GL_ARB_stencil_texturing");
return;
}
d->depthStencilMode = mode;

View File

@ -87,6 +87,7 @@ QOpenGLTextureGlyphCache::~QOpenGLTextureGlyphCache()
#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG
qDebug(" -> ~QOpenGLTextureGlyphCache() %p.", this);
#endif
clear();
}
static inline bool isCoreProfile()
@ -447,7 +448,8 @@ int QOpenGLTextureGlyphCache::maxTextureHeight() const
void QOpenGLTextureGlyphCache::clear()
{
m_textureResource->free();
if (m_textureResource)
m_textureResource->free();
m_textureResource = 0;
m_w = 0;

View File

@ -2603,7 +2603,7 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx
return;
}
}
} else if (d->deviceDepth == 32 && (depth == 8 || depth == 32)) {
} else if (d->deviceDepth == 32 && ((depth == 8 && s->penData.alphamapBlit) || (depth == 32 && s->penData.alphaRGBBlit))) {
// (A)RGB Alpha mask where the alpha component is not used.
if (!clip) {
int nx = qMax(0, rx);
@ -2626,13 +2626,12 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx
rx = nx;
ry = ny;
}
if (depth == 8 && s->penData.alphamapBlit) {
if (depth == 8)
s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color,
scanline, w, h, bpl, clip);
} else if (depth == 32 && s->penData.alphaRGBBlit) {
else if (depth == 32)
s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color,
(const uint *) scanline, w, h, bpl / 4, clip);
}
return;
}
}

View File

@ -657,7 +657,8 @@ void QNetworkReply::setSslConfiguration(const QSslConfiguration &config)
If this function is called, the SSL errors given in \a errors
will be ignored.
Note that you can set the expected certificate in the SSL error:
\note Because most SSL errors are associated with a certificate, for most
of them you must set the expected certificate this SSL error is related to.
If, for instance, you want to issue a request to a server that uses
a self-signed certificate, consider the following snippet:

View File

@ -98,9 +98,9 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &datagramSocketStatics);
IAsyncOperation<IVectorView<EndpointPair*> *> *op;
HSTRING proto;
WindowsCreateString(L"0", 1, &proto);
datagramSocketStatics->GetEndpointPairsAsync(host, proto, &op);
datagramSocketStatics->GetEndpointPairsAsync(host,
HString::MakeReference(L"0").Get(),
&op);
datagramSocketStatics->Release();
host->Release();
@ -134,11 +134,11 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
|| (type == HostNameType_Ipv6 && requestType == QDnsLookup::A))))
continue;
HSTRING name;
remoteHost->get_CanonicalName(&name);
HString name;
remoteHost->get_CanonicalName(name.GetAddressOf());
remoteHost->Release();
UINT32 length;
PCWSTR rawString = WindowsGetStringRawBuffer(name, &length);
PCWSTR rawString = name.GetRawBuffer(&length);
QDnsHostAddressRecord record;
record.d->name = aceHostname;
record.d->value = QHostAddress(QString::fromWCharArray(rawString, length));

View File

@ -453,6 +453,8 @@ QHostAddress::QHostAddress(const struct sockaddr *sockaddr)
setAddress(htonl(((sockaddr_in *)sockaddr)->sin_addr.s_addr));
else if (sockaddr->sa_family == AF_INET6)
setAddress(((qt_sockaddr_in6 *)sockaddr)->sin6_addr.qt_s6_addr);
#else
Q_UNUSED(sockaddr)
#endif
}
@ -612,6 +614,8 @@ void QHostAddress::setAddress(const struct sockaddr *sockaddr)
setAddress(htonl(((sockaddr_in *)sockaddr)->sin_addr.s_addr));
else if (sockaddr->sa_family == AF_INET6)
setAddress(((qt_sockaddr_in6 *)sockaddr)->sin6_addr.qt_s6_addr);
#else
Q_UNUSED(sockaddr)
#endif
}

View File

@ -84,7 +84,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
HStringReference classId(RuntimeClass_Windows_Networking_HostName);
if (FAILED(GetActivationFactory(classId.Get(), &hostnameFactory)))
Q_ASSERT(false, "Could not obtain hostname factory.");
Q_ASSERT_X(false, "QHostInfoAgent", "Could not obtain hostname factory.");
IHostName *host;
HStringReference hostNameRef((const wchar_t*)hostName.utf16());
@ -95,9 +95,9 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &datagramSocketStatics);
IAsyncOperation<IVectorView<EndpointPair*> *> *op;
HSTRING proto;
WindowsCreateString(L"0", 1, &proto);
datagramSocketStatics->GetEndpointPairsAsync(host, proto, &op);
datagramSocketStatics->GetEndpointPairsAsync(host,
HString::MakeReference(L"0").Get(),
&op);
datagramSocketStatics->Release();
host->Release();
@ -131,11 +131,11 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
if (type == HostNameType_DomainName)
continue;
HSTRING name;
remoteHost->get_CanonicalName(&name);
HString name;
remoteHost->get_CanonicalName(name.GetAddressOf());
remoteHost->Release();
UINT32 length;
PCWSTR rawString = WindowsGetStringRawBuffer(name, &length);
PCWSTR rawString = name.GetRawBuffer(&length);
QHostAddress addr;
addr.setAddress(QString::fromWCharArray(rawString, length));
if (!addresses.contains(addr))
@ -170,22 +170,22 @@ QString QHostInfo::localHostName()
if (type != HostNameType_DomainName)
continue;
HSTRING name;
hostName->get_CanonicalName(&name);
HString name;
hostName->get_CanonicalName(name.GetAddressOf());
hostName->Release();
UINT32 length;
PCWSTR rawString = WindowsGetStringRawBuffer(name, &length);
PCWSTR rawString = name.GetRawBuffer(&length);
return QString::fromWCharArray(rawString, length);
}
IHostName *firstHost;
hostNames->GetAt(0, &firstHost);
hostNames->Release();
HSTRING name;
firstHost->get_CanonicalName(&name);
HString name;
firstHost->get_CanonicalName(name.GetAddressOf());
firstHost->Release();
UINT32 length;
PCWSTR rawString = WindowsGetStringRawBuffer(name, &length);
PCWSTR rawString = name.GetRawBuffer(&length);
return QString::fromWCharArray(rawString, length);
}

View File

@ -114,11 +114,11 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
|| (type == HostNameType_Ipv6 && hostInfo.prefixLength > 128))
continue;
HSTRING name;
hostName->get_CanonicalName(&name);
HString name;
hostName->get_CanonicalName(name.GetAddressOf());
hostName->Release();
UINT32 length;
PCWSTR rawString = WindowsGetStringRawBuffer(name, &length);
PCWSTR rawString = name.GetRawBuffer(&length);
hostInfo.address = QString::fromWCharArray(rawString, length);
hostList << hostInfo;

View File

@ -111,13 +111,15 @@ static inline void qt_socket_getPortAndAddress(const qt_sockaddr *s, quint16 *po
QHostAddress tmpAddress;
tmpAddress.setAddress(tmp);
*addr = tmpAddress;
if (s->a6.sin6_scope_id) {
#ifndef QT_NO_IPV6IFNAME
char scopeid[IFNAMSIZ];
if (::if_indextoname(s->a6.sin6_scope_id, scopeid)) {
addr->setScopeId(QLatin1String(scopeid));
} else
char scopeid[IFNAMSIZ];
if (::if_indextoname(s->a6.sin6_scope_id, scopeid)) {
addr->setScopeId(QLatin1String(scopeid));
} else
#endif
addr->setScopeId(QString::number(s->a6.sin6_scope_id));
addr->setScopeId(QString::number(s->a6.sin6_scope_id));
}
}
if (port)
*port = ntohs(s->a6.sin6_port);

View File

@ -182,7 +182,8 @@ static inline void qt_socket_getPortAndAddress(SOCKET socketDescriptor, const qt
if (address) {
QHostAddress a;
a.setAddress(tmp);
a.setScopeId(QString::number(sa6->sin6_scope_id));
if (sa6->sin6_scope_id)
a.setScopeId(QString::number(sa6->sin6_scope_id));
*address = a;
}
if (port)

View File

@ -124,10 +124,10 @@ struct SocketHandler
Q_GLOBAL_STATIC(SocketHandler, gSocketHandler)
QString qt_QStringFromHSTRING(HSTRING string)
static inline QString qt_QStringFromHString(const HString &string)
{
UINT32 length;
PCWSTR rawString = WindowsGetStringRawBuffer(string, &length);
PCWSTR rawString = string.GetRawBuffer(&length);
return QString::fromWCharArray(rawString, length);
}
@ -604,13 +604,13 @@ qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxlen, QHostAddress
for (int i = 0; i < d->pendingDatagrams.size(); ++i) {
IDatagramSocketMessageReceivedEventArgs *arg = d->pendingDatagrams.at(i);
ComPtr<IHostName> remoteHost;
HSTRING remoteHostString;
HSTRING remotePort;
HString remoteHostString;
HString remotePort;
arg->get_RemoteAddress(&remoteHost);
arg->get_RemotePort(&remotePort);
remoteHost->get_CanonicalName(&remoteHostString);
returnAddress.setAddress(qt_QStringFromHSTRING(remoteHostString));
returnPort = qt_QStringFromHSTRING(remotePort).toInt();
arg->get_RemotePort(remotePort.GetAddressOf());
remoteHost->get_CanonicalName(remoteHostString.GetAddressOf());
returnAddress.setAddress(qt_QStringFromHString(remoteHostString));
returnPort = qt_QStringFromHString(remotePort).toInt();
ComPtr<IDataReader> reader;
arg->GetDataReader(&reader);
if (!reader)
@ -1097,7 +1097,7 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
if (socketType == QAbstractSocket::TcpSocket) {
ComPtr<IHostName> hostName;
HSTRING tmpHString;
HString tmpHString;
ComPtr<IStreamSocketInformation> info;
if (FAILED(tcp->get_Information(&info))) {
qWarning("QNativeSocketEnginePrivate::fetchConnectionParameters: Could not obtain socket info");
@ -1105,28 +1105,28 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
}
info->get_LocalAddress(&hostName);
if (hostName) {
hostName->get_CanonicalName(&tmpHString);
localAddress.setAddress(qt_QStringFromHSTRING(tmpHString));
info->get_LocalPort(&tmpHString);
localPort = qt_QStringFromHSTRING(tmpHString).toInt();
hostName->get_CanonicalName(tmpHString.GetAddressOf());
localAddress.setAddress(qt_QStringFromHString(tmpHString));
info->get_LocalPort(tmpHString.GetAddressOf());
localPort = qt_QStringFromHString(tmpHString).toInt();
}
if (!localPort && tcpListener) {
ComPtr<IStreamSocketListenerInformation> listenerInfo = 0;
tcpListener->get_Information(&listenerInfo);
listenerInfo->get_LocalPort(&tmpHString);
localPort = qt_QStringFromHSTRING(tmpHString).toInt();
listenerInfo->get_LocalPort(tmpHString.GetAddressOf());
localPort = qt_QStringFromHString(tmpHString).toInt();
localAddress == QHostAddress::Any;
}
info->get_RemoteAddress(&hostName);
if (hostName) {
hostName->get_CanonicalName(&tmpHString);
peerAddress.setAddress(qt_QStringFromHSTRING(tmpHString));
info->get_RemotePort(&tmpHString);
peerPort = qt_QStringFromHSTRING(tmpHString).toInt();
hostName->get_CanonicalName(tmpHString.GetAddressOf());
peerAddress.setAddress(qt_QStringFromHString(tmpHString));
info->get_RemotePort(tmpHString.GetAddressOf());
peerPort = qt_QStringFromHString(tmpHString).toInt();
}
} else if (socketType == QAbstractSocket::UdpSocket) {
ComPtr<IHostName> hostName;
HSTRING tmpHString;
HString tmpHString;
ComPtr<IDatagramSocketInformation> info;
if (FAILED(udp->get_Information(&info))) {
qWarning("QNativeSocketEnginePrivate::fetchConnectionParameters: Could not obtain socket information");
@ -1134,18 +1134,18 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
}
info->get_LocalAddress(&hostName);
if (hostName) {
hostName->get_CanonicalName(&tmpHString);
localAddress.setAddress(qt_QStringFromHSTRING(tmpHString));
info->get_LocalPort(&tmpHString);
localPort = qt_QStringFromHSTRING(tmpHString).toInt();
hostName->get_CanonicalName(tmpHString.GetAddressOf());
localAddress.setAddress(qt_QStringFromHString(tmpHString));
info->get_LocalPort(tmpHString.GetAddressOf());
localPort = qt_QStringFromHString(tmpHString).toInt();
}
info->get_RemoteAddress(&hostName);
if (hostName) {
hostName->get_CanonicalName(&tmpHString);
peerAddress.setAddress(qt_QStringFromHSTRING(tmpHString));
info->get_RemotePort(&tmpHString);
peerPort = qt_QStringFromHSTRING(tmpHString).toInt();
hostName->get_CanonicalName(tmpHString.GetAddressOf());
peerAddress.setAddress(qt_QStringFromHString(tmpHString));
info->get_RemotePort(tmpHString.GetAddressOf());
peerPort = qt_QStringFromHString(tmpHString).toInt();
}
}
return true;
@ -1159,7 +1159,7 @@ HRESULT QNativeSocketEnginePrivate::handleBindCompleted(IAsyncAction *, AsyncSta
HRESULT QNativeSocketEnginePrivate::handleClientConnection(IStreamSocketListener *listener, IStreamSocketListenerConnectionReceivedEventArgs *args)
{
Q_Q(QNativeSocketEngine);
Q_ASSERT(tcpListener.Get() == listener);
Q_UNUSED(listener)
IStreamSocket *socket;
args->get_Socket(&socket);
pendingConnections.append(socket);
@ -1253,7 +1253,7 @@ HRESULT QNativeSocketEnginePrivate::handleWriteCompleted(IAsyncOperationWithProg
HRESULT QNativeSocketEnginePrivate::handleNewDatagram(IDatagramSocket *socket, IDatagramSocketMessageReceivedEventArgs *args)
{
Q_Q(QNativeSocketEngine);
Q_ASSERT(udp == socket);
Q_UNUSED(socket)
pendingDatagrams.append(args);
emit q->readReady();

View File

@ -777,6 +777,8 @@ void QSslSocket::close()
qDebug() << "QSslSocket::close()";
#endif
Q_D(QSslSocket);
if (encryptedBytesToWrite())
flush();
if (d->plainSocket)
d->plainSocket->close();
QTcpSocket::close();
@ -1810,7 +1812,8 @@ void QSslSocket::ignoreSslErrors()
This method tells QSslSocket to ignore only the errors given in \a
errors.
Note that you can set the expected certificate in the SSL error:
\note Because most SSL errors are associated with a certificate, for most
of them you must set the expected certificate this SSL error is related to.
If, for instance, you want to connect to a server that uses
a self-signed certificate, consider the following snippet:

View File

@ -58,8 +58,6 @@
QT_BEGIN_NAMESPACE
static QDBusConnection dbusConnection = QDBusConnection::systemBus();
class QNetworkManagerInterfacePrivate
{
public:
@ -74,7 +72,7 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
QLatin1String(NM_DBUS_PATH),
QLatin1String(NM_DBUS_INTERFACE),
dbusConnection);
QDBusConnection::systemBus());
if (!d->connectionInterface->isValid()) {
d->valid = false;
return;
@ -103,6 +101,9 @@ bool QNetworkManagerInterface::setConnections()
{
if(!isValid() )
return false;
QDBusConnection dbusConnection = QDBusConnection::systemBus();
bool allOk = false;
if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
QLatin1String(NM_DBUS_PATH),
@ -198,7 +199,7 @@ QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const Q
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
dbusConnection);
QDBusConnection::systemBus());
if (!d->connectionInterface->isValid()) {
d->valid = false;
return;
@ -229,7 +230,7 @@ bool QNetworkManagerInterfaceAccessPoint::setConnections()
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(QString,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)));
if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
QLatin1String("PropertiesChanged"),
@ -306,7 +307,7 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
QLatin1String(NM_DBUS_INTERFACE_DEVICE),
dbusConnection);
QDBusConnection::systemBus());
if (!d->connectionInterface->isValid()) {
d->valid = false;
return;
@ -335,7 +336,7 @@ bool QNetworkManagerInterfaceDevice::setConnections()
nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper,SIGNAL(pathForStateChanged(QString,quint32)),
this, SIGNAL(stateChanged(QString,quint32)));
if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
QLatin1String(NM_DBUS_INTERFACE_DEVICE),
QLatin1String("StateChanged"),
@ -397,7 +398,7 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
dbusConnection, parent);
QDBusConnection::systemBus(), parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
return;
@ -428,7 +429,7 @@ bool QNetworkManagerInterfaceDeviceWired::setConnections()
nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(QString,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)));
if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
QLatin1String("PropertiesChanged"),
@ -474,7 +475,7 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
dbusConnection, parent);
QDBusConnection::systemBus(), parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
return;
@ -498,6 +499,7 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections()
if(!isValid() )
return false;
QDBusConnection dbusConnection = QDBusConnection::systemBus();
bool allOk = false;
delete nmDBusHelper;
nmDBusHelper = new QNmDBusHelper(this);
@ -591,7 +593,7 @@ QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService,
d->connectionInterface = new QDBusInterface(settingsService,
QLatin1String(NM_DBUS_PATH_SETTINGS),
QLatin1String(NM_DBUS_IFACE_SETTINGS),
dbusConnection);
QDBusConnection::systemBus());
if (!d->connectionInterface->isValid()) {
d->valid = false;
return;
@ -614,7 +616,7 @@ bool QNetworkManagerSettings::setConnections()
{
bool allOk = false;
if (!dbusConnection.connect(d->path, QLatin1String(NM_DBUS_PATH_SETTINGS),
if (!QDBusConnection::systemBus().connect(d->path, QLatin1String(NM_DBUS_PATH_SETTINGS),
QLatin1String(NM_DBUS_IFACE_SETTINGS), QLatin1String("NewConnection"),
this, SIGNAL(newConnection(QDBusObjectPath)))) {
allOk = true;
@ -655,7 +657,7 @@ QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QStri
d->connectionInterface = new QDBusInterface(settingsService,
d->path,
QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
dbusConnection, parent);
QDBusConnection::systemBus(), parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
return;
@ -681,6 +683,7 @@ bool QNetworkManagerSettingsConnection::setConnections()
if(!isValid() )
return false;
QDBusConnection dbusConnection = QDBusConnection::systemBus();
bool allOk = false;
if(!dbusConnection.connect(d->service, d->path,
QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), QLatin1String("Updated"),
@ -808,7 +811,7 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
dbusConnection, parent);
QDBusConnection::systemBus(), parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
return;
@ -837,7 +840,7 @@ bool QNetworkManagerConnectionActive::setConnections()
nmDBusHelper = new QNmDBusHelper(this);
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(QString,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)));
if(dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
d->path,
QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
QLatin1String("PropertiesChanged"),
@ -902,7 +905,7 @@ QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectP
d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
d->path,
QLatin1String(NM_DBUS_INTERFACE_IP4_CONFIG),
dbusConnection, parent);
QDBusConnection::systemBus(), parent);
if (!d->connectionInterface->isValid()) {
d->valid = false;
return;

View File

@ -56,6 +56,18 @@ static const char m_methodErrorMsg[] = "Can't find method \"%s%s\"";
namespace QtAndroidAccessibility
{
static jmethodID m_addActionMethodID = 0;
static jmethodID m_setCheckableMethodID = 0;
static jmethodID m_setCheckedMethodID = 0;
static jmethodID m_setClickableMethodID = 0;
static jmethodID m_setContentDescriptionMethodID = 0;
static jmethodID m_setEnabledMethodID = 0;
static jmethodID m_setFocusableMethodID = 0;
static jmethodID m_setFocusedMethodID = 0;
static jmethodID m_setTextSelectionMethodID = 0;
static jmethodID m_setVisibleToUserMethodID = 0;
static void setActive(JNIEnv */*env*/, jobject /*thiz*/, jboolean active)
{
QAndroidPlatformIntegration *platformIntegration = QtAndroid::androidPlatformIntegration();
@ -164,17 +176,6 @@ if (!clazz) { \
//__android_log_print(ANDROID_LOG_FATAL, m_qtTag, m_methodErrorMsg, METHOD_NAME, METHOD_SIGNATURE);
#define CALL_METHOD(OBJECT, METHOD_NAME, METHOD_SIGNATURE, ...) \
{ \
jclass clazz = env->GetObjectClass(OBJECT); \
jmethodID method = env->GetMethodID(clazz, METHOD_NAME, METHOD_SIGNATURE); \
if (!method) { \
__android_log_print(ANDROID_LOG_WARN, m_qtTag, m_methodErrorMsg, METHOD_NAME, METHOD_SIGNATURE); \
return false; \
} \
env->CallVoidMethod(OBJECT, method, __VA_ARGS__); \
}
static jstring descriptionForAccessibleObject(JNIEnv *env, jobject /*thiz*/, jint objectId)
{
@ -210,30 +211,30 @@ if (!clazz) { \
int startSelection;
int endSelection;
textIface->selection(0, &startSelection, &endSelection);
CALL_METHOD(node, "setTextSelection", "(II)V", startSelection, endSelection)
env->CallVoidMethod(node, m_setTextSelectionMethodID, startSelection, endSelection);
}
}
CALL_METHOD(node, "setEnabled", "(Z)V", !state.disabled)
CALL_METHOD(node, "setFocusable", "(Z)V", (bool)state.focusable)
CALL_METHOD(node, "setFocused", "(Z)V", (bool)state.focused)
CALL_METHOD(node, "setCheckable", "(Z)V", (bool)state.checkable)
CALL_METHOD(node, "setChecked", "(Z)V", (bool)state.checked)
CALL_METHOD(node, "setVisibleToUser", "(Z)V", !state.invisible)
env->CallVoidMethod(node, m_setEnabledMethodID, !state.disabled);
env->CallVoidMethod(node, m_setCheckedMethodID, (bool)state.checked);
env->CallVoidMethod(node, m_setFocusableMethodID, (bool)state.focusable);
env->CallVoidMethod(node, m_setFocusedMethodID, (bool)state.focused);
env->CallVoidMethod(node, m_setCheckableMethodID, (bool)state.checkable);
env->CallVoidMethod(node, m_setVisibleToUserMethodID, !state.invisible);
if (iface->actionInterface()) {
QStringList actions = iface->actionInterface()->actionNames();
bool clickable = actions.contains(QAccessibleActionInterface::pressAction());
bool toggle = actions.contains(QAccessibleActionInterface::toggleAction());
if (clickable || toggle) {
CALL_METHOD(node, "setClickable", "(Z)V", (bool)clickable)
CALL_METHOD(node, "addAction", "(I)V", 16) // ACTION_CLICK defined in AccessibilityNodeInfo
env->CallVoidMethod(node, m_setClickableMethodID, (bool)clickable);
env->CallVoidMethod(node, m_addActionMethodID, (int)16); // ACTION_CLICK defined in AccessibilityNodeInfo
}
}
jstring jdesc = env->NewString((jchar*) desc.constData(), (jsize) desc.size());
//CALL_METHOD(node, "setText", "(Ljava/lang/CharSequence;)V", jdesc)
CALL_METHOD(node, "setContentDescription", "(Ljava/lang/CharSequence;)V", jdesc)
env->CallVoidMethod(node, m_setContentDescriptionMethodID, jdesc);
return true;
}
@ -249,6 +250,13 @@ if (!clazz) { \
{"clickAction", "(I)Z", (void*)clickAction},
};
#define GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
VAR = env->GetMethodID(CLASS, METHOD_NAME, METHOD_SIGNATURE); \
if (!VAR) { \
__android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(), QtAndroid::methodErrorMsgFmt(), METHOD_NAME, METHOD_SIGNATURE); \
return false; \
}
bool registerNatives(JNIEnv *env)
{
jclass clazz;
@ -260,6 +268,18 @@ if (!clazz) { \
return false;
}
jclass nodeInfoClass = env->FindClass("android/view/accessibility/AccessibilityNodeInfo");
GET_AND_CHECK_STATIC_METHOD(m_addActionMethodID, nodeInfoClass, "addAction", "(I)V");
GET_AND_CHECK_STATIC_METHOD(m_setCheckableMethodID, nodeInfoClass, "setCheckable", "(Z)V");
GET_AND_CHECK_STATIC_METHOD(m_setCheckedMethodID, nodeInfoClass, "setChecked", "(Z)V");
GET_AND_CHECK_STATIC_METHOD(m_setClickableMethodID, nodeInfoClass, "setClickable", "(Z)V");
GET_AND_CHECK_STATIC_METHOD(m_setContentDescriptionMethodID, nodeInfoClass, "setContentDescription", "(Ljava/lang/CharSequence;)V");
GET_AND_CHECK_STATIC_METHOD(m_setEnabledMethodID, nodeInfoClass, "setEnabled", "(Z)V");
GET_AND_CHECK_STATIC_METHOD(m_setFocusableMethodID, nodeInfoClass, "setFocusable", "(Z)V");
GET_AND_CHECK_STATIC_METHOD(m_setFocusedMethodID, nodeInfoClass, "setFocused", "(Z)V");
GET_AND_CHECK_STATIC_METHOD(m_setTextSelectionMethodID, nodeInfoClass, "setTextSelection", "(II)V");
GET_AND_CHECK_STATIC_METHOD(m_setVisibleToUserMethodID, nodeInfoClass, "setVisibleToUser", "(Z)V");
return true;
}
}

View File

@ -573,8 +573,11 @@ static void updateWindow(JNIEnv */*env*/, jobject /*thiz*/)
return;
if (QGuiApplication::instance() != 0) {
foreach (QWindow *w, QGuiApplication::topLevelWindows())
QWindowSystemInterface::handleExposeEvent(w, QRegion(w->geometry()));
foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
QRect availableGeometry = w->screen()->availableGeometry();
if (w->geometry().width() > 0 && w->geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
QWindowSystemInterface::handleExposeEvent(w, QRegion(w->geometry()));
}
}
QAndroidPlatformScreen *screen = static_cast<QAndroidPlatformScreen *>(m_androidPlatformIntegration->screen());

View File

@ -472,12 +472,24 @@ void QAndroidInputContext::updateCursorPosition()
if (m_composingText.isEmpty() != (m_composingTextStart == -1))
qWarning() << "Input method out of sync" << m_composingText << m_composingTextStart;
// Qt's idea of the cursor position is the start of the preedit area, so we have to maintain our own preedit cursor pos
int realCursorPosition = cursorPos;
int realAnchorPosition = cursorPos;
int cpos = query->value(Qt::ImCursorPosition).toInt();
int anchor = query->value(Qt::ImAnchorPosition).toInt();
if (cpos != anchor) {
if (!m_composingText.isEmpty()) {
qWarning("Selecting text while preediting may give unpredictable results.");
finishComposingText();
}
int blockPos = getBlockPosition(query);
realCursorPosition = blockPos + cpos;
realAnchorPosition = blockPos + anchor;
}
// Qt's idea of the cursor position is the start of the preedit area, so we maintain our own preedit cursor pos
if (!m_composingText.isEmpty())
realCursorPosition = m_composingCursor;
QtAndroidInput::updateSelection(realCursorPosition, realCursorPosition, //empty selection
realCursorPosition = realAnchorPosition = m_composingCursor;
QtAndroidInput::updateSelection(realCursorPosition, realAnchorPosition,
m_composingTextStart, m_composingTextStart + composeLength); // pre-edit text
}
}

View File

@ -45,11 +45,14 @@
#include <QGuiApplication>
#include <QOpenGLContext>
#include <QThread>
#include <QOffscreenSurface>
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
#include <QtPlatformSupport/private/qeglpbuffer_p.h>
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformwindow.h>
#include <qpa/qplatformoffscreensurface.h>
#include "androidjnimain.h"
#include "qabstracteventdispatcher.h"
@ -207,6 +210,17 @@ QPlatformOpenGLContext *QAndroidPlatformIntegration::createPlatformOpenGLContext
return new QAndroidPlatformOpenGLContext(format, context->shareHandle(), m_eglDisplay);
}
QPlatformOffscreenSurface *QAndroidPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
{
QSurfaceFormat format(surface->requestedFormat());
format.setAlphaBufferSize(8);
format.setRedBufferSize(8);
format.setGreenBufferSize(8);
format.setBlueBufferSize(8);
return new QEGLPbuffer(m_eglDisplay, format, surface);
}
QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const
{
if (window->type() == Qt::ForeignWindow)

View File

@ -82,6 +82,7 @@ public:
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
QAbstractEventDispatcher *createEventDispatcher() const;
QAndroidPlatformScreen *screen() { return m_primaryScreen; }
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const;
virtual void setDesktopSize(int width, int height);
virtual void setDisplayMetrics(int width, int height);

View File

@ -44,6 +44,8 @@
#include "qandroidplatformopenglwindow.h"
#include "qandroidplatformintegration.h"
#include <QtPlatformSupport/private/qeglpbuffer_p.h>
#include <QSurface>
#include <QtGui/private/qopenglcontext_p.h>
@ -98,7 +100,8 @@ EGLSurface QAndroidPlatformOpenGLContext::eglSurfaceForPlatformSurface(QPlatform
{
if (surface->surface()->surfaceClass() == QSurface::Window)
return static_cast<QAndroidPlatformOpenGLWindow *>(surface)->eglSurface(eglConfig());
return EGL_NO_SURFACE;
else
return static_cast<QEGLPbuffer *>(surface)->pbuffer();
}
QT_END_NAMESPACE

View File

@ -47,7 +47,8 @@
#include <QSurfaceFormat>
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformscreen.h>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <android/native_window.h>
#include <android/native_window_jni.h>
@ -77,8 +78,20 @@ void QAndroidPlatformOpenGLWindow::setGeometry(const QRect &rect)
if (rect == geometry())
return;
QRect oldGeometry = geometry();
QAndroidPlatformWindow::setGeometry(rect);
QtAndroid::setSurfaceGeometry(m_nativeSurfaceId, rect);
QRect availableGeometry = screen()->availableGeometry();
if (oldGeometry.width() == 0
&& oldGeometry.height() == 0
&& rect.width() > 0
&& rect.height() > 0
&& availableGeometry.width() > 0
&& availableGeometry.height() > 0) {
QWindowSystemInterface::handleExposeEvent(window(), QRegion(rect));
}
}
EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config)
@ -100,8 +113,11 @@ void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config)
createEgl(config);
// we've create another surface, the window should be repainted
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
QRect availableGeometry = screen()->availableGeometry();
if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
}
void QAndroidPlatformOpenGLWindow::createEgl(EGLConfig config)
@ -111,6 +127,7 @@ void QAndroidPlatformOpenGLWindow::createEgl(EGLConfig config)
m_nativeWindow = ANativeWindow_fromSurface(env, m_androidSurfaceObject.object());
m_androidSurfaceObject = QJNIObjectPrivate();
m_eglSurface = eglCreateWindowSurface(m_eglDisplay, config, m_nativeWindow, NULL);
m_format = q_glFormatFromConfig(m_eglDisplay, config, window()->requestedFormat());
if (m_eglSurface == EGL_NO_SURFACE) {
EGLint error = eglGetError();
eglTerminate(m_eglDisplay);
@ -118,6 +135,14 @@ void QAndroidPlatformOpenGLWindow::createEgl(EGLConfig config)
}
}
QSurfaceFormat QAndroidPlatformOpenGLWindow::format() const
{
if (m_nativeWindow == 0)
return window()->requestedFormat();
else
return m_format;
}
void QAndroidPlatformOpenGLWindow::clearEgl()
{
eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
@ -143,7 +168,9 @@ void QAndroidPlatformOpenGLWindow::surfaceChanged(JNIEnv *jniEnv, jobject surfac
unlockSurface();
// repaint the window
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
QRect availableGeometry = screen()->availableGeometry();
if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
}
QT_END_NAMESPACE

View File

@ -60,6 +60,7 @@ public:
void setGeometry(const QRect &rect);
EGLSurface eglSurface(EGLConfig config);
QSurfaceFormat format() const;
void checkNativeSurface(EGLConfig config);
@ -76,6 +77,7 @@ private:
int m_nativeSurfaceId = -1;
QJNIObjectPrivate m_androidSurfaceObject;
QWaitCondition m_surfaceWaitCondition;
QSurfaceFormat m_format;
};
QT_END_NAMESPACE

View File

@ -76,6 +76,8 @@ void QAndroidPlatformRasterWindow::setGeometry(const QRect &rect)
{
m_oldGeometry = geometry();
QAndroidPlatformWindow::setGeometry(rect);
if (rect.topLeft() != m_oldGeometry.topLeft())
repaint(QRegion(rect));
}
QT_END_NAMESPACE

View File

@ -55,6 +55,9 @@
#include <android/bitmap.h>
#include <android/native_window_jni.h>
#include <QtGui/QGuiApplication>
#include <QtGui/QWindow>
QT_BEGIN_NAMESPACE
#ifdef QANDROIDPLATFORMSCREEN_DEBUG
@ -217,11 +220,23 @@ void QAndroidPlatformScreen::setGeometry(const QRect &rect)
if (m_geometry == rect)
return;
QRect oldGeometry = m_geometry;
m_geometry = rect;
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry());
QWindowSystemInterface::handleScreenAvailableGeometryChange(QPlatformScreen::screen(), availableGeometry());
resizeMaximizedWindows();
if (oldGeometry.width() == 0 && oldGeometry.height() == 0 && rect.width() > 0 && rect.height() > 0) {
QList<QWindow *> windows = QGuiApplication::allWindows();
for (int i = 0; i < windows.size(); ++i) {
QWindow *w = windows.at(i);
QRect geometry = w->handle()->geometry();
if (geometry.width() > 0 && geometry.height() > 0)
QWindowSystemInterface::handleExposeEvent(w, QRegion(geometry));
}
}
if (m_id != -1) {
if (m_nativeSurface) {
ANativeWindow_release(m_nativeSurface);

View File

@ -88,7 +88,9 @@ void QAndroidPlatformWindow::setVisible(bool visible)
setGeometry(platformScreen()->availableGeometry());
}
QPlatformWindow::setVisible(visible);
QRect availableGeometry = screen()->availableGeometry();
if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
QPlatformWindow::setVisible(visible);
if (visible)
platformScreen()->addWindow(this);

View File

@ -380,7 +380,7 @@
- (BOOL)accessibilityIsAttributeSettable:(NSString *)attribute {
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
if (!iface)
return nil;
return NO;
if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
return iface->state().focusable ? YES : NO;

View File

@ -124,7 +124,7 @@ static void cleanupCocoaApplicationDelegate()
[dockMenu release];
[qtMenuLoader release];
if (reflectionDelegate) {
[NSApp setDelegate:reflectionDelegate];
[[NSApplication sharedApplication] setDelegate:reflectionDelegate];
[reflectionDelegate release];
}
[[NSNotificationCenter defaultCenter] removeObserver:self];

View File

@ -134,8 +134,6 @@ public:
void interrupt();
void flush();
bool event(QEvent *);
friend void qt_mac_maybeCancelWaitForMoreEventsForwarder(QAbstractEventDispatcher *eventDispatcher);
};
@ -180,6 +178,8 @@ public:
void maybeCancelWaitForMoreEvents();
void ensureNSAppInitialized();
void removeQueuedUserInputEvents(int nsWinNumber);
QCFSocketNotifier cfSocketNotifier;
QList<void *> queuedUserInputEvents; // NSEvent *
CFRunLoopSourceRef postedEventsSource;

View File

@ -415,6 +415,11 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
// 'session' as well. As a result, we need to restart all internal sessions:
d->temporarilyStopAllModalSessions();
}
// Clean up the modal session list, call endModalSession.
if (d->cleanupModalSessionsNeeded)
d->cleanupModalSessions();
} else {
d->nsAppRunCalledByQt = true;
QBoolBlocker execGuard(d->currentExecIsNSAppRun, true);
@ -441,6 +446,11 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
// 'session' as well. As a result, we need to restart all internal sessions:
d->temporarilyStopAllModalSessions();
}
// Clean up the modal session list, call endModalSession.
if (d->cleanupModalSessionsNeeded)
d->cleanupModalSessions();
retVal = true;
} else do {
// Dispatch all non-user events (but que non-user events up for later). In
@ -622,7 +632,8 @@ NSModalSession QCocoaEventDispatcherPrivate::currentModalSession()
if (!info.session) {
QCocoaAutoReleasePool pool;
NSWindow *nswindow = static_cast<QCocoaWindow *>(info.window->handle())->nativeWindow();
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(info.window->handle());
NSWindow *nswindow = cocoaWindow->nativeWindow();
if (!nswindow)
continue;
@ -630,7 +641,10 @@ NSModalSession QCocoaEventDispatcherPrivate::currentModalSession()
QBoolBlocker block1(blockSendPostedEvents, true);
info.nswindow = nswindow;
[(NSWindow*) info.nswindow retain];
QRect rect = cocoaWindow->geometry();
info.session = [NSApp beginModalSessionForWindow:nswindow];
if (rect != cocoaWindow->geometry())
cocoaWindow->setGeometry(rect);
}
currentModalSessionCached = info.session;
cleanupModalSessionsNeeded = false;
@ -717,10 +731,9 @@ void QCocoaEventDispatcherPrivate::beginModalSession(QWindow *window)
{
// We need to start spinning the modal session. Usually this is done with
// QDialog::exec() for Qt Widgets based applications, but for others that
// just call show(), we need to interrupt(). We call this here, before
// setting currentModalSessionCached to zero, so that interrupt() calls
// [NSApp abortModal] if another modal session is currently running
// just call show(), we need to interrupt().
Q_Q(QCocoaEventDispatcher);
q->interrupt();
// Add a new, empty (null), NSModalSession to the stack.
// It will become active the next time QEventDispatcher::processEvents is called.
@ -733,24 +746,6 @@ void QCocoaEventDispatcherPrivate::beginModalSession(QWindow *window)
cocoaModalSessionStack.push(info);
updateChildrenWorksWhenModal();
currentModalSessionCached = 0;
if (currentExecIsNSAppRun) {
QEvent *e = new QEvent(QEvent::User);
qApp->postEvent(q, e, Qt::HighEventPriority);
} else {
q->interrupt();
}
}
bool QCocoaEventDispatcher::event(QEvent *e)
{
Q_D(QCocoaEventDispatcher);
if (e->type() == QEvent::User) {
d->q_func()->processEvents(QEventLoop::DialogExec | QEventLoop::EventLoopExec | QEventLoop::WaitForMoreEvents);
return true;
}
return QObject::event(e);
}
void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window)
@ -772,10 +767,7 @@ void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window)
info.window = 0;
if (i + endedSessions == stackSize-1) {
// The top sessions ended. Interrupt the event dispatcher to
// start spinning the correct session immediately. Like in
// beginModalSession(), we call interrupt() before clearing
// currentModalSessionCached to make sure we stop any currently
// running modal session with [NSApp abortModal]
// start spinning the correct session immediately.
q->interrupt();
currentModalSessionCached = 0;
cleanupModalSessionsNeeded = true;
@ -878,10 +870,7 @@ void QCocoaEventDispatcherPrivate::processPostedEvents()
return;
}
if (cleanupModalSessionsNeeded)
cleanupModalSessions();
if (interrupt) {
if (processEventsCalled > 0 && interrupt) {
if (currentExecIsNSAppRun) {
// The event dispatcher has been interrupted. But since
// [NSApplication run] is running the event loop, we
@ -903,6 +892,21 @@ void QCocoaEventDispatcherPrivate::processPostedEvents()
}
}
void QCocoaEventDispatcherPrivate::removeQueuedUserInputEvents(int nsWinNumber)
{
if (nsWinNumber) {
int eventIndex = queuedUserInputEvents.size();
while (--eventIndex >= 0) {
NSEvent * nsevent = static_cast<NSEvent *>(queuedUserInputEvents.at(eventIndex));
if ([nsevent windowNumber] == nsWinNumber) {
queuedUserInputEvents.removeAt(eventIndex);
[nsevent release];
}
}
}
}
void QCocoaEventDispatcherPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
CFRunLoopActivity activity,
void *info)
@ -948,23 +952,16 @@ void QCocoaEventDispatcher::interrupt()
{
Q_D(QCocoaEventDispatcher);
d->interrupt = true;
if (d->currentModalSessionCached) {
// If a modal session is active, abort it so that we can clean it up
// later. We can't use [NSApp stopModal] here, because we do not know
// where the interrupt() came from.
[NSApp abortModal];
} else {
wakeUp();
wakeUp();
// We do nothing more here than setting d->interrupt = true, and
// poke the event loop if it is sleeping. Actually stopping
// NSApp, or the current modal session, is done inside the send
// posted events callback. We do this to ensure that all current pending
// cocoa events gets delivered before we stop. Otherwise, if we now stop
// the last event loop recursion, cocoa will just drop pending posted
// events on the floor before we get a chance to reestablish a new session.
d->cancelWaitForMoreEvents();
}
// We do nothing more here than setting d->interrupt = true, and
// poke the event loop if it is sleeping. Actually stopping
// NSApp, or the current modal session, is done inside the send
// posted events callback. We do this to ensure that all current pending
// cocoa events gets delivered before we stop. Otherwise, if we now stop
// the last event loop recursion, cocoa will just drop pending posted
// events on the floor before we get a chance to reestablish a new session.
d->cancelWaitForMoreEvents();
}
void QCocoaEventDispatcher::flush()

View File

@ -139,8 +139,6 @@ public:
void setToolbar(QWindow *window, NSToolbar *toolbar);
NSToolbar *toolbar(QWindow *window) const;
void clearToolbars();
void setWindow(NSWindow* nsWindow, QCocoaWindow *window);
QCocoaWindow *window(NSWindow *window);
private:
static QCocoaIntegration *mInstance;
@ -159,7 +157,6 @@ private:
QScopedPointer<QCocoaKeyMapper> mKeyboardMapper;
QHash<QWindow *, NSToolbar *> mToolbars;
QHash<NSWindow *, QCocoaWindow*> mWindows;
};
QT_END_NAMESPACE

View File

@ -159,9 +159,12 @@ qreal QCocoaScreen::devicePixelRatio() const
QWindow *QCocoaScreen::topLevelAt(const QPoint &point) const
{
// Get a z-ordered list of windows. Iterate through it until
// we find a window which contains the point.
// we find a (Qt) window which contains the point.
for (NSWindow *nsWindow in [NSApp orderedWindows]) {
QCocoaWindow *cocoaWindow = QCocoaIntegration::instance()->window(nsWindow);
if (![nsWindow isKindOfClass:[QNSWindow class]])
continue;
QNSWindow *qnsWindow = static_cast<QNSWindow *>(nsWindow);
QCocoaWindow *cocoaWindow = qnsWindow.helper.platformWindow;
if (!cocoaWindow)
continue;
QWindow *window = cocoaWindow->window();
@ -517,16 +520,6 @@ NSToolbar *QCocoaIntegration::toolbar(QWindow *window) const
return mToolbars.value(window);
}
void QCocoaIntegration::setWindow(NSWindow* nsWindow, QCocoaWindow *window)
{
mWindows.insert(nsWindow, window);
}
QCocoaWindow *QCocoaIntegration::window(NSWindow *window)
{
return mWindows.value(window);
}
void QCocoaIntegration::clearToolbars()
{
QHash<QWindow *, NSToolbar *>::const_iterator it = mToolbars.constBegin();

View File

@ -174,7 +174,7 @@ QT_END_NAMESPACE
- (void)removeActionsFromAppMenu
{
for (NSMenuItem *item in [appMenu itemArray])
[item setTag:nil];
[item setTag:0];
}
- (void)dealloc

View File

@ -182,13 +182,22 @@ static bool isMouseEvent(NSEvent *ev)
- (void)detachFromPlatformWindow
{
_platformWindow = 0;
[self.window.delegate release];
self.window.delegate = nil;
}
- (void)clearWindow
{
_window = nil;
if (_window) {
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
if (cocoaEventDispatcher) {
QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = static_cast<QCocoaEventDispatcherPrivate *>(QObjectPrivate::get(cocoaEventDispatcher));
cocoaEventDispatcherPrivate->removeQueuedUserInputEvents([_window windowNumber]);
}
_window = nil;
}
}
- (void)dealloc
@ -261,8 +270,6 @@ static bool isMouseEvent(NSEvent *ev)
{
[self close];
QCocoaIntegration::instance()->setWindow(self, 0);
if (self.helper.grabbingMouse) {
self.helper.releaseOnMouseUp = YES;
} else {
@ -329,7 +336,6 @@ static bool isMouseEvent(NSEvent *ev)
{
[self.helper detachFromPlatformWindow];
[self close];
QCocoaIntegration::instance()->setWindow(self, 0);
[self release];
}
@ -1001,9 +1007,14 @@ bool QCocoaWindow::isExposed() const
bool QCocoaWindow::isOpaque() const
{
// OpenGL surfaces can be ordered either above(default) or below the NSWindow.
// When ordering below the window must be tranclucent.
static GLint openglSourfaceOrder = qt_mac_resolveOption(1, "QT_MAC_OPENGL_SURFACE_ORDER");
bool translucent = (window()->format().alphaBufferSize() > 0
|| window()->opacity() < 1
|| (m_qtView && [m_qtView hasMask]));
|| (m_qtView && [m_qtView hasMask]))
|| (surface()->supportsOpenGL() && openglSourfaceOrder == -1);
return !translucent;
}
@ -1404,7 +1415,13 @@ QCocoaNSWindow * QCocoaWindow::createNSWindow()
NSInteger level = windowLevel(flags);
[createdWindow setLevel:level];
if (window()->format().alphaBufferSize() > 0) {
// OpenGL surfaces can be ordered either above(default) or below the NSWindow.
// When ordering below the window must be tranclucent and have a clear background color.
static GLint openglSourfaceOrder = qt_mac_resolveOption(1, "QT_MAC_OPENGL_SURFACE_ORDER");
bool isTranslucent = window()->format().alphaBufferSize() > 0
|| (surface()->supportsOpenGL() && openglSourfaceOrder == -1);
if (isTranslucent) {
[createdWindow setBackgroundColor:[NSColor clearColor]];
[createdWindow setOpaque:NO];
}
@ -1413,8 +1430,6 @@ QCocoaNSWindow * QCocoaWindow::createNSWindow()
applyContentBorderThickness(createdWindow);
QCocoaIntegration::instance()->setWindow(createdWindow, this);
return createdWindow;
}

View File

@ -64,6 +64,7 @@ public:
}
Q_ASSERT(deviceContext);
deviceContext->SetUnitMode(D2D1_UNIT_MODE_PIXELS);
}
void begin()

View File

@ -211,118 +211,16 @@ private:
bool m_roundCoordinates;
};
static ComPtr<ID2D1PathGeometry1> painterPathToID2D1PathGeometry(const QPainterPath &path, bool alias)
{
Direct2DPathGeometryWriter writer;
if (!writer.begin())
return NULL;
struct D2DVectorPathCache {
ComPtr<ID2D1PathGeometry1> aliased;
ComPtr<ID2D1PathGeometry1> antiAliased;
writer.setWindingFillEnabled(path.fillRule() == Qt::WindingFill);
writer.setAliasingEnabled(alias);
for (int i = 0; i < path.elementCount(); i++) {
const QPainterPath::Element element = path.elementAt(i);
switch (element.type) {
case QPainterPath::MoveToElement:
writer.moveTo(element);
break;
case QPainterPath::LineToElement:
writer.lineTo(element);
break;
case QPainterPath::CurveToElement:
{
const QPainterPath::Element data1 = path.elementAt(++i);
const QPainterPath::Element data2 = path.elementAt(++i);
Q_ASSERT(i < path.elementCount());
Q_ASSERT(data1.type == QPainterPath::CurveToDataElement);
Q_ASSERT(data2.type == QPainterPath::CurveToDataElement);
writer.curveTo(element, data1, data2);
}
break;
case QPainterPath::CurveToDataElement:
qWarning("%s: Unhandled Curve Data Element", __FUNCTION__);
break;
}
static void cleanup_func(QPaintEngineEx *engine, void *data) {
Q_UNUSED(engine);
D2DVectorPathCache *e = static_cast<D2DVectorPathCache *>(data);
delete e;
}
writer.close();
return writer.geometry();
}
static ComPtr<ID2D1PathGeometry1> vectorPathToID2D1PathGeometry(const QVectorPath &path, bool alias)
{
Direct2DPathGeometryWriter writer;
if (!writer.begin())
return NULL;
writer.setWindingFillEnabled(path.hasWindingFill());
writer.setAliasingEnabled(alias);
const QPainterPath::ElementType *types = path.elements();
const int count = path.elementCount();
const qreal *points = path.points();
Q_ASSERT(points);
if (types) {
qreal x, y;
for (int i = 0; i < count; i++) {
x = points[i * 2];
y = points[i * 2 + 1];
switch (types[i]) {
case QPainterPath::MoveToElement:
writer.moveTo(QPointF(x, y));
break;
case QPainterPath::LineToElement:
writer.lineTo(QPointF(x, y));
break;
case QPainterPath::CurveToElement:
{
Q_ASSERT((i + 2) < count);
Q_ASSERT(types[i+1] == QPainterPath::CurveToDataElement);
Q_ASSERT(types[i+2] == QPainterPath::CurveToDataElement);
i++;
const qreal x2 = points[i * 2];
const qreal y2 = points[i * 2 + 1];
i++;
const qreal x3 = points[i * 2];
const qreal y3 = points[i * 2 + 1];
writer.curveTo(QPointF(x, y), QPointF(x2, y2), QPointF(x3, y3));
}
break;
case QPainterPath::CurveToDataElement:
qWarning("%s: Unhandled Curve Data Element", __FUNCTION__);
break;
}
}
} else {
writer.moveTo(QPointF(points[0], points[1]));
for (int i = 1; i < count; i++)
writer.lineTo(QPointF(points[i * 2], points[i * 2 + 1]));
}
if (writer.isInFigure())
if (path.hasImplicitClose())
writer.lineTo(QPointF(points[0], points[1]));
writer.close();
return writer.geometry();
}
};
class QWindowsDirect2DPaintEnginePrivate : public QPaintEngineExPrivate
{
@ -426,7 +324,7 @@ public:
dc()->PushAxisAlignedClip(rect, antialiasMode());
pushedClips.push(AxisAlignedClip);
} else {
ComPtr<ID2D1PathGeometry1> geometry = vectorPathToID2D1PathGeometry(path, antialiasMode() == D2D1_ANTIALIAS_MODE_ALIASED);
ComPtr<ID2D1PathGeometry1> geometry = vectorPathToID2D1PathGeometry(path);
if (!geometry) {
qWarning("%s: Could not convert vector path to painter path!", __FUNCTION__);
return;
@ -571,6 +469,7 @@ public:
break;
case Qt::RoundCap:
props.startCap = props.endCap = props.dashCap = D2D1_CAP_STYLE_ROUND;
break;
case Qt::FlatCap:
default:
props.startCap = props.endCap = props.dashCap = D2D1_CAP_STYLE_FLAT;
@ -835,6 +734,104 @@ public:
return result;
}
ComPtr<ID2D1PathGeometry1> vectorPathToID2D1PathGeometry(const QVectorPath &path)
{
Q_Q(QWindowsDirect2DPaintEngine);
const bool alias = !q->antiAliasingEnabled();
QVectorPath::CacheEntry *cacheEntry = path.isCacheable() ? path.lookupCacheData(q)
: Q_NULLPTR;
if (cacheEntry) {
D2DVectorPathCache *e = static_cast<D2DVectorPathCache *>(cacheEntry->data);
if (alias && e->aliased)
return e->aliased;
else if (!alias && e->antiAliased)
return e->antiAliased;
}
Direct2DPathGeometryWriter writer;
if (!writer.begin())
return NULL;
writer.setWindingFillEnabled(path.hasWindingFill());
writer.setAliasingEnabled(alias);
const QPainterPath::ElementType *types = path.elements();
const int count = path.elementCount();
const qreal *points = path.points();
Q_ASSERT(points);
if (types) {
qreal x, y;
for (int i = 0; i < count; i++) {
x = points[i * 2];
y = points[i * 2 + 1];
switch (types[i]) {
case QPainterPath::MoveToElement:
writer.moveTo(QPointF(x, y));
break;
case QPainterPath::LineToElement:
writer.lineTo(QPointF(x, y));
break;
case QPainterPath::CurveToElement:
{
Q_ASSERT((i + 2) < count);
Q_ASSERT(types[i+1] == QPainterPath::CurveToDataElement);
Q_ASSERT(types[i+2] == QPainterPath::CurveToDataElement);
i++;
const qreal x2 = points[i * 2];
const qreal y2 = points[i * 2 + 1];
i++;
const qreal x3 = points[i * 2];
const qreal y3 = points[i * 2 + 1];
writer.curveTo(QPointF(x, y), QPointF(x2, y2), QPointF(x3, y3));
}
break;
case QPainterPath::CurveToDataElement:
qWarning("%s: Unhandled Curve Data Element", __FUNCTION__);
break;
}
}
} else {
writer.moveTo(QPointF(points[0], points[1]));
for (int i = 1; i < count; i++)
writer.lineTo(QPointF(points[i * 2], points[i * 2 + 1]));
}
if (writer.isInFigure())
if (path.hasImplicitClose())
writer.lineTo(QPointF(points[0], points[1]));
writer.close();
ComPtr<ID2D1PathGeometry1> geometry = writer.geometry();
if (path.isCacheable()) {
if (!cacheEntry)
cacheEntry = path.addCacheData(q, new D2DVectorPathCache, D2DVectorPathCache::cleanup_func);
D2DVectorPathCache *e = static_cast<D2DVectorPathCache *>(cacheEntry->data);
if (alias)
e->aliased = geometry;
else
e->antiAliased = geometry;
} else {
path.makeCacheable();
}
return geometry;
}
void updateHints()
{
dc()->SetAntialiasMode(antialiasMode());
@ -871,7 +868,7 @@ bool QWindowsDirect2DPaintEngine::begin(QPaintDevice * pdev)
QPainterPath p;
p.addRegion(systemClip());
ComPtr<ID2D1PathGeometry1> geometry = painterPathToID2D1PathGeometry(p, d->antialiasMode() == D2D1_ANTIALIAS_MODE_ALIASED);
ComPtr<ID2D1PathGeometry1> geometry = d->vectorPathToID2D1PathGeometry(qtVectorPathForPath(p));
if (!geometry)
return false;
@ -938,7 +935,7 @@ void QWindowsDirect2DPaintEngine::draw(const QVectorPath &path)
{
Q_D(QWindowsDirect2DPaintEngine);
ComPtr<ID2D1Geometry> geometry = vectorPathToID2D1PathGeometry(path, d->antialiasMode() == D2D1_ANTIALIAS_MODE_ALIASED);
ComPtr<ID2D1Geometry> geometry = d->vectorPathToID2D1PathGeometry(path);
if (!geometry) {
qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__);
return;
@ -978,7 +975,7 @@ void QWindowsDirect2DPaintEngine::fill(const QVectorPath &path, const QBrush &br
if (!d->brush.brush)
return;
ComPtr<ID2D1Geometry> geometry = vectorPathToID2D1PathGeometry(path, d->antialiasMode() == D2D1_ANTIALIAS_MODE_ALIASED);
ComPtr<ID2D1Geometry> geometry = d->vectorPathToID2D1PathGeometry(path);
if (!geometry) {
qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__);
return;
@ -1016,7 +1013,7 @@ void QWindowsDirect2DPaintEngine::stroke(const QVectorPath &path, const QPen &pe
if (!d->pen.brush)
return;
ComPtr<ID2D1Geometry> geometry = vectorPathToID2D1PathGeometry(path, d->antialiasMode() == D2D1_ANTIALIAS_MODE_ALIASED);
ComPtr<ID2D1Geometry> geometry = d->vectorPathToID2D1PathGeometry(path);
if (!geometry) {
qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__);
return;
@ -1163,6 +1160,25 @@ void QWindowsDirect2DPaintEngine::drawRects(const QRectF *rects, int rectCount)
}
}
static bool isLinePositivelySloped(const QPointF &p1, const QPointF &p2)
{
if (p2.x() > p1.x())
return p2.y() < p1.y();
if (p1.x() > p2.x())
return p1.y() < p2.y();
return false;
}
static void adjustLine(QPointF *p1, QPointF *p2)
{
if (isLinePositivelySloped(*p1, *p2)) {
p1->ry() -= qreal(1.0);
p2->ry() -= qreal(1.0);
}
}
void QWindowsDirect2DPaintEngine::drawLines(const QLine *lines, int lineCount)
{
Q_D(QWindowsDirect2DPaintEngine);
@ -1184,6 +1200,10 @@ void QWindowsDirect2DPaintEngine::drawLines(const QLine *lines, int lineCount)
continue;
}
// Match raster engine output
if (!antiAliasingEnabled())
adjustLine(&p1, &p2);
adjustForAliasing(&p1);
adjustForAliasing(&p2);
@ -1216,6 +1236,10 @@ void QWindowsDirect2DPaintEngine::drawLines(const QLineF *lines, int lineCount)
continue;
}
// Match raster engine output
if (!antiAliasingEnabled())
adjustLine(&p1, &p2);
adjustForAliasing(&p1);
adjustForAliasing(&p2);
@ -1468,29 +1492,27 @@ void QWindowsDirect2DPaintEngine::drawTextItem(const QPointF &p, const QTextItem
rtl);
}
// Points (1/72 inches) to Microsoft's Device Independent Pixels (1/96 inches)
inline static Q_DECL_CONSTEXPR FLOAT pointSizeToDIP(qreal pointSize)
inline static FLOAT pointSizeToDIP(qreal pointSize, FLOAT dpiY)
{
return pointSize + (pointSize / qreal(3.0));
return (pointSize + (pointSize / qreal(3.0))) * (dpiY / 96.0f);
}
inline static FLOAT pixelSizeToDIP(int pixelSize)
inline static FLOAT pixelSizeToDIP(int pixelSize, FLOAT dpiY)
{
FLOAT dpiX, dpiY;
factory()->GetDesktopDpi(&dpiX, &dpiY);
return FLOAT(pixelSize) / (dpiY / 96.0f);
return FLOAT(pixelSize) * 96.0f / dpiY;
}
inline static FLOAT fontSizeInDIP(const QFont &font)
{
// Direct2d wants the font size in DIPs (Device Independent Pixels), each of which is 1/96 inches.
FLOAT dpiX, dpiY;
QWindowsDirect2DContext::instance()->d2dFactory()->GetDesktopDpi(&dpiX, &dpiY);
if (font.pixelSize() == -1) {
// font size was set as points
return pointSizeToDIP(font.pointSizeF());
return pointSizeToDIP(font.pointSizeF(), dpiY);
} else {
// font size was set as pixels
return pixelSizeToDIP(font.pixelSize());
return pixelSizeToDIP(font.pixelSize(), dpiY);
}
}

View File

@ -495,14 +495,14 @@ Q_GLOBAL_STATIC(StaticVariables, staticVariables);
return;
if ([text isEqualToString:@"\n"]) {
if (self.returnKeyType == UIReturnKeyDone)
qApp->inputMethod()->hide();
QKeyEvent press(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
QKeyEvent release(QEvent::KeyRelease, Qt::Key_Return, Qt::NoModifier);
[self sendEventToFocusObject:press];
[self sendEventToFocusObject:release];
if (self.returnKeyType == UIReturnKeyDone)
[self resignFirstResponder];
return;
}

View File

@ -41,7 +41,10 @@
#include "qqnxnativeinterface.h"
#if !defined(QT_NO_OPENGL)
#include "qqnxglcontext.h"
#endif
#include "qqnxscreen.h"
#include "qqnxwindow.h"
#if defined(QQNX_IMF)
@ -50,7 +53,10 @@
#include "qqnxintegration.h"
#if !defined(QT_NO_OPENGL)
#include <QtGui/QOpenGLContext>
#endif
#include <QtGui/QScreen>
#include <QtGui/QWindow>
@ -95,6 +101,7 @@ void *QQnxNativeInterface::nativeResourceForIntegration(const QByteArray &resour
return 0;
}
#if !defined(QT_NO_OPENGL)
void *QQnxNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
{
if (resource == "eglcontext" && context)
@ -102,6 +109,7 @@ void *QQnxNativeInterface::nativeResourceForContext(const QByteArray &resource,
return 0;
}
#endif
void QQnxNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value)
{

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