Merge remote-tracking branch 'gerrit/master' into containers

Change-Id: I01f94564c17d68872839be5396c24b661e53d571
This commit is contained in:
Oswald Buddenhagen 2011-12-09 17:10:21 +01:00
commit 4714f86c54
191 changed files with 2540 additions and 10745 deletions

View File

@ -152,6 +152,14 @@ if (-d $qtdir . '/include/QtQuick1') {
print "Warning - cannot find QtQuick1 headers\n";
}
# Support porting from "Qt 4.99" QtDeclarative to QtQuick (QQuickItem et al)
if (-d $qtdir . '/include/QtQuick') {
findQtHeaders('QtQuick', $qtdir);
} elsif (-d $qtdir . '/../qtdeclarative' ) {
# This is the case if QTDIR points to a source tree instead of an installed Qt
findQtHeaders('QtQuick', $qtdir . '/../qtdeclarative');
}
# special case
$headerSubst{'QtGui'} = 'QtWidgets/QtWidgets';

View File

@ -1238,7 +1238,7 @@ foreach my $lib (@modules_to_sync) {
my $modulepriname = basename($modulepri);
make_path($module_fwd, $lib, $verbose_level);
my $moduleprifwd = "$module_fwd/$modulepriname";
my $mod_base = $developer_build ? $basedir : $out_basedir;
my $mod_base = $basedir;
my $mod_component_base = $developer_build ? $qtbasedir : $out_basedir;
open MODULE_PRI_FILE, ">$moduleprifwd" or die("Could not open $moduleprifwd for writing");
print MODULE_PRI_FILE "QT_MODULE_BASE = $mod_base\n";

30
configure vendored
View File

@ -762,7 +762,6 @@ CFG_GSTREAMER=auto
CFG_QGTKSTYLE=auto
CFG_LARGEFILE=auto
CFG_OPENSSL=auto
CFG_PTMALLOC=no
CFG_STL=auto
CFG_PRECOMPILE=auto
CFG_SEPARATE_DEBUG_INFO=no
@ -777,7 +776,7 @@ CFG_SSSE3=auto
CFG_SSE4_1=auto
CFG_SSE4_2=auto
CFG_AVX=auto
CFG_REDUCE_RELOCATIONS=no
CFG_REDUCE_RELOCATIONS=auto
CFG_NAS=no
CFG_QWS_DEPTHS=all
CFG_ACCESSIBILITY=auto
@ -1040,7 +1039,7 @@ while [ "$#" -gt 0 ]; do
VAL=no
;;
#Qt style yes options
-incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-wayland|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-v8|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-icu|-force-asserts|-testcocoon)
-incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-wayland|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-v8|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-icu|-force-asserts|-testcocoon)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
VAL=yes
;;
@ -2069,14 +2068,6 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
ptmalloc)
if [ "$VAL" = "yes" ]; then
CFG_PTMALLOC="yes"
else
UNKNOWN_OPT=yes
fi
;;
xmlpatterns)
if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
CFG_XMLPATTERNS="yes"
@ -3977,9 +3968,6 @@ Third Party Libraries:
+ -openssl ........... Enable run-time OpenSSL support.
-openssl-linked .... Enabled linked OpenSSL support.
-ptmalloc .......... Override the system memory allocator with ptmalloc.
(Experimental.)
Additional options:
-make <part> ....... Add part to the list of parts to be built at make time.
@ -4029,6 +4017,9 @@ Additional options:
-reduce-relocations ..... Reduce relocations in the libraries through extra
linker optimizations (Qt/X11 and Qt for Embedded Linux only;
experimental; needs GNU ld >= 2.18).
-force-asserts ........ Force Q_ASSERT to be enabled even in release builds.
EOF
if [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
@ -6708,15 +6699,6 @@ if [ -n "$CFG_RUNTIME_SYSTEM" -a "$CFG_GRAPHICS_SYSTEM" != "runtime" ] || [ "$CF
CFG_RUNTIME_SYSTEM=
fi
if [ "$CFG_PTMALLOC" != "no" ]; then
# build ptmalloc, copy .a file to lib/
echo "Building ptmalloc. Please wait..."
(cd "$relpath/src/3rdparty/ptmalloc/"; "$MAKE" "clean" ; "$MAKE" "posix"
mkdir "$outpath/lib/" ; cp "libptmalloc3.a" "$outpath/lib/")
QMakeVar add QMAKE_LFLAGS "$outpath/lib/libptmalloc3.a"
fi
if [ "$CFG_ALSA" = "auto" ]; then
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then
CFG_ALSA=yes
@ -8505,8 +8487,6 @@ if [ "$XPLATFORM_MAEMO" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
fi
echo
[ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........... $CFG_PTMALLOC"
# complain about not being able to use dynamic plugins if we are using a static build
if [ "$CFG_SHARED" = "no" ]; then
echo

39
dist/changes-5.0.0 vendored
View File

@ -59,6 +59,9 @@ information about a particular change.
like SkipSingle -- skipping a non-data-driven test function or skipping
only the current data row of a data-driven test function. Every skipped
data row is now reported in the test log.
* The QTest::qExec(QObject*, const QStringList&) overload has been removed
from the API. This function was not used in any of Qt's autotests and did
not provide significant benefits over QTest::qExec(QObject*, int, char**).
- The QSsl::TlsV1 enum value was renamed to QSsl::TlsV1_0 .
@ -85,6 +88,34 @@ information about a particular change.
* Refactored to be based on action names. All functions have been changed from using
int parameters to strings.
- QSound has been moved from QtGui to QtMultimedia
- QTouchEvent:
* The DeviceType enum and deviceType() have been deprecated due to
the introduction of QTouchDevice.
* The signature of the constructor has changed. It now takes a
QTouchDevice pointer instead of just a DeviceType value.
* TouchPointState no longer includes TouchPointStateMask and
TouchPointPrimary. The primary flag is now stored together with
other touch point flags and is accessible through
TouchPoint::isPrimary() or TouchPoint::flags(). As a result the
internally used state mask is no longer necessary.
* QWidget *widget() has been removed and is replaced by QObject
*target() in order to avoid QWidget dependencies.
- QWindowSystemInterface:
* The signature of all handleTouchEvent() variants have changed,
taking a QTouchDevice* instead of just a DeviceType value.
Platform or generic plug-ins have to create and register at least
one QTouchDevice before sending the first touch event.
* The event type parameter is removed from handleTouchEvent().
****************************************************************************
* General *
****************************************************************************
@ -111,12 +142,20 @@ QtCore
* drop a bogus QChar::NoCategory enum value; the proper QChar::Other_NotAssigned
value is returned for an unassigned codepoints now.
* layoutAboutToBeChanged is no longer emitted by QAbstractItemModel::beginMoveRows.
layoutChanged is no longer emitted by QAbstractItemModel::endMoveRows. Proxy models
should now also connect to (and disconnect from) the rowsAboutToBeMoved and
rowsMoved signals.
QtGui
-----
* Accessibility has been refactored. The hierachy of accessible objects is implemented via
proper parent/child functions instead of using navigate which has been deprecated for this purpose.
Table and cell interfaces have been added to qaccessible2.h
* Touch events and points have been extended to hold additional
information like capability flags, point-specific flags, velocity,
and raw positions.
QtWidgets
---------

View File

@ -0,0 +1,43 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
//! [0]
#include <QtSql>
//! [0]

View File

@ -0,0 +1,43 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
#! [1]
QT += sql
#! [1]

View File

@ -0,0 +1,43 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
//! [0]
#include <QtXml>
//! [0]

View File

@ -0,0 +1,43 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
#! [1]
QT += xml
#! [1]

View File

@ -46,11 +46,13 @@
#include <qmath.h>
Renderer::Renderer(const QSurfaceFormat &format, Renderer *share)
Renderer::Renderer(const QSurfaceFormat &format, Renderer *share, QScreen *screen)
: m_initialized(false)
, m_format(format)
{
m_context = new QOpenGLContext(this);
if (screen)
m_context->setScreen(screen);
m_context->setFormat(format);
if (share)
m_context->setShareContext(share->m_context);

View File

@ -54,7 +54,7 @@ class Renderer : public QObject
{
Q_OBJECT
public:
Renderer(const QSurfaceFormat &format, Renderer *share = 0);
Renderer(const QSurfaceFormat &format, Renderer *share = 0, QScreen *screen = 0);
QSurfaceFormat format() const { return m_format; }

View File

@ -72,15 +72,13 @@ int main(int argc, char **argv)
windowA->setWindowTitle(QLatin1String("Thread A - Context A"));
windowA->setVisible(true);
QThread *renderThread = 0;
QList<QThread *> renderThreads;
if (multipleWindows) {
Renderer *rendererB = new Renderer(format, rendererA);
renderThread = new QThread;
QThread *renderThread = new QThread;
rendererB->moveToThread(renderThread);
renderThread->start();
QObject::connect(qGuiApp, SIGNAL(lastWindowClosed()), renderThread, SLOT(quit()));
renderThreads << renderThread;
HelloWindow *windowB = new HelloWindow(rendererA);
windowB->setGeometry(QRect(center, windowSize).translated(delta / 2, 0));
@ -91,10 +89,37 @@ int main(int argc, char **argv)
windowC->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, windowSize.height() + delta));
windowC->setWindowTitle(QLatin1String("Thread B - Context B"));
windowC->setVisible(true);
for (int i = 1; i < QGuiApplication::screens().size(); ++i) {
QScreen *screen = QGuiApplication::screens().at(i);
Renderer *renderer = new Renderer(format, rendererA, screen);
renderThread = new QThread;
renderer->moveToThread(renderThread);
renderThreads << renderThread;
QRect screenGeometry = screen->availableGeometry();
QPoint center = screenGeometry.center();
QSize windowSize = screenGeometry.size() * 0.8;
HelloWindow *window = new HelloWindow(renderer);
window->setScreen(screen);
window->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, -windowSize.height() / 2));
QChar id = QChar('B' + i);
window->setWindowTitle(QLatin1String("Thread ") + id + QLatin1String(" - Context ") + id);
window->setVisible(true);
}
}
for (int i = 0; i < renderThreads.size(); ++i) {
QObject::connect(qGuiApp, SIGNAL(lastWindowClosed()), renderThreads.at(i), SLOT(quit()));
renderThreads.at(i)->start();
}
app.exec();
if (multipleWindows)
renderThread->wait();
for (int i = 0; i < renderThreads.size(); ++i)
renderThreads.at(i)->wait();
}

View File

@ -76,6 +76,7 @@ defineTest(qtAddModule) {
MODULE_INCLUDES = $$eval(QT.$${1}.includes)
MODULE_LIBS = $$eval(QT.$${1}.libs)
MODULE_CONFIG = $$eval(QT.$${1}.module_config)
MODULE_MAJOR_VERSION = $$eval(QT.$${1}.MAJOR_VERSION)
CONFIG += $$eval(QT.$${1}.CONFIG)
DEFINES += $$eval(QT.$${1}.DEFINES)
@ -119,6 +120,16 @@ defineTest(qtAddModule) {
}
}
win32 {
# Make sure we link against the version pulled from the module's .pri
ver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}_VERSION_OVERRIDE
dver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}D_VERSION_OVERRIDE
$$ver_var = $$MODULE_MAJOR_VERSION
$$dver_var = $$MODULE_MAJOR_VERSION
export($$ver_var)
export($$dver_var)
}
isEmpty(LINKAGE) {
# Make sure we can link to uninstalled libraries
!isEqual(MODULE_LIBS, $$[QT_INSTALL_LIBS]) {

View File

@ -33,19 +33,6 @@ for(include_path, MODULE_INCLUDES):LAST_MODULE_INCLUDE=$${include_path}
HEADERS_PRI = $$LAST_MODULE_INCLUDE/headers.pri
include($$HEADERS_PRI, "", true)|clear(HEADERS_PRI)
#version overriding
win32 {
#because libnetwork.pro could be qmake'd (qmade?) before libqcore.pro we
#need to override the version of libq* in all other libq*'s just to be
#sure the same version is used
VERSIONS_LIST = $$split(VERSION, ".")
QT_LIBS_OVERRIDE = $$member(VERSIONS_LIST, 0)
for(lib, $$list(qtcore qtgui qtnetwork qtxml qtopengl qtsql qt3support)) {
eval(QMAKE_$${upper($$lib)}_VERSION_OVERRIDE = $$QT_LIBS_OVERRIDE)
eval(QMAKE_$${upper($$lib)}D_VERSION_OVERRIDE = $$QT_LIBS_OVERRIDE)
}
}
#other
DESTDIR = $$eval(QT.$${MODULE}.libs)
win32:!wince*:DLLDESTDIR = $$[QT_INSTALL_PREFIX]/bin

View File

@ -1,8 +1,4 @@
CONFIG -= thread_off
qt {
target_qt:PRL_EXPORT_DEFINES += QT_THREAD_SUPPORT
else:DEFINES += QT_THREAD_SUPPORT
}
# #### These need to go
debug {

View File

@ -1487,6 +1487,29 @@ MakefileGenerator::createObjectList(const QStringList &sources)
int dl = fName.lastIndexOf(Option::dir_sep);
if(dl != -1)
dir = fName.left(dl + 1);
} else if (project->isActiveConfig("object_parallel_to_source")) {
// The source paths are relative to the output dir, but we need source-relative paths
QString sourceRelativePath = fileFixify(*it, qmake_getpwd(), Option::output_dir);
sourceRelativePath = Option::fixPathToTargetOS(sourceRelativePath, false);
if (sourceRelativePath.startsWith(".." + Option::dir_sep))
sourceRelativePath = fileFixify(sourceRelativePath, FileFixifyAbsolute);
if (QDir::isAbsolutePath(sourceRelativePath))
sourceRelativePath.remove(0, sourceRelativePath.indexOf(Option::dir_sep) + 1);
dir = objdir; // We still respect OBJECTS_DIR
int lastDirSepPosition = sourceRelativePath.lastIndexOf(Option::dir_sep);
if (lastDirSepPosition != -1)
dir += sourceRelativePath.leftRef(lastDirSepPosition + 1);
if (!noIO()) {
// Ensure that the final output directory of each object exists
QString outRelativePath = fileFixify(dir, qmake_getpwd(), Option::output_dir);
if (!mkdir(outRelativePath))
warn_msg(WarnLogic, "Cannot create directory '%s'", outRelativePath.toLatin1().constData());
}
} else {
dir = objdir;
}

View File

@ -1,19 +0,0 @@
Copyright (c) 2001-2006 Wolfram Gloger
Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee,
provided that (i) the above copyright notices and this permission
notice appear in all copies of the software and related documentation,
and (ii) the name of Wolfram Gloger may not be used in any advertising
or publicity relating to the software.
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL,
INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY
OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

View File

@ -1,33 +0,0 @@
2006-05-31 Wolfram Gloger <wg@malloc.de>
* sysdeps/pthread/malloc-machine.h (mutex_unlock): Unlock needs
full memory barrier (thanks Bart Robinson).
2006-03-31 Wolfram Gloger <wg@malloc.de>
* ptmalloc3.c (public_iCALLOc, public_iCOMALLOc): New functions.
2006-03-30 Wolfram Gloger <wg@malloc.de>
* malloc/malloc.c: Upgrade to version pre-2.8.4-29mar06.
* malloc/malloc-private.h: New fields in malloc_state.
2004-03-29 Wolfram Gloger <wg@malloc.de>
* malloc/malloc.c (mmap_alloc): Use page_align instead of
granularity_align.
(mmap_resize): Likewise.
* malloc/ptmalloc3.c (ptmalloc_init):
Add MALLOC_GRANULARITY_ and synonymous MALLOC_TOP_PAD_ environment
parameters.
2006-03-25 Wolfram Gloger <wg@malloc.de>
* malloc/malloc-private.h: New file.
2005-12-31 Wolfram Gloger <wg@malloc.de>
* malloc/malloc.c: Imported from Doug Lea's malloc-2.8.3.
* malloc/malloc.h-2.8.3.h: Likewise.
* malloc/ptmalloc3.c: New file.

View File

@ -1,211 +0,0 @@
# Makefile for ptmalloc, version 3
# by Wolfram Gloger 1996-1999, 2001-2005, 2006
DIST_FILES0 = ChangeLog malloc-2.8.3.h malloc.c \
malloc-private.h ptmalloc3.c \
sysdeps \
#tst-mallocstate.c tst-mstats.c
DIST_FILES1 = COPYRIGHT README Makefile \
$(DIST_FILES0) \
lran2.h t-test.h t-test1.c t-test2.c \
tst-independent-alloc.c \
#debian
DIST_FILES2 = $(DIST_FILES1) \
m-test1.c \
RCS/*,v
TAR_FLAGS = --numeric-owner --exclude "*~" --exclude "debian/tmp*"
#CC = /pkg/gcc-2.95.2-wg/bin/gcc
CC = gcc
SYS_FLAGS =
OPT_FLAGS = -g -O2 #-O # -O2
WARN_FLAGS = -Wall -Wstrict-prototypes
SH_FLAGS = -shared -fpic
INC_FLAGS = -Isysdeps/generic
# Flags for the test programs
T_FLAGS = -DUSE_MALLOC=1 -DTEST=1
# Flags for the compilation of malloc.c
M_FLAGS = -DTHREAD_STATS=1 #-DMALLOC_DEBUG=1 -DDEBUG=1
# Thread flags.
# See the platform-specific targets below.
THR_FLAGS = -DUSE_TSD_DATA_HACK -D_REENTRANT
THR_LIBS = -lpthread
RM = rm -f
AR = ar
RANLIB = ranlib
MALLOC_OBJ = ptmalloc3.o malloc.o
LIB_MALLOC = libptmalloc3.a
T_SUF =
TESTS = t-test1$(T_SUF) t-test2$(T_SUF) \
tst-independent-alloc$(T_SUF)
#m-test1$(T_SUF) tst-mallocstate$(T_SUF) tst-mstats$(T_SUF)
CFLAGS = $(SYS_FLAGS) $(OPT_FLAGS) $(WARN_FLAGS) $(THR_FLAGS) $(INC_FLAGS)
.c.o:
$(CC) -c $(CFLAGS) $<
all: $(LIB_MALLOC)
ptmalloc3.o: ptmalloc3.c malloc-2.8.3.h
$(CC) -c $(CFLAGS) $(M_FLAGS) -DMSPACES=1 $<
malloc.o: malloc.c
$(CC) -c $(CFLAGS) $(M_FLAGS) -DONLY_MSPACES -DUSE_LOCKS=0 $<
#malloc-stats.o: malloc-stats.c malloc.h
# $(CC) -c $(CFLAGS) $(M_FLAGS) $<
libptmalloc3.a: $(MALLOC_OBJ)
$(AR) cr $@ $(MALLOC_OBJ)
$(RANLIB) $@
libptmalloc3.so: $(MALLOC_OBJ)
$(CC) $(SH_FLAGS) $(CFLAGS) $(M_FLAGS) $(MALLOC_OBJ) -o $@
again:
$(RM) $(TESTS)
$(MAKE) $(TESTS)
clean:
$(RM) $(MALLOC_OBJ) libptmalloc3.a libptmalloc3.so $(TESTS) \
core core.[0-9]*
m-test1$(T_SUF): m-test1.c $(LIB_MALLOC)
$(CC) $(CFLAGS) $(T_FLAGS) m-test1.c $(LIB_MALLOC) $(THR_LIBS) -o $@
t-test1$(T_SUF): t-test1.c t-test.h $(LIB_MALLOC)
$(CC) $(CFLAGS) $(T_FLAGS) t-test1.c $(LIB_MALLOC) $(THR_LIBS) -o $@
t-test2$(T_SUF): t-test2.c t-test.h $(LIB_MALLOC)
$(CC) $(CFLAGS) $(T_FLAGS) t-test2.c $(LIB_MALLOC) $(THR_LIBS) -o $@
tst-mallocstate$(T_SUF): tst-mallocstate.c $(LIB_MALLOC)
$(CC) $(CFLAGS) $(T_FLAGS) tst-mallocstate.c $(LIB_MALLOC) \
$(THR_LIBS) -o $@
tst-mstats$(T_SUF): tst-mstats.c $(LIB_MALLOC)
$(CC) $(CFLAGS) $(T_FLAGS) tst-mstats.c $(LIB_MALLOC) \
$(THR_LIBS) -o $@
tst-independent-alloc$(T_SUF): tst-independent-alloc.c $(LIB_MALLOC)
$(CC) $(CFLAGS) $(T_FLAGS) tst-independent-alloc.c $(LIB_MALLOC) \
$(THR_LIBS) -o $@
############################################################################
# Platform-specific targets. The ones ending in `-libc' are provided
# to enable comparison with the standard malloc implementation from
# the system's native C library. The option USE_TSD_DATA_HACK is now
# the default for pthreads systems, as most (Irix 6, Solaris 2) seem
# to need it. Try with USE_TSD_DATA_HACK undefined only if you're
# confident that your systems's thread specific data functions do _not_
# use malloc themselves.
# posix threads with TSD data hack
posix:
$(MAKE) THR_FLAGS='-DUSE_TSD_DATA_HACK -D_REENTRANT' \
OPT_FLAGS='$(OPT_FLAGS)' SYS_FLAGS='$(SYS_FLAGS)' CC='$(CC)' \
INC_FLAGS='-Isysdeps/pthread -Isysdeps/generic -I.'
THR_LIBS=-lpthread
# posix threads with explicit initialization. Known to be needed on HPUX.
posix-explicit:
$(MAKE) THR_FLAGS='-D_REENTRANT -DUSE_TSD_DATA_HACK -DUSE_STARTER=2' \
THR_LIBS=-lpthread \
OPT_FLAGS='$(OPT_FLAGS)' SYS_FLAGS='$(SYS_FLAGS)' CC='$(CC)' \
INC_FLAGS='-Isysdeps/pthread -Isysdeps/generic -I.' \
M_FLAGS='$(M_FLAGS)'
# posix threads without TSD data hack -- not known to work
posix-with-tsd:
$(MAKE) THR_FLAGS='-D_REENTRANT' THR_LIBS=-lpthread \
INC_FLAGS='-Isysdeps/pthread -Isysdeps/generic -I.' \
M_FLAGS='$(M_FLAGS)'
posix-libc:
$(MAKE) THR_FLAGS='-D_REENTRANT' THR_LIBS=-lpthread \
INC_FLAGS='-Isysdeps/pthread -Isysdeps/generic -I.' \
M_FLAGS='$(M_FLAGS)' LIB_MALLOC= T_FLAGS= T_SUF=-libc
linux-pthread:
$(MAKE) SYS_FLAGS='-D_GNU_SOURCE=1' \
WARN_FLAGS='-Wall -Wstrict-prototypes' \
OPT_FLAGS='$(OPT_FLAGS)' THR_FLAGS='-DUSE_TSD_DATA_HACK' \
INC_FLAGS='-Isysdeps/pthread -Isysdeps/generic -I.' M_FLAGS='$(M_FLAGS)' \
TESTS='$(TESTS)'
linux-shared:
$(MAKE) SYS_FLAGS='-D_GNU_SOURCE=1 -fpic' \
WARN_FLAGS='-Wall -Wstrict-prototypes' \
OPT_FLAGS='$(OPT_FLAGS)' THR_FLAGS='-DUSE_TSD_DATA_HACK' \
INC_FLAGS='-Isysdeps/pthread -Isysdeps/generic -I.' M_FLAGS='$(M_FLAGS)' \
LIB_MALLOC=libptmalloc3.so
sproc:
$(MAKE) THR_FLAGS='' THR_LIBS='' OPT_FLAGS='$(OPT_FLAGS)' CC='$(CC)' \
INC_FLAGS='-Isysdeps/sproc -Isysdeps/generic -I.' \
M_FLAGS='$(M_FLAGS) -Dmalloc_getpagesize=4096'
sproc-shared:
$(MAKE) THR_FLAGS='' THR_LIBS= \
SH_FLAGS='-shared -check_registry /usr/lib/so_locations' \
INC_FLAGS='-Isysdeps/sproc -Isysdeps/generic -I.' \
LIB_MALLOC=libptmalloc3.so M_FLAGS='$(M_FLAGS)'
sproc-libc:
$(MAKE) THR_FLAGS='' THR_LIBS= LIB_MALLOC= T_FLAGS= \
INC_FLAGS='-Isysdeps/sproc -Isysdeps/generic -I.' \
T_SUF=-libc M_FLAGS='$(M_FLAGS)'
solaris:
$(MAKE) THR_FLAGS='-D_REENTRANT' OPT_FLAGS='$(OPT_FLAGS)' \
INC_FLAGS='-Isysdeps/solaris -Isysdeps/generic -I.' \
THR_LIBS=-lthread M_FLAGS='$(M_FLAGS)'
solaris-libc:
$(MAKE) THR_FLAGS='-D_REENTRANT' OPT_FLAGS='$(OPT_FLAGS)' \
INC_FLAGS='-Isysdeps/solaris -Isysdeps/generic -I.' \
THR_LIBS=-lthread LIB_MALLOC= T_FLAGS= T_SUF=-libc M_FLAGS='$(M_FLAGS)'
nothreads:
$(MAKE) OPT_FLAGS='$(OPT_FLAGS)' SYS_FLAGS='$(SYS_FLAGS)' \
INC_FLAGS='-Isysdeps/generic -I.' \
THR_FLAGS='' THR_LIBS='' M_FLAGS='$(M_FLAGS)'
gcc-nothreads:
$(MAKE) CC='gcc' WARN_FLAGS='-Wall' OPT_FLAGS='$(OPT_FLAGS)' \
INC_FLAGS='-Isysdeps/generic -I.' \
SYS_FLAGS='$(SYS_FLAGS)' THR_FLAGS='' THR_LIBS='' M_FLAGS='$(M_FLAGS)'
linux-nothreads:
$(MAKE) CC='gcc' WARN_FLAGS='-Wall' OPT_FLAGS='$(OPT_FLAGS)' \
INC_FLAGS='-Isysdeps/generic -I.' \
SYS_FLAGS='-D_GNU_SOURCE' THR_FLAGS='' THR_LIBS='' M_FLAGS='$(M_FLAGS)'
############################################################################
check: $(TESTS)
./t-test1
./t-test2
#./tst-mallocstate || echo "Test mallocstate failed!"
#./tst-mstats || echo "Test mstats failed!"
snap:
cd ..; tar $(TAR_FLAGS) -c -f - $(DIST_FILES1:%=ptmalloc3/%) | \
gzip -9 >ptmalloc3-current.tar.gz
dist:
cd ..; tar $(TAR_FLAGS) -c -f - $(DIST_FILES2:%=ptmalloc3/%) | \
gzip -9 >ptmalloc3.tar.gz
# dependencies
ptmalloc3.o: malloc-private.h

View File

@ -1,186 +0,0 @@
ptmalloc3 - a multi-thread malloc implementation
================================================
Wolfram Gloger (wg@malloc.de)
Jan 2006
Thanks
======
This release was partly funded by Pixar Animation Studios. I would
like to thank David Baraff of Pixar for his support and Doug Lea
(dl@cs.oswego.edu) for the great original malloc implementation.
Introduction
============
This package is a modified version of Doug Lea's malloc-2.8.3
implementation (available seperately from ftp://g.oswego.edu/pub/misc)
that I adapted for multiple threads, while trying to avoid lock
contention as much as possible.
As part of the GNU C library, the source files may be available under
the GNU Library General Public License (see the comments in the
files). But as part of this stand-alone package, the code is also
available under the (probably less restrictive) conditions described
in the file 'COPYRIGHT'. In any case, there is no warranty whatsoever
for this package.
The current distribution should be available from:
http://www.malloc.de/malloc/ptmalloc3.tar.gz
Compilation
===========
It should be possible to build ptmalloc3 on any UN*X-like system that
implements the sbrk(), mmap(), munmap() and mprotect() calls. Since
there are now several source files, a library (libptmalloc3.a) is
generated. See the Makefile for examples of the compile-time options.
Note that support for non-ANSI compilers is no longer there.
Several example targets are provided in the Makefile:
o Posix threads (pthreads), compile with "make posix"
o Posix threads with explicit initialization, compile with
"make posix-explicit" (known to be required on HPUX)
o Posix threads without "tsd data hack" (see below), compile with
"make posix-with-tsd"
o Solaris threads, compile with "make solaris"
o SGI sproc() threads, compile with "make sproc"
o no threads, compile with "make nothreads" (currently out of order?)
For Linux:
o make "linux-pthread" (almost the same as "make posix") or
make "linux-shared"
Note that some compilers need special flags for multi-threaded code,
e.g. with Solaris cc with Posix threads, one should use:
% make posix SYS_FLAGS='-mt'
Some additional targets, ending in `-libc', are also provided in the
Makefile, to compare performance of the test programs to the case when
linking with the standard malloc implementation in libc.
A potential problem remains: If any of the system-specific functions
for getting/setting thread-specific data or for locking a mutex call
one of the malloc-related functions internally, the implementation
cannot work at all due to infinite recursion. One example seems to be
Solaris 2.4. I would like to hear if this problem occurs on other
systems, and whether similar workarounds could be applied.
For Posix threads, too, an optional hack like that has been integrated
(activated when defining USE_TSD_DATA_HACK) which depends on
`pthread_t' being convertible to an integral type (which is of course
not generally guaranteed). USE_TSD_DATA_HACK is now the default
because I haven't yet found a non-glibc pthreads system where this
hack is _not_ needed.
*NEW* and _important_: In (currently) one place in the ptmalloc3
source, a write memory barrier is needed, named
atomic_write_barrier(). This macro needs to be defined at the end of
malloc-machine.h. For gcc, a fallback in the form of a full memory
barrier is already defined, but you may need to add another definition
if you don't use gcc.
Usage
=====
Just link libptmalloc3 into your application.
Some wicked systems (e.g. HPUX apparently) won't let malloc call _any_
thread-related functions before main(). On these systems,
USE_STARTER=2 must be defined during compilation (see "make
posix-explicit" above) and the global initialization function
ptmalloc_init() must be called explicitly, preferably at the start of
main().
Otherwise, when using ptmalloc3, no special precautions are necessary.
Link order is important
=======================
On some systems, when overriding malloc and linking against shared
libraries, the link order becomes very important. E.g., when linking
C++ programs on Solaris with Solaris threads [this is probably now
obsolete], don't rely on libC being included by default, but instead
put `-lthread' behind `-lC' on the command line:
CC ... libptmalloc3.a -lC -lthread
This is because there are global constructors in libC that need
malloc/ptmalloc, which in turn needs to have the thread library to be
already initialized.
Debugging hooks
===============
All calls to malloc(), realloc(), free() and memalign() are routed
through the global function pointers __malloc_hook, __realloc_hook,
__free_hook and __memalign_hook if they are not NULL (see the malloc.h
header file for declarations of these pointers). Therefore the malloc
implementation can be changed at runtime, if care is taken not to call
free() or realloc() on pointers obtained with a different
implementation than the one currently in effect. (The easiest way to
guarantee this is to set up the hooks before any malloc call, e.g.
with a function pointed to by the global variable
__malloc_initialize_hook).
You can now also tune other malloc parameters (normally adjused via
mallopt() calls from the application) with environment variables:
MALLOC_TRIM_THRESHOLD_ for deciding to shrink the heap (in bytes)
MALLOC_GRANULARITY_ The unit for allocating and deallocating
MALLOC_TOP_PAD_ memory from the system. The default
is 64k and this parameter _must_ be a
power of 2.
MALLOC_MMAP_THRESHOLD_ min. size for chunks allocated via
mmap() (in bytes)
Tests
=====
Two testing applications, t-test1 and t-test2, are included in this
source distribution. Both perform pseudo-random sequences of
allocations/frees, and can be given numeric arguments (all arguments
are optional):
% t-test[12] <n-total> <n-parallel> <n-allocs> <size-max> <bins>
n-total = total number of threads executed (default 10)
n-parallel = number of threads running in parallel (2)
n-allocs = number of malloc()'s / free()'s per thread (10000)
size-max = max. size requested with malloc() in bytes (10000)
bins = number of bins to maintain
The first test `t-test1' maintains a completely seperate pool of
allocated bins for each thread, and should therefore show full
parallelism. On the other hand, `t-test2' creates only a single pool
of bins, and each thread randomly allocates/frees any bin. Some lock
contention is to be expected in this case, as the threads frequently
cross each others arena.
Performance results from t-test1 should be quite repeatable, while the
behaviour of t-test2 depends on scheduling variations.
Conclusion
==========
I'm always interested in performance data and feedback, just send mail
to ptmalloc@malloc.de.
Good luck!

View File

@ -1,51 +0,0 @@
/* lran2.h
* by Wolfram Gloger 1996.
*
* A small, portable pseudo-random number generator.
*/
#ifndef _LRAN2_H
#define _LRAN2_H
#define LRAN2_MAX 714025l /* constants for portable */
#define IA 1366l /* random number generator */
#define IC 150889l /* (see e.g. `Numerical Recipes') */
struct lran2_st {
long x, y, v[97];
};
static void
lran2_init(struct lran2_st* d, long seed)
{
long x;
int j;
x = (IC - seed) % LRAN2_MAX;
if(x < 0) x = -x;
for(j=0; j<97; j++) {
x = (IA*x + IC) % LRAN2_MAX;
d->v[j] = x;
}
d->x = (IA*x + IC) % LRAN2_MAX;
d->y = d->x;
}
#ifdef __GNUC__
__inline__
#endif
static long
lran2(struct lran2_st* d)
{
int j = (d->y % 97);
d->y = d->v[j];
d->x = (IA*d->x + IC) % LRAN2_MAX;
d->v[j] = d->x;
return d->y;
}
#undef IA
#undef IC
#endif

View File

@ -1,534 +0,0 @@
/*
Default header file for malloc-2.8.x, written by Doug Lea
and released to the public domain, as explained at
http://creativecommons.org/licenses/publicdomain.
last update: Mon Aug 15 08:55:52 2005 Doug Lea (dl at gee)
This header is for ANSI C/C++ only. You can set any of
the following #defines before including:
* If USE_DL_PREFIX is defined, it is assumed that malloc.c
was also compiled with this option, so all routines
have names starting with "dl".
* If HAVE_USR_INCLUDE_MALLOC_H is defined, it is assumed that this
file will be #included AFTER <malloc.h>. This is needed only if
your system defines a struct mallinfo that is incompatible with the
standard one declared here. Otherwise, you can include this file
INSTEAD of your system system <malloc.h>. At least on ANSI, all
declarations should be compatible with system versions
* If MSPACES is defined, declarations for mspace versions are included.
*/
#ifndef MALLOC_280_H
#define MALLOC_280_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h> /* for size_t */
#if !ONLY_MSPACES
#ifndef USE_DL_PREFIX
#define dlcalloc calloc
#define dlfree free
#define dlmalloc malloc
#define dlmemalign memalign
#define dlrealloc realloc
#define dlvalloc valloc
#define dlpvalloc pvalloc
#define dlmallinfo mallinfo
#define dlmallopt mallopt
#define dlmalloc_trim malloc_trim
#define dlmalloc_stats malloc_stats
#define dlmalloc_usable_size malloc_usable_size
#define dlmalloc_footprint malloc_footprint
#define dlindependent_calloc independent_calloc
#define dlindependent_comalloc independent_comalloc
#endif /* USE_DL_PREFIX */
/*
malloc(size_t n)
Returns a pointer to a newly allocated chunk of at least n bytes, or
null if no space is available, in which case errno is set to ENOMEM
on ANSI C systems.
If n is zero, malloc returns a minimum-sized chunk. (The minimum
size is 16 bytes on most 32bit systems, and 32 bytes on 64bit
systems.) Note that size_t is an unsigned type, so calls with
arguments that would be negative if signed are interpreted as
requests for huge amounts of space, which will often fail. The
maximum supported value of n differs across systems, but is in all
cases less than the maximum representable value of a size_t.
*/
void* dlmalloc(size_t);
/*
free(void* p)
Releases the chunk of memory pointed to by p, that had been previously
allocated using malloc or a related routine such as realloc.
It has no effect if p is null. If p was not malloced or already
freed, free(p) will by default cuase the current program to abort.
*/
void dlfree(void*);
/*
calloc(size_t n_elements, size_t element_size);
Returns a pointer to n_elements * element_size bytes, with all locations
set to zero.
*/
void* dlcalloc(size_t, size_t);
/*
realloc(void* p, size_t n)
Returns a pointer to a chunk of size n that contains the same data
as does chunk p up to the minimum of (n, p's size) bytes, or null
if no space is available.
The returned pointer may or may not be the same as p. The algorithm
prefers extending p in most cases when possible, otherwise it
employs the equivalent of a malloc-copy-free sequence.
If p is null, realloc is equivalent to malloc.
If space is not available, realloc returns null, errno is set (if on
ANSI) and p is NOT freed.
if n is for fewer bytes than already held by p, the newly unused
space is lopped off and freed if possible. realloc with a size
argument of zero (re)allocates a minimum-sized chunk.
The old unix realloc convention of allowing the last-free'd chunk
to be used as an argument to realloc is not supported.
*/
void* dlrealloc(void*, size_t);
/*
memalign(size_t alignment, size_t n);
Returns a pointer to a newly allocated chunk of n bytes, aligned
in accord with the alignment argument.
The alignment argument should be a power of two. If the argument is
not a power of two, the nearest greater power is used.
8-byte alignment is guaranteed by normal malloc calls, so don't
bother calling memalign with an argument of 8 or less.
Overreliance on memalign is a sure way to fragment space.
*/
void* dlmemalign(size_t, size_t);
/*
valloc(size_t n);
Equivalent to memalign(pagesize, n), where pagesize is the page
size of the system. If the pagesize is unknown, 4096 is used.
*/
void* dlvalloc(size_t);
/*
mallopt(int parameter_number, int parameter_value)
Sets tunable parameters The format is to provide a
(parameter-number, parameter-value) pair. mallopt then sets the
corresponding parameter to the argument value if it can (i.e., so
long as the value is meaningful), and returns 1 if successful else
0. SVID/XPG/ANSI defines four standard param numbers for mallopt,
normally defined in malloc.h. None of these are use in this malloc,
so setting them has no effect. But this malloc also supports other
options in mallopt:
Symbol param # default allowed param values
M_TRIM_THRESHOLD -1 2*1024*1024 any (-1U disables trimming)
M_GRANULARITY -2 page size any power of 2 >= page size
M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support)
*/
int dlmallopt(int, int);
#define M_TRIM_THRESHOLD (-1)
#define M_GRANULARITY (-2)
#define M_MMAP_THRESHOLD (-3)
/*
malloc_footprint();
Returns the number of bytes obtained from the system. The total
number of bytes allocated by malloc, realloc etc., is less than this
value. Unlike mallinfo, this function returns only a precomputed
result, so can be called frequently to monitor memory consumption.
Even if locks are otherwise defined, this function does not use them,
so results might not be up to date.
*/
size_t dlmalloc_footprint(void);
#if !NO_MALLINFO
/*
mallinfo()
Returns (by copy) a struct containing various summary statistics:
arena: current total non-mmapped bytes allocated from system
ordblks: the number of free chunks
smblks: always zero.
hblks: current number of mmapped regions
hblkhd: total bytes held in mmapped regions
usmblks: the maximum total allocated space. This will be greater
than current total if trimming has occurred.
fsmblks: always zero
uordblks: current total allocated space (normal or mmapped)
fordblks: total free space
keepcost: the maximum number of bytes that could ideally be released
back to system via malloc_trim. ("ideally" means that
it ignores page restrictions etc.)
Because these fields are ints, but internal bookkeeping may
be kept as longs, the reported values may wrap around zero and
thus be inaccurate.
*/
#ifndef HAVE_USR_INCLUDE_MALLOC_H
#ifndef _MALLOC_H
#ifndef MALLINFO_FIELD_TYPE
#define MALLINFO_FIELD_TYPE size_t
#endif /* MALLINFO_FIELD_TYPE */
struct mallinfo {
MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */
MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */
MALLINFO_FIELD_TYPE smblks; /* always 0 */
MALLINFO_FIELD_TYPE hblks; /* always 0 */
MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */
MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */
MALLINFO_FIELD_TYPE fsmblks; /* always 0 */
MALLINFO_FIELD_TYPE uordblks; /* total allocated space */
MALLINFO_FIELD_TYPE fordblks; /* total free space */
MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */
};
#endif /* _MALLOC_H */
#endif /* HAVE_USR_INCLUDE_MALLOC_H */
struct mallinfo dlmallinfo(void);
#endif /* NO_MALLINFO */
/*
independent_calloc(size_t n_elements, size_t element_size, void* chunks[]);
independent_calloc is similar to calloc, but instead of returning a
single cleared space, it returns an array of pointers to n_elements
independent elements that can hold contents of size elem_size, each
of which starts out cleared, and can be independently freed,
realloc'ed etc. The elements are guaranteed to be adjacently
allocated (this is not guaranteed to occur with multiple callocs or
mallocs), which may also improve cache locality in some
applications.
The "chunks" argument is optional (i.e., may be null, which is
probably the most typical usage). If it is null, the returned array
is itself dynamically allocated and should also be freed when it is
no longer needed. Otherwise, the chunks array must be of at least
n_elements in length. It is filled in with the pointers to the
chunks.
In either case, independent_calloc returns this pointer array, or
null if the allocation failed. If n_elements is zero and "chunks"
is null, it returns a chunk representing an array with zero elements
(which should be freed if not wanted).
Each element must be individually freed when it is no longer
needed. If you'd like to instead be able to free all at once, you
should instead use regular calloc and assign pointers into this
space to represent elements. (In this case though, you cannot
independently free elements.)
independent_calloc simplifies and speeds up implementations of many
kinds of pools. It may also be useful when constructing large data
structures that initially have a fixed number of fixed-sized nodes,
but the number is not known at compile time, and some of the nodes
may later need to be freed. For example:
struct Node { int item; struct Node* next; };
struct Node* build_list() {
struct Node** pool;
int n = read_number_of_nodes_needed();
if (n <= 0) return 0;
pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0);
if (pool == 0) die();
// organize into a linked list...
struct Node* first = pool[0];
for (i = 0; i < n-1; ++i)
pool[i]->next = pool[i+1];
free(pool); // Can now free the array (or not, if it is needed later)
return first;
}
*/
void** dlindependent_calloc(size_t, size_t, void**);
/*
independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]);
independent_comalloc allocates, all at once, a set of n_elements
chunks with sizes indicated in the "sizes" array. It returns
an array of pointers to these elements, each of which can be
independently freed, realloc'ed etc. The elements are guaranteed to
be adjacently allocated (this is not guaranteed to occur with
multiple callocs or mallocs), which may also improve cache locality
in some applications.
The "chunks" argument is optional (i.e., may be null). If it is null
the returned array is itself dynamically allocated and should also
be freed when it is no longer needed. Otherwise, the chunks array
must be of at least n_elements in length. It is filled in with the
pointers to the chunks.
In either case, independent_comalloc returns this pointer array, or
null if the allocation failed. If n_elements is zero and chunks is
null, it returns a chunk representing an array with zero elements
(which should be freed if not wanted).
Each element must be individually freed when it is no longer
needed. If you'd like to instead be able to free all at once, you
should instead use a single regular malloc, and assign pointers at
particular offsets in the aggregate space. (In this case though, you
cannot independently free elements.)
independent_comallac differs from independent_calloc in that each
element may have a different size, and also that it does not
automatically clear elements.
independent_comalloc can be used to speed up allocation in cases
where several structs or objects must always be allocated at the
same time. For example:
struct Head { ... }
struct Foot { ... }
void send_message(char* msg) {
int msglen = strlen(msg);
size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) };
void* chunks[3];
if (independent_comalloc(3, sizes, chunks) == 0)
die();
struct Head* head = (struct Head*)(chunks[0]);
char* body = (char*)(chunks[1]);
struct Foot* foot = (struct Foot*)(chunks[2]);
// ...
}
In general though, independent_comalloc is worth using only for
larger values of n_elements. For small values, you probably won't
detect enough difference from series of malloc calls to bother.
Overuse of independent_comalloc can increase overall memory usage,
since it cannot reuse existing noncontiguous small chunks that
might be available for some of the elements.
*/
void** dlindependent_comalloc(size_t, size_t*, void**);
/*
pvalloc(size_t n);
Equivalent to valloc(minimum-page-that-holds(n)), that is,
round up n to nearest pagesize.
*/
void* dlpvalloc(size_t);
/*
malloc_trim(size_t pad);
If possible, gives memory back to the system (via negative arguments
to sbrk) if there is unused memory at the `high' end of the malloc
pool or in unused MMAP segments. You can call this after freeing
large blocks of memory to potentially reduce the system-level memory
requirements of a program. However, it cannot guarantee to reduce
memory. Under some allocation patterns, some large free blocks of
memory will be locked between two used chunks, so they cannot be
given back to the system.
The `pad' argument to malloc_trim represents the amount of free
trailing space to leave untrimmed. If this argument is zero, only
the minimum amount of memory to maintain internal data structures
will be left. Non-zero arguments can be supplied to maintain enough
trailing space to service future expected allocations without having
to re-obtain memory from the system.
Malloc_trim returns 1 if it actually released any memory, else 0.
*/
int dlmalloc_trim(size_t);
/*
malloc_usable_size(void* p);
Returns the number of bytes you can actually use in
an allocated chunk, which may be more than you requested (although
often not) due to alignment and minimum size constraints.
You can use this many bytes without worrying about
overwriting other allocated objects. This is not a particularly great
programming practice. malloc_usable_size can be more useful in
debugging and assertions, for example:
p = malloc(n);
assert(malloc_usable_size(p) >= 256);
*/
size_t dlmalloc_usable_size(void*);
/*
malloc_stats();
Prints on stderr the amount of space obtained from the system (both
via sbrk and mmap), the maximum amount (which may be more than
current if malloc_trim and/or munmap got called), and the current
number of bytes allocated via malloc (or realloc, etc) but not yet
freed. Note that this is the number of bytes allocated, not the
number requested. It will be larger than the number requested
because of alignment and bookkeeping overhead. Because it includes
alignment wastage as being in use, this figure may be greater than
zero even when no user-level chunks are allocated.
The reported current and maximum system memory can be inaccurate if
a program makes other calls to system memory allocation functions
(normally sbrk) outside of malloc.
malloc_stats prints only the most commonly interesting statistics.
More information can be obtained by calling mallinfo.
*/
void dlmalloc_stats(void);
#endif /* !ONLY_MSPACES */
#if MSPACES
/*
mspace is an opaque type representing an independent
region of space that supports mspace_malloc, etc.
*/
typedef void* mspace;
/*
create_mspace creates and returns a new independent space with the
given initial capacity, or, if 0, the default granularity size. It
returns null if there is no system memory available to create the
space. If argument locked is non-zero, the space uses a separate
lock to control access. The capacity of the space will grow
dynamically as needed to service mspace_malloc requests. You can
control the sizes of incremental increases of this space by
compiling with a different DEFAULT_GRANULARITY or dynamically
setting with mallopt(M_GRANULARITY, value).
*/
mspace create_mspace(size_t capacity, int locked);
/*
destroy_mspace destroys the given space, and attempts to return all
of its memory back to the system, returning the total number of
bytes freed. After destruction, the results of access to all memory
used by the space become undefined.
*/
size_t destroy_mspace(mspace msp);
/*
create_mspace_with_base uses the memory supplied as the initial base
of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this
space is used for bookkeeping, so the capacity must be at least this
large. (Otherwise 0 is returned.) When this initial space is
exhausted, additional memory will be obtained from the system.
Destroying this space will deallocate all additionally allocated
space (if possible) but not the initial base.
*/
mspace create_mspace_with_base(void* base, size_t capacity, int locked);
/*
mspace_malloc behaves as malloc, but operates within
the given space.
*/
void* mspace_malloc(mspace msp, size_t bytes);
/*
mspace_free behaves as free, but operates within
the given space.
If compiled with FOOTERS==1, mspace_free is not actually needed.
free may be called instead of mspace_free because freed chunks from
any space are handled by their originating spaces.
*/
void mspace_free(mspace msp, void* mem);
/*
mspace_realloc behaves as realloc, but operates within
the given space.
If compiled with FOOTERS==1, mspace_realloc is not actually
needed. realloc may be called instead of mspace_realloc because
realloced chunks from any space are handled by their originating
spaces.
*/
void* mspace_realloc(mspace msp, void* mem, size_t newsize);
/*
mspace_calloc behaves as calloc, but operates within
the given space.
*/
void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size);
/*
mspace_memalign behaves as memalign, but operates within
the given space.
*/
void* mspace_memalign(mspace msp, size_t alignment, size_t bytes);
/*
mspace_independent_calloc behaves as independent_calloc, but
operates within the given space.
*/
void** mspace_independent_calloc(mspace msp, size_t n_elements,
size_t elem_size, void* chunks[]);
/*
mspace_independent_comalloc behaves as independent_comalloc, but
operates within the given space.
*/
void** mspace_independent_comalloc(mspace msp, size_t n_elements,
size_t sizes[], void* chunks[]);
/*
mspace_footprint() returns the number of bytes obtained from the
system for this space.
*/
size_t mspace_footprint(mspace msp);
#if !NO_MALLINFO
/*
mspace_mallinfo behaves as mallinfo, but reports properties of
the given space.
*/
struct mallinfo mspace_mallinfo(mspace msp);
#endif /* NO_MALLINFO */
/*
mspace_malloc_stats behaves as malloc_stats, but reports
properties of the given space.
*/
void mspace_malloc_stats(mspace msp);
/*
mspace_trim behaves as malloc_trim, but
operates within the given space.
*/
int mspace_trim(mspace msp, size_t pad);
/*
An alias for malloc_usable_size.
*/
size_t mspace_usable_size(void *mem);
/*
An alias for mallopt.
*/
int mspace_mallopt(int, int);
#endif /* MSPACES */
#ifdef __cplusplus
}; /* end of extern "C" */
#endif
#endif /* MALLOC_280_H */

View File

@ -1,170 +0,0 @@
/*
$Id: malloc-private.h,v 1.4 2006/03/31 12:56:52 wg Exp $
Private header file for ptmalloc3, created by Wolfram Gloger
and released to the public domain, as explained at
http://creativecommons.org/licenses/publicdomain.
*/
/* The following file is replicated from malloc.c */
#ifndef MALLOC_PRIVATE_H
#define MALLOC_PRIVATE_H
#ifndef MALLOC_ALIGNMENT
# define MALLOC_ALIGNMENT ((size_t)8U)
#endif
#ifndef USE_LOCKS
# define USE_LOCKS 0
#endif
/* The bit mask value corresponding to MALLOC_ALIGNMENT */
#define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE)
/* the number of bytes to offset an address to align it */
#define align_offset(A)\
((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK))
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
#define MAP_ANONYMOUS MAP_ANON
#endif /* MAP_ANON */
#ifdef MAP_ANONYMOUS
#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS)
#define CALL_MMAP(s) mmap(0, (s), PROT_READ|PROT_WRITE, MMAP_FLAGS, -1, 0)
#else /* MAP_ANONYMOUS */
/*
Nearly all versions of mmap support MAP_ANONYMOUS, so the following
is unlikely to be needed, but is supplied just in case.
*/
#include <fcntl.h> /* for O_RDWR */
#define MMAP_FLAGS (MAP_PRIVATE)
static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
#define CALL_MMAP(s) ((dev_zero_fd < 0) ? \
(dev_zero_fd = open("/dev/zero", O_RDWR), \
mmap(0, (s), PROT_READ|PROT_WRITE, MMAP_FLAGS, dev_zero_fd, 0)) : \
mmap(0, (s), PROT_READ|PROT_WRITE, MMAP_FLAGS, dev_zero_fd, 0))
#endif /* MAP_ANONYMOUS */
#define CALL_MUNMAP(a, s) munmap((a), (s))
struct malloc_chunk {
size_t prev_foot; /* Size of previous chunk (if free). */
size_t head; /* Size and inuse bits. */
struct malloc_chunk* fd; /* double links -- used only if free. */
struct malloc_chunk* bk;
};
typedef struct malloc_chunk mchunk;
typedef struct malloc_chunk* mchunkptr;
typedef unsigned int binmap_t;
typedef unsigned int flag_t;
struct malloc_tree_chunk;
typedef struct malloc_tree_chunk* tbinptr;
struct malloc_segment {
char* base; /* base address */
size_t size; /* allocated size */
struct malloc_segment* next; /* ptr to next segment */
flag_t sflags; /* mmap and extern flag */
};
typedef struct malloc_segment msegment;
#define NSMALLBINS (32U)
#define NTREEBINS (32U)
struct malloc_state {
binmap_t smallmap;
binmap_t treemap;
size_t dvsize;
size_t topsize;
char* least_addr;
mchunkptr dv;
mchunkptr top;
size_t trim_check;
size_t release_checks;
size_t magic;
mchunkptr smallbins[(NSMALLBINS+1)*2];
tbinptr treebins[NTREEBINS];
size_t footprint;
size_t max_footprint;
flag_t mflags;
#if USE_LOCKS
MLOCK_T mutex;
#endif /* USE_LOCKS */
msegment seg;
void* extp;
size_t exts;
};
/*
TOP_FOOT_SIZE is padding at the end of a segment, including space
that may be needed to place segment records and fenceposts when new
noncontiguous segments are added.
*/
#define TOP_FOOT_SIZE\
(align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
/* ------------------- Chunks sizes and alignments ----------------------- */
#define MCHUNK_SIZE (sizeof(mchunk))
#define CHUNK_OVERHEAD (SIZE_T_SIZE)
/* MMapped chunks need a second word of overhead ... */
#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
/* ... and additional padding for fake next-chunk at foot */
#define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES)
/* The smallest size we can malloc is an aligned minimal chunk */
#define MIN_CHUNK_SIZE\
((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
/* conversion from malloc headers to user pointers, and back */
#define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES))
#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES))
/* chunk associated with aligned address A */
#define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A)))
/* pad request bytes into a usable size */
#define pad_request(req) \
(((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
/* The byte and bit size of a size_t */
#define SIZE_T_SIZE (sizeof(size_t))
#define SIZE_T_BITSIZE (sizeof(size_t) << 3)
/* Some constants coerced to size_t */
/* Annoying but necessary to avoid errors on some platforms */
#define SIZE_T_ZERO ((size_t)0)
#define SIZE_T_ONE ((size_t)1)
#define SIZE_T_TWO ((size_t)2)
#define SIZE_T_FOUR ((size_t)4)
#define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1)
#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2)
#define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES)
#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U)
#define IS_MMAPPED_BIT (SIZE_T_ONE)
#define PINUSE_BIT (SIZE_T_ONE)
#define CINUSE_BIT (SIZE_T_TWO)
#define FLAG_BITS (PINUSE_BIT|CINUSE_BIT|SIZE_T_FOUR)
/* head field is or'ed with NON_MAIN_ARENA if the chunk was obtained
from a non-main arena. This is only set immediately before handing
the chunk to the user, if necessary. */
#define NON_MAIN_ARENA (SIZE_T_FOUR)
#define cinuse(p) ((p)->head & CINUSE_BIT)
#define pinuse(p) ((p)->head & PINUSE_BIT)
#define chunksize(p) ((p)->head & ~(FLAG_BITS))
#define is_mmapped(p)\
(!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT))
/* Get the internal overhead associated with chunk p */
#define overhead_for(p)\
(is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD)
#endif /* MALLOC_PRIVATE_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
/* Empty placeholder */

View File

@ -1,68 +0,0 @@
/* Basic platform-independent macro definitions for mutexes,
thread-specific data and parameters for malloc.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _GENERIC_MALLOC_MACHINE_H
#define _GENERIC_MALLOC_MACHINE_H
#include <atomic.h>
#ifndef mutex_init /* No threads, provide dummy macros */
# define NO_THREADS
/* The mutex functions used to do absolutely nothing, i.e. lock,
trylock and unlock would always just return 0. However, even
without any concurrently active threads, a mutex can be used
legitimately as an `in use' flag. To make the code that is
protected by a mutex async-signal safe, these macros would have to
be based on atomic test-and-set operations, for example. */
typedef int mutex_t;
# define mutex_init(m) (*(m) = 0)
# define mutex_lock(m) ((*(m) = 1), 0)
# define mutex_trylock(m) (*(m) ? 1 : ((*(m) = 1), 0))
# define mutex_unlock(m) (*(m) = 0)
typedef void *tsd_key_t;
# define tsd_key_create(key, destr) do {} while(0)
# define tsd_setspecific(key, data) ((key) = (data))
# define tsd_getspecific(key, vptr) (vptr = (key))
# define thread_atfork(prepare, parent, child) do {} while(0)
#endif /* !defined mutex_init */
#ifndef atomic_full_barrier
# define atomic_full_barrier() __asm ("" ::: "memory")
#endif
#ifndef atomic_read_barrier
# define atomic_read_barrier() atomic_full_barrier ()
#endif
#ifndef atomic_write_barrier
# define atomic_write_barrier() atomic_full_barrier ()
#endif
#ifndef DEFAULT_TOP_PAD
# define DEFAULT_TOP_PAD 131072
#endif
#endif /* !defined(_GENERIC_MALLOC_MACHINE_H) */

View File

@ -1,48 +0,0 @@
/*
* $Id:$
* Generic version: no threads.
* by Wolfram Gloger 2004
*/
#include <stdio.h>
struct thread_st {
char *sp; /* stack pointer, can be 0 */
void (*func)(struct thread_st* st); /* must be set by user */
int id;
int flags;
struct user_data u;
};
static void
thread_init(void)
{
printf("No threads.\n");
}
/* Create a thread. */
static int
thread_create(struct thread_st *st)
{
st->flags = 0;
st->id = 1;
st->func(st);
return 0;
}
/* Wait for one of several subthreads to finish. */
static void
wait_for_thread(struct thread_st st[], int n_thr,
int (*end_thr)(struct thread_st*))
{
int i;
for(i=0; i<n_thr; i++)
if(end_thr)
end_thr(&st[i]);
}
/*
* Local variables:
* tab-width: 4
* End:
*/

View File

@ -1,131 +0,0 @@
/* Basic platform-independent macro definitions for mutexes,
thread-specific data and parameters for malloc.
Posix threads (pthreads) version.
Copyright (C) 2004 Wolfram Gloger <wg@malloc.de>.
Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee,
provided that (i) the above copyright notices and this permission
notice appear in all copies of the software and related documentation,
and (ii) the name of Wolfram Gloger may not be used in any advertising
or publicity relating to the software.
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL,
INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY
OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _PTHREAD_MALLOC_MACHINE_H
#define _PTHREAD_MALLOC_MACHINE_H
#include <pthread.h>
#undef thread_atfork_static
/* Use fast inline spinlocks with gcc. */
#if (defined __i386__ || defined __x86_64__) && defined __GNUC__ && \
!defined USE_NO_SPINLOCKS
#include <time.h>
#include <sched.h>
typedef struct {
volatile unsigned int lock;
int pad0_;
} mutex_t;
#define MUTEX_INITIALIZER { 0 }
#define mutex_init(m) ((m)->lock = 0)
static inline int mutex_lock(mutex_t *m) {
int cnt = 0, r;
struct timespec tm;
for(;;) {
__asm__ __volatile__
("xchgl %0, %1"
: "=r"(r), "=m"(m->lock)
: "0"(1), "m"(m->lock)
: "memory");
if(!r)
return 0;
if(cnt < 50) {
sched_yield();
cnt++;
} else {
tm.tv_sec = 0;
tm.tv_nsec = 2000001;
nanosleep(&tm, NULL);
cnt = 0;
}
}
}
static inline int mutex_trylock(mutex_t *m) {
int r;
__asm__ __volatile__
("xchgl %0, %1"
: "=r"(r), "=m"(m->lock)
: "0"(1), "m"(m->lock)
: "memory");
return r;
}
static inline int mutex_unlock(mutex_t *m) {
__asm__ __volatile__ ("movl %1, %0" : "=m" (m->lock) : "g"(0) : "memory");
return 0;
}
#else
/* Normal pthread mutex. */
typedef pthread_mutex_t mutex_t;
#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
#define mutex_init(m) pthread_mutex_init(m, NULL)
#define mutex_lock(m) pthread_mutex_lock(m)
#define mutex_trylock(m) pthread_mutex_trylock(m)
#define mutex_unlock(m) pthread_mutex_unlock(m)
#endif /* (__i386__ || __x86_64__) && __GNUC__ && !USE_NO_SPINLOCKS */
/* thread specific data */
#if defined(__sgi) || defined(USE_TSD_DATA_HACK)
/* Hack for thread-specific data, e.g. on Irix 6.x. We can't use
pthread_setspecific because that function calls malloc() itself.
The hack only works when pthread_t can be converted to an integral
type. */
typedef void *tsd_key_t[256];
#define tsd_key_create(key, destr) do { \
int i; \
for(i=0; i<256; i++) (*key)[i] = 0; \
} while(0)
#define tsd_setspecific(key, data) \
(key[(unsigned)pthread_self() % 256] = (data))
#define tsd_getspecific(key, vptr) \
(vptr = key[(unsigned)pthread_self() % 256])
#else
typedef pthread_key_t tsd_key_t;
#define tsd_key_create(key, destr) pthread_key_create(key, destr)
#define tsd_setspecific(key, data) pthread_setspecific(key, data)
#define tsd_getspecific(key, vptr) (vptr = pthread_getspecific(key))
#endif
/* at fork */
#define thread_atfork(prepare, parent, child) \
pthread_atfork(prepare, parent, child)
#include <sysdeps/generic/malloc-machine.h>
#endif /* !defined(_MALLOC_MACHINE_H) */

View File

@ -1,111 +0,0 @@
/*
* $Id: thread-st.h$
* pthread version
* by Wolfram Gloger 2004
*/
#include <pthread.h>
#include <stdio.h>
pthread_cond_t finish_cond = PTHREAD_COND_INITIALIZER;
pthread_mutex_t finish_mutex = PTHREAD_MUTEX_INITIALIZER;
#ifndef USE_PTHREADS_STACKS
#define USE_PTHREADS_STACKS 0
#endif
#ifndef STACKSIZE
#define STACKSIZE 32768
#endif
struct thread_st {
char *sp; /* stack pointer, can be 0 */
void (*func)(struct thread_st* st); /* must be set by user */
pthread_t id;
int flags;
struct user_data u;
};
static void
thread_init(void)
{
printf("Using posix threads.\n");
pthread_cond_init(&finish_cond, NULL);
pthread_mutex_init(&finish_mutex, NULL);
}
static void *
thread_wrapper(void *ptr)
{
struct thread_st *st = (struct thread_st*)ptr;
/*printf("begin %p\n", st->sp);*/
st->func(st);
pthread_mutex_lock(&finish_mutex);
st->flags = 1;
pthread_mutex_unlock(&finish_mutex);
pthread_cond_signal(&finish_cond);
/*printf("end %p\n", st->sp);*/
return NULL;
}
/* Create a thread. */
static int
thread_create(struct thread_st *st)
{
st->flags = 0;
{
pthread_attr_t* attr_p = 0;
#if USE_PTHREADS_STACKS
pthread_attr_t attr;
pthread_attr_init (&attr);
if(!st->sp)
st->sp = malloc(STACKSIZE+16);
if(!st->sp)
return -1;
if(pthread_attr_setstacksize(&attr, STACKSIZE))
fprintf(stderr, "error setting stacksize");
else
pthread_attr_setstackaddr(&attr, st->sp + STACKSIZE);
/*printf("create %p\n", st->sp);*/
attr_p = &attr;
#endif
return pthread_create(&st->id, attr_p, thread_wrapper, st);
}
return 0;
}
/* Wait for one of several subthreads to finish. */
static void
wait_for_thread(struct thread_st st[], int n_thr,
int (*end_thr)(struct thread_st*))
{
int i;
pthread_mutex_lock(&finish_mutex);
for(;;) {
int term = 0;
for(i=0; i<n_thr; i++)
if(st[i].flags) {
/*printf("joining %p\n", st[i].sp);*/
if(pthread_join(st[i].id, NULL) == 0) {
st[i].flags = 0;
if(end_thr)
end_thr(&st[i]);
} else
fprintf(stderr, "can't join\n");
++term;
}
if(term > 0)
break;
pthread_cond_wait(&finish_cond, &finish_mutex);
}
pthread_mutex_unlock(&finish_mutex);
}
/*
* Local variables:
* tab-width: 4
* End:
*/

View File

@ -1,51 +0,0 @@
/* Basic platform-independent macro definitions for mutexes,
thread-specific data and parameters for malloc.
Solaris threads version.
Copyright (C) 2004 Wolfram Gloger <wg@malloc.de>.
Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee,
provided that (i) the above copyright notices and this permission
notice appear in all copies of the software and related documentation,
and (ii) the name of Wolfram Gloger may not be used in any advertising
or publicity relating to the software.
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL,
INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY
OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _SOLARIS_MALLOC_MACHINE_H
#define _SOLARIS_MALLOC_MACHINE_H
#include <thread.h>
typedef thread_t thread_id;
#define MUTEX_INITIALIZER { 0 }
#define mutex_init(m) mutex_init(m, USYNC_THREAD, NULL)
/*
* Hack for thread-specific data on Solaris. We can't use thr_setspecific
* because that function calls malloc() itself.
*/
typedef void *tsd_key_t[256];
#define tsd_key_create(key, destr) do { \
int i; \
for(i=0; i<256; i++) (*key)[i] = 0; \
} while(0)
#define tsd_setspecific(key, data) (key[(unsigned)thr_self() % 256] = (data))
#define tsd_getspecific(key, vptr) (vptr = key[(unsigned)thr_self() % 256])
#define thread_atfork(prepare, parent, child) do {} while(0)
#include <sysdeps/generic/malloc-machine.h>
#endif /* !defined(_SOLARIS_MALLOC_MACHINE_H) */

View File

@ -1,72 +0,0 @@
/*
* $Id:$
* Solaris version
* by Wolfram Gloger 2004
*/
#include <thread.h>
#include <stdio.h>
#ifndef STACKSIZE
#define STACKSIZE 32768
#endif
struct thread_st {
char *sp; /* stack pointer, can be 0 */
void (*func)(struct thread_st* st); /* must be set by user */
thread_id id;
int flags;
struct user_data u;
};
static void
thread_init(void)
{
printf("Using Solaris threads.\n");
}
static void *
thread_wrapper(void *ptr)
{
struct thread_st *st = (struct thread_st*)ptr;
/*printf("begin %p\n", st->sp);*/
st->func(st);
/*printf("end %p\n", st->sp);*/
return NULL;
}
/* Create a thread. */
static int
thread_create(struct thread_st *st)
{
st->flags = 0;
if(!st->sp)
st->sp = malloc(STACKSIZE);
if(!st->sp) return -1;
thr_create(st->sp, STACKSIZE, thread_wrapper, st, THR_NEW_LWP, &st->id);
return 0;
}
/* Wait for one of several subthreads to finish. */
static void
wait_for_thread(struct thread_st st[], int n_thr,
int (*end_thr)(struct thread_st*))
{
int i;
thread_t id;
thr_join(0, &id, NULL);
for(i=0; i<n_thr; i++)
if(id == st[i].id) {
if(end_thr)
end_thr(&st[i]);
break;
}
}
/*
* Local variables:
* tab-width: 4
* End:
*/

View File

@ -1,51 +0,0 @@
/* Basic platform-independent macro definitions for mutexes,
thread-specific data and parameters for malloc.
SGI threads (sprocs) version.
Copyright (C) 2004 Wolfram Gloger <wg@malloc.de>.
Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee,
provided that (i) the above copyright notices and this permission
notice appear in all copies of the software and related documentation,
and (ii) the name of Wolfram Gloger may not be used in any advertising
or publicity relating to the software.
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL,
INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY
OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _SPROC_MALLOC_MACHINE_H
#define _SPROC_MALLOC_MACHINE_H
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/prctl.h>
#include <abi_mutex.h>
typedef abilock_t mutex_t;
#define MUTEX_INITIALIZER { 0 }
#define mutex_init(m) init_lock(m)
#define mutex_lock(m) (spin_lock(m), 0)
#define mutex_trylock(m) acquire_lock(m)
#define mutex_unlock(m) release_lock(m)
typedef int tsd_key_t;
int tsd_key_next;
#define tsd_key_create(key, destr) ((*key) = tsd_key_next++)
#define tsd_setspecific(key, data) (((void **)(&PRDA->usr_prda))[key] = data)
#define tsd_getspecific(key, vptr) (vptr = ((void **)(&PRDA->usr_prda))[key])
#define thread_atfork(prepare, parent, child) do {} while(0)
#include <sysdeps/generic/malloc-machine.h>
#endif /* !defined(_SPROC_MALLOC_MACHINE_H) */

View File

@ -1,85 +0,0 @@
/*
* $Id:$
* sproc version
* by Wolfram Gloger 2001, 2004, 2006
*/
#include <stdio.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/prctl.h>
#ifndef STACKSIZE
#define STACKSIZE 32768
#endif
struct thread_st {
char *sp; /* stack pointer, can be 0 */
void (*func)(struct thread_st* st); /* must be set by user */
int id;
int flags;
struct user_data u;
};
static void
thread_init(void)
{
printf("Using sproc() threads.\n");
}
static void
thread_wrapper(void *ptr, size_t stack_len)
{
struct thread_st *st = (struct thread_st*)ptr;
/*printf("begin %p\n", st->sp);*/
st->func(st);
/*printf("end %p\n", st->sp);*/
}
/* Create a thread. */
static int
thread_create(struct thread_st *st)
{
st->flags = 0;
if(!st->sp)
st->sp = malloc(STACKSIZE);
if(!st->sp) return -1;
st->id = sprocsp(thread_wrapper, PR_SALL, st, st->sp+STACKSIZE, STACKSIZE);
if(st->id < 0) {
return -1;
}
return 0;
}
/* Wait for one of several subthreads to finish. */
static void
wait_for_thread(struct thread_st st[], int n_thr,
int (*end_thr)(struct thread_st*))
{
int i;
int id;
int status = 0;
id = wait(&status);
if(status != 0) {
if(WIFSIGNALED(status))
printf("thread %id terminated by signal %d\n",
id, WTERMSIG(status));
else
printf("thread %id exited with status %d\n",
id, WEXITSTATUS(status));
}
for(i=0; i<n_thr; i++)
if(id == st[i].id) {
if(end_thr)
end_thr(&st[i]);
break;
}
}
/*
* Local variables:
* tab-width: 4
* End:
*/

View File

@ -1,138 +0,0 @@
/*****************************************************************************
** wacomcfg.h
**
** Copyright (C) 2003 - John E. Joganic
** Copyright (C) 2004-2008 - Ping Cheng
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public License
** as published by the Free Software Foundation; either version 2
** of the License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
****************************************************************************/
#ifndef __LINUXWACOM_WACOMCFG_H
#define __LINUXWACOM_WACOMCFG_H
#include <X11/Xlib.h>
#include <X11/extensions/XInput.h>
#include <X11/extensions/XIproto.h>
/* JEJ - NOTE WE DO NOT INCLUDE Xwacom.h HERE. THIS ELIMINATES A CONFLICT
* WHEN THIS FILE IS INSTALLED SINCE Xwacom.h WILL IN MANY CASES NOT
* GO WITH IT. SOMEDAY IT MAY BE PART OF XFREE86. */
typedef struct _WACOMCONFIG WACOMCONFIG;
typedef struct _WACOMDEVICE WACOMDEVICE;
typedef void (*WACOMERRORFUNC)(int err, const char* pszText);
typedef struct _WACOMDEVICEINFO WACOMDEVICEINFO;
typedef enum
{
WACOMDEVICETYPE_UNKNOWN,
WACOMDEVICETYPE_CURSOR,
WACOMDEVICETYPE_STYLUS,
WACOMDEVICETYPE_ERASER,
WACOMDEVICETYPE_PAD,
WACOMDEVICETYPE_TOUCH,
WACOMDEVICETYPE_MAX
} WACOMDEVICETYPE;
struct _WACOMDEVICEINFO
{
const char* pszName;
WACOMDEVICETYPE type;
};
struct _WACOMCONFIG
{
Display* pDisp;
WACOMERRORFUNC pfnError;
XDeviceInfo * pDevs;
int nDevCnt;
};
struct _WACOMDEVICE
{
WACOMCONFIG* pCfg;
XDevice* pDev;
};
/*****************************************************************************
** Functions
*****************************************************************************/
WACOMCONFIG * WacomConfigInit(Display* pDisplay, WACOMERRORFUNC pfnErrorHandler);
/* Initializes configuration library.
* pDisplay - display to configure
* pfnErrorHandler - handler to which errors are reported; may be NULL
* Returns WACOMCONFIG handle on success, NULL on error.
* errno contains error code. */
void WacomConfigTerm(WACOMCONFIG * hConfig);
/* Terminates configuration library, releasing display. */
int WacomConfigListDevices(WACOMCONFIG * hConfig, WACOMDEVICEINFO** ppInfo,
unsigned int* puCount);
/* Returns a list of wacom devices.
* ppInfo - pointer to WACOMDEVICEINFO* to receive device data
* puSize - pointer to receive device count
* Returns 0 on success, -1 on failure. errno contains error code.
* Comments: You must free this structure using WacomConfigFree. */
WACOMDEVICE * WacomConfigOpenDevice(WACOMCONFIG * hConfig,
const char* pszDeviceName);
/* Open a device by name.
* pszDeviceName - name of XInput device corresponding to wacom device
* Returns handle to device on success, NULL on error.
* errno contains error code.
* Comments: Close using WacomConfigCloseDevice */
int WacomConfigCloseDevice(WACOMDEVICE * hDevice);
/* Closes a device.
* Returns 0 on success, -1 on error. errno contains error code. */
int WacomConfigSetRawParam(WACOMDEVICE * hDevice, int nParam, int nValue, unsigned * keys);
/* Sets the raw device parameter to specified value.
* nParam - valid paramters can be found Xwacom.h which is not
* automatically included.
* nValue - 32 bit integer value
* keys - an array of keys and modifiers
* Returns 0 on success, -1 on error. errno contains error code.
* EINVAL - invalid parameter or value
* EIO - unknown X failure, use XSetErrorHandler to capture complete
* error code and message
* Comments: Data is sent to wacom_drv module without any error checking.
* Generally, you should use the more specific handler functions in this
* library, but for some parameters, particularly experimental ones, you
* will probably have to set them directly. */
int WacomConfigGetRawParam(WACOMDEVICE *hDevice, int nParam, int *nValue, int valu, unsigned * keys);
/* Gets the raw device parameter.
* nParam - valid paramters can be found Xwacom.h which is not
* automatically included.
* nValue - the device parameter is returned in the integer
* pointed by this parameter.
* valu - calling valuator value: 1: Get 3: GetDefault
* keys - an array of keys and modifiers
* Returns 0 on success, -1 on error. errno contains error code.
* EINVAL - invalid parameter or value
* EIO - unknown X failure, use XSetErrorHandler to capture complete
* error code and message
*/
void WacomConfigFree(void* pvData);
/* Frees memory allocated by library. */
#endif /* __LINUXWACOM_WACOMCFG_H */

View File

@ -36,25 +36,7 @@
#
######################################
include(MacroAddFileDependencies)
MACRO (QT5_EXTRACT_OPTIONS _qt5_files _qt5_options)
SET(${_qt5_files})
SET(${_qt5_options})
SET(_QT5_DOING_OPTIONS FALSE)
FOREACH(_currentArg ${ARGN})
IF ("${_currentArg}" STREQUAL "OPTIONS")
SET(_QT5_DOING_OPTIONS TRUE)
ELSE ("${_currentArg}" STREQUAL "OPTIONS")
IF(_QT5_DOING_OPTIONS)
LIST(APPEND ${_qt5_options} "${_currentArg}")
ELSE(_QT5_DOING_OPTIONS)
LIST(APPEND ${_qt5_files} "${_currentArg}")
ENDIF(_QT5_DOING_OPTIONS)
ENDIF ("${_currentArg}" STREQUAL "OPTIONS")
ENDFOREACH(_currentArg)
ENDMACRO (QT5_EXTRACT_OPTIONS)
include(CMakeParseArguments)
# macro used to create the names of output files preserving relative dirs
MACRO (QT5_MAKE_OUTPUT_FILE infile prefix ext outfile )
@ -135,7 +117,7 @@ MACRO (QT5_CREATE_MOC_COMMAND infile outfile moc_flags moc_options)
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
COMMAND ${QT_MOC_EXECUTABLE}
ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile}
DEPENDS ${infile})
DEPENDS ${infile} VERBATIM)
ENDIF (WIN32)
ENDMACRO (QT5_CREATE_MOC_COMMAND)
@ -158,8 +140,15 @@ ENDMACRO (QT5_GENERATE_MOC)
MACRO (QT5_WRAP_CPP outfiles )
# get include dirs
QT5_GET_MOC_FLAGS(moc_flags)
QT5_EXTRACT_OPTIONS(moc_files moc_options ${ARGN})
set(options)
set(oneValueArgs)
set(multiValueArgs OPTIONS)
cmake_parse_arguments(_WRAP_CPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(moc_files ${_WRAP_CPP_UNPARSED_ARGUMENTS})
set(moc_options ${_WRAP_CPP_OPTIONS})
FOREACH (it ${moc_files})
GET_FILENAME_COMPONENT(it ${it} ABSOLUTE)
QT5_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile)
@ -173,7 +162,15 @@ ENDMACRO (QT5_WRAP_CPP)
# QT5_ADD_RESOURCES(outfiles inputfile ... )
MACRO (QT5_ADD_RESOURCES outfiles )
QT5_EXTRACT_OPTIONS(rcc_files rcc_options ${ARGN})
set(options)
set(oneValueArgs)
set(multiValueArgs OPTIONS)
cmake_parse_arguments(_RCC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(rcc_files ${_RCC_UNPARSED_ARGUMENTS})
set(rcc_options ${_RCC_OPTIONS})
FOREACH (it ${rcc_files})
GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE)
@ -201,7 +198,7 @@ MACRO (QT5_ADD_RESOURCES outfiles )
COMMAND ${QT_RCC_EXECUTABLE}
ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
MAIN_DEPENDENCY ${infile}
DEPENDS ${_RC_DEPENDS} "${out_depends}")
DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM)
SET(${outfiles} ${${outfiles}} ${outfile})
ENDFOREACH (it)

View File

@ -970,6 +970,10 @@ public:
Key_LaunchG = 0x0100010e,
Key_LaunchH = 0x0100010f,
Key_TouchpadToggle = 0x01000110,
Key_TouchpadOn = 0x01000111,
Key_TouchpadOff = 0x01000112,
Key_MediaLast = 0x0100ffff,
// Keypad navigation keys

View File

@ -1649,6 +1649,9 @@
\value Key_PowerDown
\value Key_Suspend
\value Key_ContrastAdjust
\value Key_TouchpadToggle
\value Key_TouchpadOn
\value Key_TouchpadOff
\value Key_MediaLast
\value Key_unknown

View File

@ -45,7 +45,6 @@
#include "qdiriterator.h"
#include "qplatformdefs.h"
#include "private/qdir_p.h"
#include <QDebug>
#if defined(QT_BUILD_CORE_LIB)
@ -67,7 +66,6 @@ public:
QTemporaryDirPrivate();
~QTemporaryDirPrivate();
QString defaultTemplateName() const;
void create(const QString &templateName);
QString path;
@ -85,7 +83,7 @@ QTemporaryDirPrivate::~QTemporaryDirPrivate()
{
}
QString QTemporaryDirPrivate::defaultTemplateName() const
static QString defaultTemplateName()
{
QString baseName;
#if defined(QT_BUILD_CORE_LIB)
@ -168,14 +166,14 @@ void QTemporaryDirPrivate::create(const QString &templateName)
QTemporaryDir::QTemporaryDir()
: d_ptr(new QTemporaryDirPrivate)
{
d_ptr->create(d_ptr->defaultTemplateName());
d_ptr->create(defaultTemplateName());
}
QTemporaryDir::QTemporaryDir(const QString &templateName)
: d_ptr(new QTemporaryDirPrivate)
{
if (templateName.isEmpty())
d_ptr->create(d_ptr->defaultTemplateName());
d_ptr->create(defaultTemplateName());
else
d_ptr->create(templateName);
}
@ -189,9 +187,8 @@ QTemporaryDir::QTemporaryDir(const QString &templateName)
*/
QTemporaryDir::~QTemporaryDir()
{
if (d_ptr->success && d_ptr->autoRemove)
if (d_ptr->autoRemove)
remove();
delete d_ptr;
}
/*!

View File

@ -43,6 +43,7 @@
#define QTEMPORARYDIR_H
#include <QtCore/qdir.h>
#include <QtCore/QScopedPointer>
QT_BEGIN_HEADER
@ -70,7 +71,7 @@ public:
QString path() const;
private:
QTemporaryDirPrivate* const d_ptr;
QScopedPointer<QTemporaryDirPrivate> d_ptr;
Q_DISABLE_COPY(QTemporaryDir)
};

View File

@ -439,8 +439,6 @@ protected:
QTemporaryFilePrivate();
~QTemporaryFilePrivate();
QString defaultTemplateName() const;
bool autoRemove;
QString templateName;
};
@ -453,7 +451,7 @@ QTemporaryFilePrivate::~QTemporaryFilePrivate()
{
}
QString QTemporaryFilePrivate::defaultTemplateName() const
static QString defaultTemplateName()
{
QString baseName;
#if defined(QT_BUILD_CORE_LIB)
@ -518,7 +516,7 @@ QTemporaryFile::QTemporaryFile()
: QFile(*new QTemporaryFilePrivate)
{
Q_D(QTemporaryFile);
d->templateName = d->defaultTemplateName();
d->templateName = defaultTemplateName();
}
QTemporaryFile::QTemporaryFile(const QString &templateName)
@ -541,7 +539,7 @@ QTemporaryFile::QTemporaryFile()
: QFile(*new QTemporaryFilePrivate, 0)
{
Q_D(QTemporaryFile);
d->templateName = d->defaultTemplateName();
d->templateName = defaultTemplateName();
}
/*!
@ -577,7 +575,7 @@ QTemporaryFile::QTemporaryFile(QObject *parent)
: QFile(*new QTemporaryFilePrivate, parent)
{
Q_D(QTemporaryFile);
d->templateName = d->defaultTemplateName();
d->templateName = defaultTemplateName();
}
/*!

View File

@ -2522,8 +2522,6 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
required to do yourself. Using beginMoveRows and endMoveRows
is an alternative to emitting layoutAboutToBeChanged and
layoutChanged directly along with changePersistentIndexes.
layoutAboutToBeChanged is emitted by this method for compatibility
reasons.
The \a sourceParent index corresponds to the parent from which the
rows are moved; \a sourceFirst and \a sourceLast are the first and last
@ -2623,7 +2621,6 @@ bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sour
d->changes.push(destinationChange);
emit rowsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild);
emit layoutAboutToBeChanged();
d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical);
return true;
}
@ -2635,8 +2632,6 @@ bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sour
function \e after moving data within the model's underlying data
store.
layoutChanged is emitted by this method for compatibility reasons.
\sa beginMoveRows()
\since 4.6
@ -2661,7 +2656,6 @@ void QAbstractItemModel::endMoveRows()
d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Vertical);
emit rowsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first);
emit layoutChanged();
}
/*!
@ -2795,8 +2789,6 @@ void QAbstractItemModel::endRemoveColumns()
required to do yourself. Using beginMoveRows and endMoveRows
is an alternative to emitting layoutAboutToBeChanged and
layoutChanged directly along with changePersistentIndexes.
layoutAboutToBeChanged is emitted by this method for compatibility
reasons.
The \a sourceParent index corresponds to the parent from which the
columns are moved; \a sourceFirst and \a sourceLast are the first and last
@ -2848,7 +2840,6 @@ bool QAbstractItemModel::beginMoveColumns(const QModelIndex &sourceParent, int s
d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Horizontal);
emit columnsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild);
emit layoutAboutToBeChanged();
return true;
}
@ -2859,8 +2850,6 @@ bool QAbstractItemModel::beginMoveColumns(const QModelIndex &sourceParent, int s
function \e after moving data within the model's underlying data
store.
layoutChanged is emitted by this method for compatibility reasons.
\sa beginMoveColumns()
\since 4.6
@ -2885,7 +2874,6 @@ void QAbstractItemModel::endMoveColumns()
d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Horizontal);
emit columnsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first);
emit layoutChanged();
}
/*!

View File

@ -92,7 +92,7 @@ namespace QtPrivate {
template <typename T>
struct ApplyReturnValue {
void *data;
ApplyReturnValue(void *data) : data(data) {}
ApplyReturnValue(void *data_) : data(data_) {}
};
template<typename T, typename U>
void operator,(const T &value, const ApplyReturnValue<U> &container) {

View File

@ -56,11 +56,6 @@ const QMapData QMapData::shared_null = {
Q_REFCOUNT_INITIALIZER(-1), 0, 0, 0, false, true, false, 0
};
QMapData *QMapData::createData()
{
return createData(0);
}
QMapData *QMapData::createData(int alignment)
{
QMapData *d = new QMapData;
@ -95,11 +90,6 @@ void QMapData::continueFreeData(int offset)
delete this;
}
QMapData::Node *QMapData::node_create(Node *update[], int offset)
{
return node_create(update, offset, 0);
}
/*!
Creates a new node inside the data structure.

View File

@ -77,10 +77,8 @@ struct Q_CORE_EXPORT QMapData
uint strictAlignment : 1;
uint reserved : 29;
static QMapData *createData(); // ### Qt5 remove me
static QMapData *createData(int alignment);
void continueFreeData(int offset);
Node *node_create(Node *update[], int offset); // ### Qt5 remove me
Node *node_create(Node *update[], int offset, int alignment);
void node_delete(Node *update[], int offset, Node *node);
#ifdef QT_QMAP_DEBUG

View File

@ -56,64 +56,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
// QXmlStream* was originally in the QtXml module
// since we've moved it to QtCore in Qt 4.4.0, we need to
// keep binary compatibility
//
// The list of supported platforms is in:
// http://qt.nokia.com/doc/supported_platforms.html
//
// These platforms do not support symbol moving nor duplication
// (because duplicate symbols cause warnings when linking):
// Apple MacOS X (Mach-O executable format)
// special case: 64-bit on Mac wasn't supported before 4.5.0
// IBM AIX (XCOFF executable format)
//
// These platforms do not support symbol moving but allow it to be duplicated:
// Microsoft Windows (COFF PE executable format)
// special case: Windows CE wasn't supported before 4.4.0
//
// These platforms support symbol moving:
// HP HP-UX (PA-RISC2.0 shared executables)
// HP HP-UXi (ELF executable format)
// FreeBSD (ELF executable format)
// Linux (ELF executable format)
// SGI IRIX (ELF executable format)
// Sun Solaris (ELF executable format)
//
// Other platforms are supported through community contributions only.
// We are taking the optimist scenario here to avoid creating more
// symbols to be supported.
#if defined(Q_OS_MAC32) || defined(Q_OS_AIX)
# if !defined QT_BUILD_XML_LIB
# define Q_XMLSTREAM_RENAME_SYMBOLS
# endif
#endif
#if defined QT_BUILD_XML_LIB
# define Q_XMLSTREAM_EXPORT Q_XML_EXPORT
#else
# define Q_XMLSTREAM_EXPORT Q_CORE_EXPORT
#endif
#if defined Q_XMLSTREAM_RENAME_SYMBOLS
// don't worry, we'll undef and change to typedef at the bottom of the file
# define QXmlStreamAttribute QCoreXmlStreamAttribute
# define QXmlStreamAttributes QCoreXmlStreamAttributes
# define QXmlStreamEntityDeclaration QCoreXmlStreamEntityDeclaration
# define QXmlStreamEntityDeclarations QCoreXmlStreamEntityDeclarations
# define QXmlStreamEntityResolver QCoreXmlStreamEntityResolver
# define QXmlStreamNamespaceDeclaration QCoreXmlStreamNamespaceDeclaration
# define QXmlStreamNamespaceDeclarations QCoreXmlStreamNamespaceDeclarations
# define QXmlStreamNotationDeclaration QCoreXmlStreamNotationDeclaration
# define QXmlStreamNotationDeclarations QCoreXmlStreamNotationDeclarations
# define QXmlStreamReader QCoreXmlStreamReader
# define QXmlStreamStringRef QCoreXmlStreamStringRef
# define QXmlStreamWriter QCoreXmlStreamWriter
#endif
class Q_XMLSTREAM_EXPORT QXmlStreamStringRef {
class Q_CORE_EXPORT QXmlStreamStringRef {
QString m_string;
int m_position, m_size;
public:
@ -132,7 +75,7 @@ public:
class QXmlStreamReaderPrivate;
class QXmlStreamAttributes;
class Q_XMLSTREAM_EXPORT QXmlStreamAttribute {
class Q_CORE_EXPORT QXmlStreamAttribute {
QXmlStreamStringRef m_name, m_namespaceUri, m_qualifiedName, m_value;
void *reserved;
uint m_isDefault : 1;
@ -166,7 +109,7 @@ public:
Q_DECLARE_TYPEINFO(QXmlStreamAttribute, Q_MOVABLE_TYPE);
class Q_XMLSTREAM_EXPORT QXmlStreamAttributes : public QVector<QXmlStreamAttribute>
class Q_CORE_EXPORT QXmlStreamAttributes : public QVector<QXmlStreamAttribute>
{
public:
inline QXmlStreamAttributes() {}
@ -201,7 +144,7 @@ public:
#endif
};
class Q_XMLSTREAM_EXPORT QXmlStreamNamespaceDeclaration {
class Q_CORE_EXPORT QXmlStreamNamespaceDeclaration {
QXmlStreamStringRef m_prefix, m_namespaceUri;
void *reserved;
@ -224,7 +167,7 @@ public:
Q_DECLARE_TYPEINFO(QXmlStreamNamespaceDeclaration, Q_MOVABLE_TYPE);
typedef QVector<QXmlStreamNamespaceDeclaration> QXmlStreamNamespaceDeclarations;
class Q_XMLSTREAM_EXPORT QXmlStreamNotationDeclaration {
class Q_CORE_EXPORT QXmlStreamNotationDeclaration {
QXmlStreamStringRef m_name, m_systemId, m_publicId;
void *reserved;
@ -248,7 +191,7 @@ public:
Q_DECLARE_TYPEINFO(QXmlStreamNotationDeclaration, Q_MOVABLE_TYPE);
typedef QVector<QXmlStreamNotationDeclaration> QXmlStreamNotationDeclarations;
class Q_XMLSTREAM_EXPORT QXmlStreamEntityDeclaration {
class Q_CORE_EXPORT QXmlStreamEntityDeclaration {
QXmlStreamStringRef m_name, m_notationName, m_systemId, m_publicId, m_value;
void *reserved;
@ -278,7 +221,7 @@ Q_DECLARE_TYPEINFO(QXmlStreamEntityDeclaration, Q_MOVABLE_TYPE);
typedef QVector<QXmlStreamEntityDeclaration> QXmlStreamEntityDeclarations;
class Q_XMLSTREAM_EXPORT QXmlStreamEntityResolver
class Q_CORE_EXPORT QXmlStreamEntityResolver
{
public:
virtual ~QXmlStreamEntityResolver();
@ -287,7 +230,7 @@ public:
};
#ifndef QT_NO_XMLSTREAMREADER
class Q_XMLSTREAM_EXPORT QXmlStreamReader {
class Q_CORE_EXPORT QXmlStreamReader {
QDOC_PROPERTY(bool namespaceProcessing READ namespaceProcessing WRITE setNamespaceProcessing)
public:
enum TokenType {
@ -413,7 +356,7 @@ private:
class QXmlStreamWriterPrivate;
class Q_XMLSTREAM_EXPORT QXmlStreamWriter
class Q_CORE_EXPORT QXmlStreamWriter
{
QDOC_PROPERTY(bool autoFormatting READ autoFormatting WRITE setAutoFormatting)
QDOC_PROPERTY(int autoFormattingIndent READ autoFormattingIndent WRITE setAutoFormattingIndent)

View File

@ -859,7 +859,7 @@ const QAccessibleInterface *other, int otherChild) const
*/
QAccessible::Relation QAccessibleInterface::relationTo(const QAccessibleInterface *) const
{
return Unrelated;
return QAccessible::Unrelated;
}
/*!
@ -871,7 +871,7 @@ QAccessible::Relation QAccessibleInterface::relationTo(const QAccessibleInterfac
*/
QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterface::relations() const
{
return QVector<QPair<QAccessibleInterface*, Relation> >();
return QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >();
}
/*!
@ -1191,7 +1191,7 @@ QWindow *QAccessibleInterface::window() const
Returns an invalid QVariant if the object doesn't support the action.
*/
QVariant QAccessibleInterface::invokeMethod(Method method, const QVariantList &params)
QVariant QAccessibleInterface::invokeMethod(QAccessible::Method method, const QVariantList &params)
{
Q_UNUSED(method)
Q_UNUSED(params)

View File

@ -62,9 +62,16 @@ QT_MODULE(Gui)
class QAccessibleInterface;
class QWindow;
// We need to inherit QObject to expose the enums to QML.
class Q_GUI_EXPORT QAccessible
#ifndef qdoc
:public QObject
#endif
{
Q_OBJECT
Q_ENUMS(Role Event State)
public:
enum Event {
SoundPlayed = 0x0001,
Alert = 0x0002,
@ -141,6 +148,7 @@ public:
AcceleratorChanged = 0x80C0
};
enum StateFlag {
Normal = 0x00000000,
Unavailable = 0x00000001,
@ -152,11 +160,11 @@ public:
ReadOnly = 0x00000040,
HotTracked = 0x00000080,
DefaultButton = 0x00000100,
// #### Qt5 Expandable
Expanded = 0x00000200,
Collapsed = 0x00000400,
Busy = 0x00000800,
// Floating = 0x00001000,
Expandable = 0x00001000,
Marqueed = 0x00002000,
Animated = 0x00004000,
Invisible = 0x00008000,
@ -180,6 +188,7 @@ public:
};
Q_DECLARE_FLAGS(State, StateFlag)
enum Role {
NoRole = 0x00000000,
TitleBar = 0x00000001,
@ -224,7 +233,10 @@ public:
Graphic = 0x00000028,
StaticText = 0x00000029,
EditableText = 0x0000002A, // Editable, selectable, etc.
PushButton = 0x0000002B,
Button = 0x0000002B,
#ifndef qdoc
PushButton = Button, // deprecated
#endif
CheckBox = 0x0000002C,
RadioButton = 0x0000002D,
ComboBox = 0x0000002E,
@ -255,6 +267,7 @@ public:
Value,
Help,
Accelerator,
DebugDescription,
UserText = 0x0000ffff
};
@ -320,6 +333,12 @@ public:
private:
static UpdateHandler updateHandler;
static RootObjectHandler rootObjectHandler;
/*! @internal
This class is purely a collection of enums and static functions,
it is not supposed to be instantiated.
*/
QAccessible() {}
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::State)
@ -337,7 +356,7 @@ class QAccessibleImageInterface;
class QAccessibleTableInterface;
class QAccessibleTableCellInterface;
class Q_GUI_EXPORT QAccessibleInterface : public QAccessible
class Q_GUI_EXPORT QAccessibleInterface
{
public:
virtual ~QAccessibleInterface() {}
@ -347,8 +366,8 @@ public:
virtual QWindow *window() const;
// relations
virtual Relation relationTo(const QAccessibleInterface *other) const;
virtual QVector<QPair<QAccessibleInterface*, Relation> > relations() const;
virtual QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
virtual QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > relations() const;
virtual int childAt(int x, int y) const = 0;
@ -357,22 +376,23 @@ public:
virtual QAccessibleInterface *child(int index) const = 0;
virtual int childCount() const = 0;
virtual int indexOfChild(const QAccessibleInterface *) const = 0;
virtual int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const = 0;
virtual int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const = 0;
// properties and state
virtual QString text(Text t) const = 0;
virtual void setText(Text t, const QString &text) = 0;
virtual QString text(QAccessible::Text t) const = 0;
virtual void setText(QAccessible::Text t, const QString &text) = 0;
virtual QRect rect() const = 0;
virtual Role role() const = 0;
virtual State state() const = 0;
virtual QAccessible::Role role() const = 0;
virtual QAccessible::State state() const = 0;
// FIXME virtual QSet<QAccessible::State> states() const = 0;
virtual QColor foregroundColor() const;
virtual QColor backgroundColor() const;
virtual QVariant invokeMethod(Method method, const QVariantList &params = QVariantList());
virtual QVariant invokeMethod(QAccessible::Method method, const QVariantList &params = QVariantList());
inline QSet<Method> supportedMethods()
{ return qvariant_cast<QSet<Method> >(invokeMethod(ListSupportedMethods)); }
inline QSet<QAccessible::Method> supportedMethods()
{ return qvariant_cast<QSet<QAccessible::Method> >(invokeMethod(QAccessible::ListSupportedMethods)); }
inline QAccessibleTextInterface *textInterface()
{ return reinterpret_cast<QAccessibleTextInterface *>(interface_cast(QAccessible::TextInterface)); }

View File

@ -184,9 +184,6 @@ public:
virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const = 0;
// Returns a reference to the accessbile of the containing table.
virtual QAccessibleInterface* table() const = 0;
// #### Qt5 this should not be here but part of the state
virtual bool isExpandable() const = 0;
};
class Q_GUI_EXPORT QAccessibleTableInterface

View File

@ -150,7 +150,7 @@ QRect QAccessibleObject::rect() const
}
/*! \reimp */
void QAccessibleObject::setText(Text, const QString &)
void QAccessibleObject::setText(QAccessible::Text, const QString &)
{
}
@ -231,13 +231,13 @@ QAccessible::Relation QAccessibleApplication::relationTo(const QAccessibleInterf
{
QObject *o = other ? other->object() : 0;
if (!o)
return Unrelated;
return QAccessible::Unrelated;
if(o == object()) {
return Self;
return QAccessible::Self;
}
return Unrelated;
return QAccessible::Unrelated;
}
QAccessibleInterface *QAccessibleApplication::parent() const
@ -254,7 +254,7 @@ QAccessibleInterface *QAccessibleApplication::child(int index) const
}
/*! \reimp */
int QAccessibleApplication::navigate(RelationFlag relation, int,
int QAccessibleApplication::navigate(QAccessible::RelationFlag relation, int,
QAccessibleInterface **target) const
{
if (!target)
@ -264,16 +264,16 @@ int QAccessibleApplication::navigate(RelationFlag relation, int,
QObject *targetObject = 0;
switch (relation) {
case Self:
case QAccessible::Self:
targetObject = object();
break;
case FocusChild:
case QAccessible::FocusChild:
if (QWindow *window = QGuiApplication::activeWindow()) {
*target = window->accessibleRoot();
return 0;
}
break;
case Ancestor:
case QAccessible::Ancestor:
*target = parent();
return 0;
default:
@ -284,12 +284,12 @@ int QAccessibleApplication::navigate(RelationFlag relation, int,
}
/*! \reimp */
QString QAccessibleApplication::text(Text t) const
QString QAccessibleApplication::text(QAccessible::Text t) const
{
switch (t) {
case Name:
case QAccessible::Name:
return QGuiApplication::applicationName();
case Description:
case QAccessible::Description:
return QGuiApplication::applicationFilePath();
default:
break;
@ -300,13 +300,13 @@ QString QAccessibleApplication::text(Text t) const
/*! \reimp */
QAccessible::Role QAccessibleApplication::role() const
{
return Application;
return QAccessible::Application;
}
/*! \reimp */
QAccessible::State QAccessibleApplication::state() const
{
return QGuiApplication::activeWindow() ? Focused : Normal;
return QGuiApplication::activeWindow() ? QAccessible::Focused : QAccessible::Normal;
}

View File

@ -66,7 +66,7 @@ public:
// properties
QRect rect() const;
void setText(Text t, const QString &text);
void setText(QAccessible::Text t, const QString &text);
protected:
virtual ~QAccessibleObject();
@ -85,18 +85,18 @@ public:
// relations
int childCount() const;
int indexOfChild(const QAccessibleInterface*) const;
Relation relationTo(const QAccessibleInterface *other) const;
QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
// navigation
QAccessibleInterface *parent() const;
int childAt(int x, int y) const;
QAccessibleInterface *child(int index) const;
int navigate(RelationFlag, int, QAccessibleInterface **) const;
int navigate(QAccessible::RelationFlag, int, QAccessibleInterface **) const;
// properties and state
QString text(Text t) const;
Role role() const;
State state() const;
QString text(QAccessible::Text t) const;
QAccessible::Role role() const;
QAccessible::State state() const;
};
#endif // QT_NO_ACCESSIBILITY

View File

@ -56,7 +56,7 @@ QT_MODULE(Gui)
class QStringList;
class QAccessibleInterface;
struct Q_GUI_EXPORT QAccessibleFactoryInterface : public QAccessible, public QFactoryInterface
struct Q_GUI_EXPORT QAccessibleFactoryInterface : public QFactoryInterface
{
virtual QAccessibleInterface* create(const QString &key, QObject *object) = 0;
};

View File

@ -50,7 +50,9 @@ HEADERS += \
kernel/qsessionmanager.h \
kernel/qwindowdefs.h \
kernel/qscreen.h \
kernel/qstylehints.h
kernel/qstylehints.h \
kernel/qtouchdevice.h \
kernel/qtouchdevice_p.h
SOURCES += \
kernel/qclipboard_qpa.cpp \
@ -91,6 +93,7 @@ SOURCES += \
kernel/qguivariant.cpp \
kernel/qscreen.cpp \
kernel/qshortcutmap.cpp \
kernel/qstylehints.cpp
kernel/qstylehints.cpp \
kernel/qtouchdevice.cpp
win32:HEADERS+=kernel/qwindowdefs_win.h

View File

@ -3450,34 +3450,25 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
This enum represents the type of device that generated a QTouchEvent.
\value TouchScreen In this type of device, the touch surface and display are integrated. This
means the surface and display typically have the same size, such that there
is a direct relationship between the touch points' physical positions and the
coordinate reported by QTouchEvent::TouchPoint. As a result, Qt allows the
user to interact directly with multiple QWidgets and QGraphicsItems at the
same time.
This enum has been deprecated. Use QTouchDevice::DeviceType instead.
\value TouchPad In this type of device, the touch surface is separate from the display. There
is not a direct relationship between the physical touch location and the
on-screen coordinates. Instead, they are calculated relative to the current
mouse position, and the user must use the touch-pad to move this reference
point. Unlike touch-screens, Qt allows users to only interact with a single
QWidget or QGraphicsItem at a time.
\sa QTouchDevice::DeviceType, QTouchDevice::type(), QTouchEvent::device()
*/
/*!
Constructs a QTouchEvent with the given \a eventType, \a deviceType, and \a touchPoints.
The \a touchPointStates and \a modifiers are the current touch point states and keyboard
modifiers at the time of the event.
Constructs a QTouchEvent with the given \a eventType, \a deviceType, \a
touchPoints and \a device. The \a touchPointStates and \a modifiers
are the current touch point states and keyboard modifiers at the time of
the event.
*/
QTouchEvent::QTouchEvent(QEvent::Type eventType,
QTouchEvent::DeviceType deviceType,
QTouchDevice *device,
Qt::KeyboardModifiers modifiers,
Qt::TouchPointStates touchPointStates,
const QList<QTouchEvent::TouchPoint> &touchPoints)
: QInputEvent(eventType, modifiers),
_widget(0),
_deviceType(deviceType),
_device(device),
_touchPointStates(touchPointStates),
_touchPoints(touchPoints)
{ }
@ -3493,6 +3484,22 @@ QTouchEvent::~QTouchEvent()
Returns the widget on which the event occurred.
*/
/*! \fn QWindow *QTouchEvent::window() const
Returns the window on which the event occurred. Useful for doing
global-local mapping on data like rawScreenPositions() which,
for performance reasons, only stores the global positions in the
touch event.
*/
/*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const
Returns the touch device Type, which is of type \l {QTouchEvent::DeviceType} {DeviceType}.
This function has been deprecated. Use QTouchDevice::type() instead.
\sa QTouchDevice::type(), QTouchEvent::device()
*/
/*! \fn Qt::TouchPointStates QTouchEvent::touchPointStates() const
@ -3509,6 +3516,11 @@ QTouchEvent::~QTouchEvent()
Returns the touch device Type, which is of type \l {QTouchEvent::DeviceType} {DeviceType}.
*/
/*! \fn QTouchDevice* QTouchEvent::device() const
Returns the touch device from which this touch event originates.
*/
/*! \fn void QTouchEvent::setWidget(QWidget *widget)
\internal
@ -3516,6 +3528,13 @@ QTouchEvent::~QTouchEvent()
Sets the widget for this event.
*/
/*! \fn void QTouchEvent::setWindow(QWindow *window)
\internal
Sets the window for this event.
*/
/*! \fn void QTouchEvent::setTouchPointStates(Qt::TouchPointStates touchPointStates)
\internal
@ -3538,11 +3557,25 @@ QTouchEvent::~QTouchEvent()
{DeviceType}.
*/
/*! \fn void QTouchEvent::setTouchDevice(QTouchDevice *device)
\internal
Sets the touch event's device to the given one.
*/
/*! \class QTouchEvent::TouchPoint
\brief The TouchPoint class provides information about a touch point in a QTouchEvent.
\since 4.6
*/
/*! \enum QTouchEvent::TouchPoint::InfoFlags
The values of this enum describe additional information about a touch point.
\value Pen Indicates that the contact has been made by a designated pointing device (e.g. a pen) instead of a finger.
*/
/*! \internal
Constructs a QTouchEvent::TouchPoint for use in a QTouchEvent.
@ -3795,6 +3828,42 @@ qreal QTouchEvent::TouchPoint::pressure() const
return d->pressure;
}
/*!
Returns a velocity vector for this touch point.
The vector is in the screen's coordinate system, using pixels per seconds for the magnitude.
\note The returned vector is only valid if the touch device's capabilities include QTouchDevice::Velocity.
\sa QTouchDevice::capabilities(), device()
*/
QVector2D QTouchEvent::TouchPoint::velocity() const
{
return d->velocity;
}
/*!
Returns additional information about the touch point.
\sa QTouchEvent::TouchPoint::InfoFlags
*/
QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
{
return d->flags;
}
/*!
Returns the raw, unfiltered positions for the touch point. The positions are in screen coordinates.
To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window().
\note Returns an empty list if the touch device's capabilities do not include QTouchDevice::RawPositions.
\sa QTouchDevice::capabilities(), device(), window()
*/
QList<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
{
return d->rawScreenPositions;
}
/*! \internal */
void QTouchEvent::TouchPoint::setId(int id)
{
@ -3939,6 +4008,30 @@ void QTouchEvent::TouchPoint::setPressure(qreal pressure)
d->pressure = pressure;
}
/*! \internal */
void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v)
{
if (d->ref.load() != 1)
d = d->detach();
d->velocity = v;
}
/*! \internal */
void QTouchEvent::TouchPoint::setRawScreenPositions(const QList<QPointF> &positions)
{
if (d->ref.load() != 1)
d = d->detach();
d->rawScreenPositions = positions;
}
/* \internal */
void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
{
if (d->ref.load() != 1)
d = d->detach();
d->flags = flags;
}
/*! \internal */
QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::TouchPoint &other)
{

View File

@ -54,7 +54,8 @@
#include <QtCore/qvector.h>
#include <QtCore/qset.h>
#include <QtCore/qfile.h>
#include <QtGui/qvector2d.h>
#include <QtGui/qtouchdevice.h>
QT_BEGIN_HEADER
@ -692,6 +693,11 @@ public:
class Q_GUI_EXPORT TouchPoint
{
public:
enum InfoFlag {
Pen = 0x0001
};
Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
TouchPoint(int id = -1);
TouchPoint(const QTouchEvent::TouchPoint &other);
~TouchPoint();
@ -722,6 +728,9 @@ public:
QRectF screenRect() const;
qreal pressure() const;
QVector2D velocity() const;
InfoFlags flags() const;
QList<QPointF> rawScreenPositions() const;
// internal
void setId(int id);
@ -742,6 +751,9 @@ public:
void setSceneRect(const QRectF &sceneRect);
void setScreenRect(const QRectF &screenRect);
void setPressure(qreal pressure);
void setVelocity(const QVector2D &v);
void setFlags(InfoFlags flags);
void setRawScreenPositions(const QList<QPointF> &positions);
QTouchEvent::TouchPoint &operator=(const QTouchEvent::TouchPoint &other);
private:
@ -752,32 +764,36 @@ public:
friend class QApplicationPrivate;
};
enum DeviceType {
QT_DEPRECATED enum DeviceType {
TouchScreen,
TouchPad
};
QTouchEvent(QEvent::Type eventType,
QTouchEvent::DeviceType deviceType = TouchScreen,
QTouchDevice *device = 0,
Qt::KeyboardModifiers modifiers = Qt::NoModifier,
Qt::TouchPointStates touchPointStates = 0,
const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
~QTouchEvent();
inline QWidget *widget() const { return _widget; }
inline QTouchEvent::DeviceType deviceType() const { return _deviceType; }
inline QWindow *window() const { return _window; }
QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); }
inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
inline QTouchDevice *device() const { return _device; }
// internal
inline void setWidget(QWidget *awidget) { _widget = awidget; }
inline void setDeviceType(DeviceType adeviceType) { _deviceType = adeviceType; }
inline void setWindow(QWindow *awindow) { _window = awindow; }
inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
inline void setDevice(QTouchDevice *device) { _device = device; }
protected:
QWidget *_widget;
QTouchEvent::DeviceType _deviceType;
QWindow *_window;
QTouchDevice *_device;
Qt::TouchPointStates _touchPointStates;
QList<QTouchEvent::TouchPoint> _touchPoints;
@ -787,6 +803,7 @@ protected:
friend class QApplicationPrivate;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags)
class QScrollPrepareEventPrivate;
class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent

View File

@ -105,6 +105,9 @@ public:
startPos, startScenePos, startScreenPos, startNormalizedPos,
lastPos, lastScenePos, lastScreenPos, lastNormalizedPos;
qreal pressure;
QVector2D velocity;
QTouchEvent::TouchPoint::InfoFlags flags;
QList<QPointF> rawScreenPositions;
};
class QFileOpenEventPrivate

View File

@ -841,7 +841,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
QTouchEvent::TouchPoint previousTouchPoint;
switch (touchPoint.state()) {
case Qt::TouchPointPressed:
if (e->devType == QTouchEvent::TouchPad) {
if (e->device->type() == QTouchDevice::TouchPad) {
// on touch-pads, send all touch points to the same widget
w = d->windowForTouchPointId.isEmpty()
? QWeakPointer<QWindow>()
@ -944,13 +944,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
}
QTouchEvent touchEvent(eventType,
e->devType,
e->device,
e->modifiers,
it.value().first,
it.value().second);
touchEvent.setTimestamp(e->timestamp);
touchEvent.setWindow(w);
for (int i = 0; i < touchEvent.touchPoints().count(); ++i) {
const int pointCount = touchEvent.touchPoints().count();
for (int i = 0; i < pointCount; ++i) {
QTouchEvent::TouchPoint &touchPoint = touchEvent._touchPoints[i];
// preserve the sub-pixel resolution

View File

@ -164,6 +164,8 @@ bool QOpenGLContext::create()
Q_D(QOpenGLContext);
d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this);
d->platformGLContext->setContext(this);
if (!d->platformGLContext->isSharing())
d->shareContext = 0;
d->shareGroup = d->shareContext ? d->shareContext->shareGroup() : new QOpenGLContextGroup;
d->shareGroup->d_func()->addContext(this);
return d->platformGLContext;
@ -197,7 +199,7 @@ QOpenGLContext::~QOpenGLContext()
bool QOpenGLContext::isValid() const
{
Q_D(const QOpenGLContext);
return d->platformGLContext != 0;
return d->platformGLContext && d->platformGLContext->isValid();
}
/*!
@ -225,7 +227,7 @@ QOpenGLFunctions *QOpenGLContext::functions() const
bool QOpenGLContext::makeCurrent(QSurface *surface)
{
Q_D(QOpenGLContext);
if (!d->platformGLContext)
if (!isValid())
return false;
if (thread() != QThread::currentThread())
@ -257,7 +259,7 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
void QOpenGLContext::doneCurrent()
{
Q_D(QOpenGLContext);
if (!d->platformGLContext)
if (!isValid())
return;
if (QOpenGLContext::currentContext() == this)
@ -282,7 +284,7 @@ QSurface *QOpenGLContext::surface() const
void QOpenGLContext::swapBuffers(QSurface *surface)
{
Q_D(QOpenGLContext);
if (!d->platformGLContext)
if (!isValid())
return;
if (!surface) {

View File

@ -68,6 +68,9 @@ public:
virtual bool makeCurrent(QPlatformSurface *surface) = 0;
virtual void doneCurrent() = 0;
virtual bool isSharing() const { return false; }
virtual bool isValid() const { return true; }
virtual QFunctionPointer getProcAddress(const QByteArray &procName) = 0;
QOpenGLContext *context() const;

View File

@ -0,0 +1,224 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qtouchdevice.h"
#include "qtouchdevice_p.h"
#include <QList>
#include <QMutex>
#include <QCoreApplication>
QT_BEGIN_NAMESPACE
/*!
\class QTouchDevice
\brief The QTouchDevice class describes the device from with touch events originate.
\since 5.0
\ingroup touch
Each QTouchEvent contains a QTouchDevice pointer to allow accessing
device-specific properties like type and capabilities. It is the
responsibility of the platform or generic plug-ins to register the
available touch devices via QWindowSystemInterface before generating any
touch events. Applications do not need to instantiate this class, they
should just access the global instances pointed to by QTouchEvent::device().
*/
/*! \enum QTouchDevice::DeviceType
This enum represents the type of device that generated a QTouchEvent.
\value TouchScreen In this type of device, the touch surface and display are integrated. This
means the surface and display typically have the same size, such that there
is a direct relationship between the touch points' physical positions and the
coordinate reported by QTouchEvent::TouchPoint. As a result, Qt allows the
user to interact directly with multiple QWidgets and QGraphicsItems at the
same time.
\value TouchPad In this type of device, the touch surface is separate from the display. There
is not a direct relationship between the physical touch location and the
on-screen coordinates. Instead, they are calculated relative to the current
mouse position, and the user must use the touch-pad to move this reference
point. Unlike touch-screens, Qt allows users to only interact with a single
QWidget or QGraphicsItem at a time.
*/
/*! \enum QTouchDevice::CapabilityFlag
This enum is used with QTouchDevice::capabilities() to indicate what kind of information the
touch device or its driver can provide.
\value Position Indicates that position information is available, meaning
that the pos() family of functions in the touch points return valid points.
\value Area Indicates that touch area information is available, meaning that the rect() family
of functions in the touch points return valid rectangles.
\value Pressure Indicates that pressure information is available, meaning that pressure()
returns a valid value.
\value Velocity Indicates that velocity information is available, meaning that velocity()
returns a valid vector.
\value RawPositions Indicates that the list returned by QTouchEvent::TouchPoint::rawScreenPositions()
may contain one or more positions for each touch point. This is relevant when
the touch input gets filtered or corrected on driver level.
\value NormalizedPosition Indicates that the normalized position is available, meaning that normalizedPos()
returns a valid value.
*/
/*!
Creates a new touch device instance.
By default the name is empty, the only capability is Position and type is TouchScreen.
*/
QTouchDevice::QTouchDevice()
: d(new QTouchDevicePrivate)
{
}
QTouchDevice::~QTouchDevice()
{
delete d;
}
/*!
Returns the touch device type.
*/
QTouchDevice::DeviceType QTouchDevice::type() const
{
return d->type;
}
/*!
Returns the touch device capabilities.
*/
QTouchDevice::Capabilities QTouchDevice::capabilities() const
{
return d->caps;
}
/*!
Returns the touch device name.
This string may often be empty. It is however useful for systems that have
more than one touch input device because there it can be used to
differentiate between the devices (i.e. to tell from which device a
QTouchEvent originates from).
*/
QString QTouchDevice::name() const
{
return d->name;
}
/*!
Sets the device type.
*/
void QTouchDevice::setType(DeviceType devType)
{
d->type = devType;
}
/*!
Sets the capabilities supported by the device and its driver.
*/
void QTouchDevice::setCapabilities(Capabilities caps)
{
d->caps = caps;
}
/*!
Sets the name (a unique identifier) for the device. In most systems it is
enough to leave this unset and keep the default empty name. This identifier
becomes important when having multiple touch devices and a need to
differentiate between them.
*/
void QTouchDevice::setName(const QString &name)
{
d->name = name;
}
typedef QList<QTouchDevice *> TouchDevices;
Q_GLOBAL_STATIC(TouchDevices, deviceList)
Q_GLOBAL_STATIC(QMutex, devicesMutex)
static void cleanupDevicesList()
{
QMutexLocker lock(devicesMutex());
qDeleteAll(*deviceList());
deviceList()->clear();
}
/*!
Returns a list of all registered devices.
\note The returned list cannot be used to add new devices. Use QWindowSystemInterface::registerTouchDevice() instead.
*/
QList<const QTouchDevice *> QTouchDevice::devices()
{
QMutexLocker lock(devicesMutex());
QList<QTouchDevice *> *devList = deviceList();
QList<const QTouchDevice *> constDevList;
for (int i = 0, count = devList->count(); i != count; ++i)
constDevList.append(devList->at(i));
return constDevList;
}
/*!
\internal
*/
bool QTouchDevicePrivate::isRegistered(QTouchDevice *dev)
{
QMutexLocker lock(devicesMutex());
return deviceList()->contains(dev);
}
/*!
\internal
*/
void QTouchDevicePrivate::registerDevice(QTouchDevice *dev)
{
QMutexLocker lock(devicesMutex());
if (deviceList()->isEmpty())
qAddPostRoutine(cleanupDevicesList);
deviceList()->append(dev);
}
QT_END_NAMESPACE

View File

@ -39,62 +39,58 @@
**
****************************************************************************/
#ifndef QSOUND_P_H
#define QSOUND_P_H
#ifndef QTOUCHDEVICE_H
#define QTOUCHDEVICE_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qobject.h>
#include "QtCore/qobject.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
#ifndef QT_NO_SOUND
QT_MODULE(Gui)
class QSound;
/*
QAuServer is an INTERNAL class. If you wish to provide support for
additional audio servers, you can make a subclass of QAuServer to do
so, HOWEVER, your class may need to be re-engineered to some degree
with each new Qt release, including minor releases.
class QTouchDevicePrivate;
QAuBucket is whatever you want.
*/
class QAuBucket {
class Q_GUI_EXPORT QTouchDevice
{
public:
virtual ~QAuBucket();
enum DeviceType {
TouchScreen,
TouchPad
};
enum CapabilityFlag {
Position = 0x0001,
Area = 0x0002,
Pressure = 0x0004,
Velocity = 0x0008,
RawPositions = 0x0010,
NormalizedPosition = 0x0020
};
Q_DECLARE_FLAGS(Capabilities, CapabilityFlag)
QTouchDevice();
~QTouchDevice();
static QList<const QTouchDevice *> devices();
QString name() const;
DeviceType type() const;
Capabilities capabilities() const;
void setName(const QString &name);
void setType(DeviceType devType);
void setCapabilities(Capabilities caps);
private:
QTouchDevicePrivate *d;
};
class QAuServer : public QObject {
Q_OBJECT
public:
explicit QAuServer(QObject* parent);
~QAuServer();
virtual void init(QSound*);
virtual void play(const QString& filename);
virtual void play(QSound*)=0;
virtual void stop(QSound*)=0;
virtual bool okay()=0;
protected:
void setBucket(QSound*, QAuBucket*);
QAuBucket* bucket(QSound*);
int decLoop(QSound*);
};
#endif // QT_NO_SOUND
Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchDevice::Capabilities)
QT_END_NAMESPACE
#endif // QSOUND_P_H
QT_END_HEADER
#endif // QTOUCHDEVICE_H

View File

@ -39,10 +39,11 @@
**
****************************************************************************/
#ifndef QSOUND_H
#define QSOUND_H
#ifndef QTOUCHDEVICE_P_H
#define QTOUCHDEVICE_P_H
#include <QtCore/qobject.h>
#include <QtGui/qtouchdevice.h>
QT_BEGIN_HEADER
@ -50,41 +51,24 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
#ifndef QT_NO_SOUND
class QSoundPrivate;
class Q_WIDGETS_EXPORT QSound : public QObject
class QTouchDevicePrivate
{
Q_OBJECT
public:
static bool isAvailable();
static void play(const QString& filename);
QTouchDevicePrivate()
: type(QTouchDevice::TouchScreen),
caps(QTouchDevice::Position)
{ }
explicit QSound(const QString& filename, QObject* parent = 0);
~QSound();
QTouchDevice::DeviceType type;
QTouchDevice::Capabilities caps;
QString name;
int loops() const;
int loopsRemaining() const;
void setLoops(int);
QString fileName() const;
bool isFinished() const;
public Q_SLOTS:
void play();
void stop();
private:
Q_DECLARE_PRIVATE(QSound)
friend class QAuServer;
static void registerDevice(QTouchDevice *dev);
static bool isRegistered(QTouchDevice *dev);
};
#endif // QT_NO_SOUND
QT_END_NAMESPACE
QT_END_HEADER
#endif // QSOUND_H
#endif // QTOUCHDEVICE_P_H

View File

@ -41,6 +41,7 @@
#include "qwindowsysteminterface_qpa.h"
#include "qwindowsysteminterface_qpa_p.h"
#include "private/qguiapplication_p.h"
#include "private/qtouchdevice_p.h"
#include <QAbstractEventDispatcher>
#include <qdebug.h>
@ -213,16 +214,28 @@ void QWindowSystemInterfacePrivate::queueWindowSystemEvent(QWindowSystemInterfac
dispatcher->wakeUp();
}
void QWindowSystemInterface::handleTouchEvent(QWindow *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleTouchEvent(w, time, type, devType, points, mods);
void QWindowSystemInterface::registerTouchDevice(QTouchDevice *device)
{
QTouchDevicePrivate::registerDevice(device);
}
void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods)
void QWindowSystemInterface::handleTouchEvent(QWindow *w, QEvent::Type type, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleTouchEvent(w, time, type, device, points, mods);
}
void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEvent::Type type,
QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods)
{
if (!points.size()) // Touch events must have at least one point
return;
if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
return;
QList<QTouchEvent::TouchPoint> touchPoints;
Qt::TouchPointStates states;
QTouchEvent::TouchPoint p;
@ -247,13 +260,16 @@ void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEv
// when the event gets processed by QGuiApplication.
p.setNormalizedPos(point->normalPosition);
p.setVelocity(point->velocity);
p.setFlags(point->flags);
p.setRawScreenPositions(point->rawPositions);
touchPoints.append(p);
++point;
}
QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, devType, touchPoints, mods);
new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, device, touchPoints, mods);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}

View File

@ -51,12 +51,14 @@
#include <QtCore/QMutex>
#include <QtGui/QTouchEvent>
#include <QtCore/QEventLoop>
#include <QtGui/QVector2D>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QMimeData;
class QTouchDevice;
QT_MODULE(Gui)
@ -84,16 +86,23 @@ public:
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
struct TouchPoint {
TouchPoint() : id(0), isPrimary(false), pressure(0), state(Qt::TouchPointStationary), flags(0) { }
int id; // for application use
bool isPrimary; // for application use
QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1)
QRectF area; // the touched area, centered at position in screen coordinates
qreal pressure; // 0 to 1
Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released}
QVector2D velocity; // in screen coordinate system, pixels / seconds
QTouchEvent::TouchPoint::InfoFlags flags;
QList<QPointF> rawPositions; // in screen coordinates
};
static void handleTouchEvent(QWindow *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void handleTouchEvent(QWindow *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void registerTouchDevice(QTouchDevice *device);
static void handleTouchEvent(QWindow *w, QEvent::Type type, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void handleTouchEvent(QWindow *w, ulong timestamp, QEvent::Type type, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void handleGeometryChange(QWindow *w, const QRect &newRect);
static void handleSynchronousGeometryChange(QWindow *w, const QRect &newRect);

View File

@ -187,12 +187,12 @@ public:
class TouchEvent : public InputEvent {
public:
TouchEvent(QWindow *w, ulong time, QEvent::Type t, QTouchEvent::DeviceType d, const QList<QTouchEvent::TouchPoint> &p, Qt::KeyboardModifiers mods)
:InputEvent(w, time, Touch, mods), devType(d), points(p), touchType(t) { }
QTouchEvent::DeviceType devType;
TouchEvent(QWindow *w, ulong time, QEvent::Type t, QTouchDevice *dev,
const QList<QTouchEvent::TouchPoint> &p, Qt::KeyboardModifiers mods)
:InputEvent(w, time, Touch, mods), device(dev), points(p), touchType(t) { }
QTouchDevice *device;
QList<QTouchEvent::TouchPoint> points;
QEvent::Type touchType;
};
class ScreenOrientationEvent : public WindowSystemEvent {

View File

@ -472,12 +472,16 @@ void QHttpThreadDelegate::headerChangedSlot()
// Is using a zerocopy buffer allowed by user and possible with this reply?
if (httpReply->supportsUserProvidedDownloadBuffer()
&& downloadBufferMaximumSize > 0) {
&& (downloadBufferMaximumSize > 0) && (httpReply->contentLength() <= downloadBufferMaximumSize)) {
QT_TRY {
char *buf = new char[httpReply->contentLength()]; // throws if allocation fails
if (buf) {
downloadBuffer = QSharedPointer<char>(buf, downloadBufferDeleter);
httpReply->setUserProvidedDownloadBuffer(buf);
}
} QT_CATCH(const std::bad_alloc &) {
// in out of memory situations, don't use downloadbuffer.
}
}
// We fetch this into our own

View File

@ -1630,6 +1630,10 @@ void QSslSocket::startClientEncryption()
qWarning("QSslSocket::startClientEncryption: cannot start handshake on non-plain connection");
return;
}
if (state() != ConnectedState) {
qWarning("QSslSocket::startClientEncryption: cannot start handshake when not connected");
return;
}
#ifdef QSSLSOCKET_DEBUG
qDebug() << "QSslSocket::startClientEncryption()";
#endif

View File

@ -56,7 +56,7 @@ QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatform
EGLConfig config = q_configFromGLFormat(display, format, true);
m_format = q_glFormatFromConfig(display, config);
EGLContext shareContext = share ? static_cast<QEGLPlatformContext *>(share)->m_eglContext : 0;
m_shareContext = share ? static_cast<QEGLPlatformContext *>(share)->m_eglContext : 0;
QVector<EGLint> contextAttrs;
contextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
@ -64,11 +64,10 @@ QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatform
contextAttrs.append(EGL_NONE);
eglBindAPI(m_eglApi);
m_eglContext = eglCreateContext(m_eglDisplay, config, shareContext, contextAttrs.constData());
if (m_eglContext == EGL_NO_CONTEXT) {
qWarning("Could not create the egl context\n");
eglTerminate(m_eglDisplay);
qFatal("EGL error");
m_eglContext = eglCreateContext(m_eglDisplay, config, m_shareContext, contextAttrs.constData());
if (m_eglContext == EGL_NO_CONTEXT && m_shareContext != EGL_NO_CONTEXT) {
m_shareContext = 0;
m_eglContext = eglCreateContext(m_eglDisplay, config, 0, contextAttrs.constData());
}
}

View File

@ -59,6 +59,8 @@ public:
void (*getProcAddress(const QByteArray &procName)) ();
QSurfaceFormat format() const;
bool isSharing() const { return m_shareContext != EGL_NO_CONTEXT; }
bool isValid() const { return m_eglContext != EGL_NO_CONTEXT; }
EGLContext eglContext() const;
@ -67,6 +69,7 @@ protected:
private:
EGLContext m_eglContext;
EGLContext m_shareContext;
EGLDisplay m_eglDisplay;
EGLenum m_eglApi;

View File

@ -270,7 +270,7 @@ QString QAccessibleItemRow::text_helper(int child) const
return value;
}
QString QAccessibleItemRow::text(Text t, int child) const
QString QAccessibleItemRow::text(QAccessible::Text t, int child) const
{
QString value;
if (t == Name) {
@ -339,7 +339,7 @@ QString QAccessibleItemRow::text(Text t, int child) const
return value;
}
void QAccessibleItemRow::setText(Text t, int child, const QString &text)
void QAccessibleItemRow::setText(QAccessible::Text t, int child, const QString &text)
{
if (m_header) {
if (child)
@ -966,7 +966,7 @@ int QAccessibleItemView::childCount() const
}
}
QString QAccessibleItemView::text(Text t, int child) const
QString QAccessibleItemView::text(QAccessible::Text t, int child) const
{
if (atViewport()) {
if (!child)
@ -983,7 +983,7 @@ QString QAccessibleItemView::text(Text t, int child) const
}
}
void QAccessibleItemView::setText(Text t, int child, const QString &text)
void QAccessibleItemView::setText(QAccessible::Text t, int child, const QString &text)
{
if (atViewport()) {
if (!child) {
@ -1386,7 +1386,7 @@ int QAccessibleHeader::childCount() const
return header()->count();
}
QString QAccessibleHeader::text(Text t, int child) const
QString QAccessibleHeader::text(QAccessible::Text t, int child) const
{
QString str;
@ -1464,10 +1464,10 @@ public:
}
QObject *object() const { return 0; }
Role role() const { return QAccessible::PageTab; }
State state() const {
QAccessible::Role role() const { return QAccessible::PageTab; }
QAccessible::State state() const {
QAccessibleInterface *parentInterface = parent();
State state = parentInterface->state();
QAccessible::State state = parentInterface->state();
delete parentInterface;
return state;
}
@ -1487,14 +1487,14 @@ public:
int childCount() const { return 0; }
int indexOfChild(const QAccessibleInterface *) const { return -1; }
QString text(Text) const { return qt_accStripAmp(m_parent->tabText(m_index)); }
void setText(Text, const QString &) {}
QString text(QAccessible::Text) const { return qt_accStripAmp(m_parent->tabText(m_index)); }
void setText(QAccessible::Text, const QString &) {}
QAccessibleInterface *parent() const {
return QAccessible::queryAccessibleInterface(m_parent);
}
QAccessibleInterface *child(int) const { return 0; }
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
{
if (relation == QAccessible::Ancestor && index == 1) {
*iface = parent();
@ -1502,7 +1502,7 @@ public:
}
return -1;
}
Relation relationTo(const QAccessibleInterface *) const
QAccessible::Relation relationTo(const QAccessibleInterface *) const
{
return QAccessible::Unrelated;
}
@ -1533,7 +1533,7 @@ private:
Constructs a QAccessibleTabBar object for \a w.
*/
QAccessibleTabBar::QAccessibleTabBar(QWidget *w)
: QAccessibleWidget(w, PageTabList)
: QAccessibleWidget(w, QAccessible::PageTabList)
{
Q_ASSERT(tabBar());
}
@ -1544,7 +1544,7 @@ QTabBar *QAccessibleTabBar::tabBar() const
return qobject_cast<QTabBar*>(object());
}
int QAccessibleTabBar::navigate(RelationFlag rel, int entry, QAccessibleInterface **target) const
int QAccessibleTabBar::navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const
{
if (rel == QAccessible::Child) {
*target = child(entry - 1);
@ -1590,7 +1590,7 @@ int QAccessibleTabBar::childCount() const
return tabBar()->count() + 2;
}
QString QAccessibleTabBar::text(Text t) const
QString QAccessibleTabBar::text(QAccessible::Text t) const
{
if (t == QAccessible::Name) {
return qt_accStripAmp(tabBar()->tabText(tabBar()->currentIndex()));
@ -1648,7 +1648,7 @@ QVector<int> QAccessibleTabBar::selection() const
Constructs a QAccessibleComboBox object for \a w.
*/
QAccessibleComboBox::QAccessibleComboBox(QWidget *w)
: QAccessibleWidget(w, ComboBox)
: QAccessibleWidget(w, QAccessible::ComboBox)
{
Q_ASSERT(comboBox());
}
@ -1696,24 +1696,24 @@ int QAccessibleComboBox::indexOfChild(const QAccessibleInterface *child) const
}
/*! \reimp */
QString QAccessibleComboBox::text(Text t) const
QString QAccessibleComboBox::text(QAccessible::Text t) const
{
QString str;
switch (t) {
case Name:
case QAccessible::Name:
#ifndef Q_OS_UNIX // on Linux we use relations for this, name is text (fall through to Value)
str = QAccessibleWidget::text(t);
break;
#endif
case Value:
case QAccessible::Value:
if (comboBox()->isEditable())
str = comboBox()->lineEdit()->text();
else
str = comboBox()->currentText();
break;
#ifndef QT_NO_SHORTCUT
case Accelerator:
case QAccessible::Accelerator:
str = (QString)QKeySequence(Qt::Key_Down);
break;
#endif
@ -1770,7 +1770,7 @@ static inline void removeInvisibleWidgetsFromList(QWidgetList *list)
#ifndef QT_NO_SCROLLAREA
// ======================= QAccessibleAbstractScrollArea =======================
QAccessibleAbstractScrollArea::QAccessibleAbstractScrollArea(QWidget *widget)
: QAccessibleWidget(widget, Client)
: QAccessibleWidget(widget, QAccessible::Client)
{
Q_ASSERT(qobject_cast<QAbstractScrollArea *>(widget));
}
@ -1805,7 +1805,7 @@ bool QAccessibleAbstractScrollArea::isValid() const
return (QAccessibleWidget::isValid() && abstractScrollArea() && abstractScrollArea()->viewport());
}
int QAccessibleAbstractScrollArea::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
int QAccessibleAbstractScrollArea::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
{
if (!target)
return -1;
@ -1815,8 +1815,8 @@ int QAccessibleAbstractScrollArea::navigate(RelationFlag relation, int entry, QA
QWidget *targetWidget = 0;
QWidget *entryWidget = 0;
if (relation == Child ||
relation == Left || relation == Up || relation == Right || relation == Down) {
if (relation == QAccessible::Child ||
relation == QAccessible::Left || relation == QAccessible::Up || relation == QAccessible::Right || relation == QAccessible::Down) {
QWidgetList children = accessibleChildren();
if (entry < 0 || entry > children.count())
return -1;
@ -1832,12 +1832,12 @@ int QAccessibleAbstractScrollArea::navigate(RelationFlag relation, int entry, QA
// It might be possible to make it more general, but I'll leave that as an exercise
// to the reader. :-)
switch (relation) {
case Child:
case QAccessible::Child:
if (entry > 0) {
*target = child(entry - 1);
return *target ? 0 : -1;
}
case Left:
case QAccessible::Left:
if (entry < 1)
break;
switch (entryElement) {
@ -1861,7 +1861,7 @@ int QAccessibleAbstractScrollArea::navigate(RelationFlag relation, int entry, QA
break;
}
break;
case Right:
case QAccessible::Right:
if (entry < 1)
break;
switch (entryElement) {
@ -1884,7 +1884,7 @@ int QAccessibleAbstractScrollArea::navigate(RelationFlag relation, int entry, QA
break;
}
break;
case Up:
case QAccessible::Up:
if (entry < 1)
break;
switch (entryElement) {
@ -1898,7 +1898,7 @@ int QAccessibleAbstractScrollArea::navigate(RelationFlag relation, int entry, QA
break;
}
break;
case Down:
case QAccessible::Down:
if (entry < 1)
break;
switch (entryElement) {

View File

@ -79,7 +79,7 @@ public:
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
bool isValid() const;
int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
// int childAt(int x, int y) const;
//protected:
@ -109,7 +109,7 @@ public:
int childCount() const;
QRect rect(int child) const;
QString text(Text t, int child) const;
QString text(QAccessible::Text t, int child) const;
Role role(int child) const;
State state(int child) const;
@ -123,8 +123,8 @@ class QAccessibleItemRow: public QAccessibleInterface
public:
QAccessibleItemRow(QAbstractItemView *view, const QModelIndex &index = QModelIndex(), bool isHeader = false);
QRect rect(int child) const;
QString text(Text t, int child) const;
void setText(Text t, int child, const QString &text);
QString text(QAccessible::Text t, int child) const;
void setText(QAccessible::Text t, int child, const QString &text);
bool isValid() const;
QObject *object() const;
Role role(int child) const;
@ -138,7 +138,7 @@ public:
int childAt(int x, int y) const;
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
int userActionCount(int child) const;
QString actionText(int action, Text t, int child) const;
@ -170,14 +170,14 @@ public:
QRect rect(int child) const;
int childAt(int x, int y) const;
int childCount() const;
QString text(Text t, int child) const;
void setText(Text t, int child, const QString &text);
QString text(QAccessible::Text t, int child) const;
void setText(QAccessible::Text t, int child, const QString &text);
int indexOfChild(const QAccessibleInterface *iface) const;
QModelIndex childIndex(int child) const;
int entryFromIndex(const QModelIndex &index) const;
bool isValid() const;
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
QAccessibleInterface *accessibleAt(int row, int column);
QAccessibleInterface *caption();
@ -234,14 +234,14 @@ public:
explicit QAccessibleTabBar(QWidget *w);
int childCount() const;
QString text(Text t) const;
QString text(QAccessible::Text t) const;
bool setSelected(int child, bool on, bool extend);
QVector<int> selection() const;
QAccessibleInterface* child(int index) const;
int indexOfChild(const QAccessibleInterface *child) const;
int navigate(RelationFlag rel, int entry, QAccessibleInterface **target) const;
int navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const;
protected:
QTabBar *tabBar() const;
@ -259,7 +259,7 @@ public:
int indexOfChild(const QAccessibleInterface *child) const;
QAccessibleInterface* child(int index) const;
QString text(Text t) const;
QString text(QAccessible::Text t) const;
// QAccessibleActionInterface
QStringList actionNames() const;

View File

@ -224,7 +224,6 @@ QAccessibleInterface *QAccessibleTable::cellAt(int row, int column) const
{
Q_ASSERT(role() != QAccessible::Tree);
QModelIndex index = view->model()->index(row, column);
//Q_ASSERT(index.isValid());
if (!index.isValid()) {
qWarning() << "QAccessibleTable::cellAt: invalid index: " << index << " for " << view;
return 0;
@ -411,7 +410,7 @@ int QAccessibleTable::indexOfChild(const QAccessibleInterface *iface) const
return -1;
}
QString QAccessibleTable::text(Text t) const
QString QAccessibleTable::text(QAccessible::Text t) const
{
if (t == QAccessible::Description)
return view->accessibleDescription();
@ -443,11 +442,11 @@ QAccessibleInterface *QAccessibleTable::child(int index) const
return childFromLogical(index + 1);
}
int QAccessibleTable::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
int QAccessibleTable::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
{
*iface = 0;
switch (relation) {
case Ancestor: {
case QAccessible::Ancestor: {
*iface = parent();
return *iface ? 0 : -1;
}
@ -551,7 +550,7 @@ int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
return -1;
}
int QAccessibleTree::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
int QAccessibleTree::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
{
switch (relation) {
case QAccessible::Child: {
@ -623,7 +622,8 @@ bool QAccessibleTree::selectRow(int row)
QAccessibleTableCell::QAccessibleTableCell(QAbstractItemView *view_, const QModelIndex &index_, QAccessible::Role role_)
: /* QAccessibleSimpleEditableTextInterface(this), */ view(view_), m_index(index_), m_role(role_)
{
Q_ASSERT(index_.isValid());
if (!index_.isValid())
qWarning() << "QAccessibleTableCell::QAccessibleTableCell with invalid index: " << index_;
}
void *QAccessibleTableCell::interface_cast(QAccessible::InterfaceType t)
@ -724,41 +724,38 @@ QAccessible::Role QAccessibleTableCell::role() const
QAccessible::State QAccessibleTableCell::state() const
{
State st = Normal;
QAccessible::State st = QAccessible::Normal;
QRect globalRect = view->rect();
globalRect.translate(view->mapToGlobal(QPoint(0,0)));
if (!globalRect.intersects(rect()))
st |= Invisible;
st |= QAccessible::Invisible;
if (view->selectionModel()->isSelected(m_index))
st |= Selected;
st |= QAccessible::Selected;
if (view->selectionModel()->currentIndex() == m_index)
st |= Focused;
st |= QAccessible::Focused;
if (m_index.model()->data(m_index, Qt::CheckStateRole).toInt() == Qt::Checked)
st |= Checked;
st |= QAccessible::Checked;
Qt::ItemFlags flags = m_index.flags();
if (flags & Qt::ItemIsSelectable) {
st |= Selectable;
st |= Focusable;
st |= QAccessible::Selectable;
st |= QAccessible::Focusable;
if (view->selectionMode() == QAbstractItemView::MultiSelection)
st |= MultiSelectable;
st |= QAccessible::MultiSelectable;
if (view->selectionMode() == QAbstractItemView::ExtendedSelection)
st |= ExtSelectable;
st |= QAccessible::ExtSelectable;
}
if (m_role == QAccessible::TreeItem) {
const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
if (treeView->model()->hasChildren(m_index))
st |= QAccessible::Expandable;
if (treeView->isExpanded(m_index))
st |= Expanded;
st |= QAccessible::Expanded;
}
return st;
}
bool QAccessibleTableCell::isExpandable() const
{
return view->model()->hasChildren(m_index);
}
QRect QAccessibleTableCell::rect() const
{
@ -771,7 +768,7 @@ QRect QAccessibleTableCell::rect() const
return r;
}
QString QAccessibleTableCell::text(Text t) const
QString QAccessibleTableCell::text(QAccessible::Text t) const
{
QAbstractItemModel *model = view->model();
QString value;
@ -791,7 +788,7 @@ QString QAccessibleTableCell::text(Text t) const
return value;
}
void QAccessibleTableCell::setText(Text /*t*/, const QString &text)
void QAccessibleTableCell::setText(QAccessible::Text /*t*/, const QString &text)
{
if (!(m_index.flags() & Qt::ItemIsEditable))
return;
@ -800,10 +797,6 @@ void QAccessibleTableCell::setText(Text /*t*/, const QString &text)
bool QAccessibleTableCell::isValid() const
{
if (!m_index.isValid()) {
qDebug() << "Interface is not valid";
}
return m_index.isValid();
}
@ -820,9 +813,9 @@ QAccessibleInterface *QAccessibleTableCell::child(int) const
return 0;
}
int QAccessibleTableCell::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
int QAccessibleTableCell::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
{
if (relation == Ancestor && index == 1) {
if (relation == QAccessible::Ancestor && index == 1) {
*iface = parent();
return 0;
}
@ -833,12 +826,12 @@ int QAccessibleTableCell::navigate(RelationFlag relation, int index, QAccessible
switch (relation) {
case Child: {
case QAccessible::Child: {
return -1;
}
case Sibling:
case QAccessible::Sibling:
if (index > 0) {
QAccessibleInterface *parent = queryAccessibleInterface(view);
QAccessibleInterface *parent = QAccessible::queryAccessibleInterface(view);
*iface = parent->child(index - 1);
delete parent;
return *iface ? 0 : -1;
@ -934,7 +927,7 @@ QRect QAccessibleTableHeaderCell::rect() const
: QRect(zero.x(), zero.y() + sectionPos, header->width(), sectionSize);
}
QString QAccessibleTableHeaderCell::text(Text t) const
QString QAccessibleTableHeaderCell::text(QAccessible::Text t) const
{
QAbstractItemModel *model = view->model();
QString value;
@ -954,7 +947,7 @@ QString QAccessibleTableHeaderCell::text(Text t) const
return value;
}
void QAccessibleTableHeaderCell::setText(Text, const QString &)
void QAccessibleTableHeaderCell::setText(QAccessible::Text, const QString &)
{
return;
}
@ -981,7 +974,7 @@ QAccessibleInterface *QAccessibleTableHeaderCell::child(int) const
return 0;
}
int QAccessibleTableHeaderCell::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
int QAccessibleTableHeaderCell::navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const
{
if (relation == QAccessible::Ancestor && index == 1) {
*iface = parent();

View File

@ -66,9 +66,9 @@ public:
virtual ~QAccessibleTable();
QObject *object() const { return view; }
Role role() const;
State state() const;
QString text(Text t) const;
QAccessible::Role role() const;
QAccessible::State state() const;
QString text(QAccessible::Text t) const;
QRect rect() const;
int childAt(int x, int y) const;
@ -77,10 +77,10 @@ public:
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
Relation relationTo(const QAccessibleInterface *other) const;
int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
QVariant invokeMethod(Method, const QVariantList &) { return QVariant(); }
QVariant invokeMethod(QAccessible::Method, const QVariantList &) { return QVariant(); }
void *interface_cast(QAccessible::InterfaceType t);
// table interface
@ -159,8 +159,8 @@ public:
int rowCount() const;
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
Relation relationTo(const QAccessibleInterface *other) const;
int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
// table interface
QAccessibleInterface *cellAt(int row, int column) const;
@ -179,8 +179,8 @@ public:
void *interface_cast(QAccessible::InterfaceType t);
QObject *object() const { return 0; }
Role role() const;
State state() const;
QAccessible::Role role() const;
QAccessible::State state() const;
QRect rect() const;
bool isValid() const;
@ -188,15 +188,13 @@ public:
int childCount() const { return 0; }
int indexOfChild(const QAccessibleInterface *) const { return -1; }
QString text(Text t) const;
void setText(Text t, const QString &text);
QString text(QAccessible::Text t) const;
void setText(QAccessible::Text t, const QString &text);
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int) const;
int navigate(RelationFlag relation, int m_index, QAccessibleInterface **iface) const;
Relation relationTo(const QAccessibleInterface *other) const;
bool isExpandable() const;
int navigate(QAccessible::RelationFlag relation, int m_index, QAccessibleInterface **iface) const;
QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
// cell interface
virtual int columnExtent() const;
@ -228,8 +226,8 @@ public:
QAccessibleTableHeaderCell(QAbstractItemView *view, int index, Qt::Orientation orientation);
QObject *object() const { return 0; }
Role role() const;
State state() const;
QAccessible::Role role() const;
QAccessible::State state() const;
QRect rect() const;
bool isValid() const;
@ -237,13 +235,13 @@ public:
int childCount() const { return 0; }
int indexOfChild(const QAccessibleInterface *) const { return -1; }
QString text(Text t) const;
void setText(Text t, const QString &text);
QString text(QAccessible::Text t) const;
void setText(QAccessible::Text t, const QString &text);
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const;
QAccessible::Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
private:
QAbstractItemView *view;
@ -265,8 +263,8 @@ public:
{}
QObject *object() const { return 0; }
Role role() const { return QAccessible::Pane; }
State state() const { return QAccessible::Normal; }
QAccessible::Role role() const { return QAccessible::Pane; }
QAccessible::State state() const { return QAccessible::Normal; }
QRect rect() const { return QRect(); }
bool isValid() const { return true; }
@ -274,8 +272,8 @@ public:
int childCount() const { return 0; }
int indexOfChild(const QAccessibleInterface *) const { return -1; }
QString text(Text) const { return QString(); }
void setText(Text, const QString &) {}
QString text(QAccessible::Text) const { return QString(); }
void setText(QAccessible::Text, const QString &) {}
QAccessibleInterface *parent() const {
return QAccessible::queryAccessibleInterface(view);
@ -283,7 +281,7 @@ public:
QAccessibleInterface *child(int) const {
return 0;
}
int navigate(RelationFlag relation, int, QAccessibleInterface **iface) const
int navigate(QAccessible::RelationFlag relation, int, QAccessibleInterface **iface) const
{
if (relation == QAccessible::Ancestor) {
*iface = parent();
@ -291,7 +289,7 @@ public:
}
return -1;
}
Relation relationTo(int, const QAccessibleInterface *, int) const
QAccessible::Relation relationTo(int, const QAccessibleInterface *, int) const
{
return QAccessible::Unrelated;
}

View File

@ -193,41 +193,41 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
#endif
#ifndef QT_NO_TOOLBUTTON
} else if (classname == QLatin1String("QToolButton")) {
Role role = NoRole;
QAccessible::Role role = QAccessible::NoRole;
#ifndef QT_NO_MENU
QToolButton *tb = qobject_cast<QToolButton*>(widget);
if (!tb->menu())
role = tb->isCheckable() ? CheckBox : PushButton;
role = tb->isCheckable() ? QAccessible::CheckBox : QAccessible::PushButton;
else if (!tb->popupMode() != QToolButton::DelayedPopup)
role = ButtonDropDown;
role = QAccessible::ButtonDropDown;
else
#endif
role = ButtonMenu;
role = QAccessible::ButtonMenu;
iface = new QAccessibleToolButton(widget, role);
#endif // QT_NO_TOOLBUTTON
} else if (classname == QLatin1String("QCheckBox")) {
iface = new QAccessibleButton(widget, CheckBox);
iface = new QAccessibleButton(widget, QAccessible::CheckBox);
} else if (classname == QLatin1String("QRadioButton")) {
iface = new QAccessibleButton(widget, RadioButton);
iface = new QAccessibleButton(widget, QAccessible::RadioButton);
} else if (classname == QLatin1String("QPushButton")) {
Role role = NoRole;
QAccessible::Role role = QAccessible::NoRole;
QPushButton *pb = qobject_cast<QPushButton*>(widget);
#ifndef QT_NO_MENU
if (pb->menu())
role = ButtonMenu;
role = QAccessible::ButtonMenu;
else
#endif
if (pb->isCheckable())
role = CheckBox;
role = QAccessible::CheckBox;
else
role = PushButton;
role = QAccessible::PushButton;
iface = new QAccessibleButton(widget, role);
} else if (classname == QLatin1String("QAbstractButton")) {
iface = new QAccessibleButton(widget, PushButton);
iface = new QAccessibleButton(widget, QAccessible::PushButton);
} else if (classname == QLatin1String("QDialog")) {
iface = new QAccessibleWidget(widget, Dialog);
iface = new QAccessibleWidget(widget, QAccessible::Dialog);
} else if (classname == QLatin1String("QMessageBox")) {
iface = new QAccessibleWidget(widget, AlertMessage);
iface = new QAccessibleWidget(widget, QAccessible::AlertMessage);
#ifndef QT_NO_MAINWINDOW
} else if (classname == QLatin1String("QMainWindow")) {
iface = new QAccessibleMainWindow(widget);
@ -235,15 +235,15 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
} else if (classname == QLatin1String("QLabel") || classname == QLatin1String("QLCDNumber")) {
iface = new QAccessibleDisplay(widget);
} else if (classname == QLatin1String("QGroupBox")) {
iface = new QAccessibleDisplay(widget, Grouping);
iface = new QAccessibleDisplay(widget, QAccessible::Grouping);
} else if (classname == QLatin1String("QStatusBar")) {
iface = new QAccessibleWidget(widget, StatusBar);
iface = new QAccessibleWidget(widget, QAccessible::StatusBar);
#ifndef QT_NO_PROGRESSBAR
} else if (classname == QLatin1String("QProgressBar")) {
iface = new QAccessibleProgressBar(widget);
#endif
} else if (classname == QLatin1String("QToolBar")) {
iface = new QAccessibleWidget(widget, ToolBar, widget->windowTitle());
iface = new QAccessibleWidget(widget, QAccessible::ToolBar, widget->windowTitle());
#ifndef QT_NO_MENUBAR
} else if (classname == QLatin1String("QMenuBar")) {
iface = new QAccessibleMenuBar(widget);
@ -275,23 +275,23 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
iface = new QAccessibleTabBar(widget);
#endif
} else if (classname == QLatin1String("QWorkspaceChild")) {
iface = new QAccessibleWidget(widget, Window);
iface = new QAccessibleWidget(widget, QAccessible::Window);
} else if (classname == QLatin1String("QSizeGrip")) {
iface = new QAccessibleWidget(widget, Grip);
iface = new QAccessibleWidget(widget, QAccessible::Grip);
#ifndef QT_NO_SPLITTER
} else if (classname == QLatin1String("QSplitter")) {
iface = new QAccessibleWidget(widget, Splitter);
iface = new QAccessibleWidget(widget, QAccessible::Splitter);
} else if (classname == QLatin1String("QSplitterHandle")) {
iface = new QAccessibleWidget(widget, Grip);
iface = new QAccessibleWidget(widget, QAccessible::Grip);
#endif
#ifndef QT_NO_TEXTEDIT
} else if (classname == QLatin1String("QTextEdit")) {
iface = new QAccessibleTextEdit(widget);
#endif
} else if (classname == QLatin1String("QTipLabel")) {
iface = new QAccessibleDisplay(widget, ToolTip);
iface = new QAccessibleDisplay(widget, QAccessible::ToolTip);
} else if (classname == QLatin1String("QFrame")) {
iface = new QAccessibleWidget(widget, Border);
iface = new QAccessibleWidget(widget, QAccessible::Border);
#ifndef QT_NO_STACKEDWIDGET
} else if (classname == QLatin1String("QStackedWidget")) {
iface = new QAccessibleStackedWidget(widget);

View File

@ -79,20 +79,20 @@ int QAccessibleMenu::childAt(int x, int y) const
return menu()->actions().indexOf(act) + 1;
}
QString QAccessibleMenu::text(Text t) const
QString QAccessibleMenu::text(QAccessible::Text t) const
{
QString tx = QAccessibleWidget::text(t);
if (!tx.isEmpty())
return tx;
if (t == Name)
if (t == QAccessible::Name)
return menu()->windowTitle();
return tx;
}
QAccessible::Role QAccessibleMenu::role() const
{
return PopupMenu;
return QAccessible::PopupMenu;
}
QAccessibleInterface *QAccessibleMenu::child(int index) const
@ -111,14 +111,14 @@ QAccessibleInterface *QAccessibleMenu::parent() const
return QAccessibleWidget::parent();
}
int QAccessibleMenu::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
int QAccessibleMenu::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
{
Q_ASSERT(entry >= 0);
switch (relation) {
case Child:
case QAccessible::Child:
*target = child(entry - 1);
return *target ? 0 : -1;
case Ancestor:
case QAccessible::Ancestor:
*target = parent();
return *target ? 0 : -1;
default:
@ -129,8 +129,8 @@ int QAccessibleMenu::navigate(RelationFlag relation, int entry, QAccessibleInter
int QAccessibleMenu::indexOfChild( const QAccessibleInterface *child) const
{
int index = -1;
Role r = child->role();
if ((r == MenuItem || r == Separator) && menu()) {
QAccessible::Role r = child->role();
if ((r == QAccessible::MenuItem || r == QAccessible::Separator) && menu()) {
index = menu()->actions().indexOf(qobject_cast<QAction*>(child->object()));
if (index != -1)
++index;
@ -140,7 +140,7 @@ int QAccessibleMenu::indexOfChild( const QAccessibleInterface *child) const
#ifndef QT_NO_MENUBAR
QAccessibleMenuBar::QAccessibleMenuBar(QWidget *w)
: QAccessibleWidget(w, MenuBar)
: QAccessibleWidget(w, QAccessible::MenuBar)
{
Q_ASSERT(menuBar());
}
@ -162,9 +162,9 @@ QAccessibleInterface *QAccessibleMenuBar::child(int index) const
return 0;
}
int QAccessibleMenuBar::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
int QAccessibleMenuBar::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
{
if (relation == Child) {
if (relation == QAccessible::Child) {
*target = child(entry - 1);
return *target ? 0 : -1;
}
@ -174,8 +174,8 @@ int QAccessibleMenuBar::navigate(RelationFlag relation, int entry, QAccessibleIn
int QAccessibleMenuBar::indexOfChild(const QAccessibleInterface *child) const
{
int index = -1;
Role r = child->role();
if ((r == MenuItem || r == Separator) && menuBar()) {
QAccessible::Role r = child->role();
if ((r == QAccessible::MenuItem || r == QAccessible::Separator) && menuBar()) {
index = menuBar()->actions().indexOf(qobject_cast<QAction*>(child->object()));
if (index != -1)
++index;
@ -214,7 +214,7 @@ int QAccessibleMenuItem::childCount() const
int QAccessibleMenuItem::indexOfChild(const QAccessibleInterface * child) const
{
Q_ASSERT(child == 0);
if (child->role() == PopupMenu && child->object() == m_action->menu())
if (child->role() == QAccessible::PopupMenu && child->object() == m_action->menu())
return 1;
return -1;
@ -237,7 +237,7 @@ QAccessibleInterface *QAccessibleMenuItem::child(int index) const
return 0;
}
int QAccessibleMenuItem::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
int QAccessibleMenuItem::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
{
*target = 0;
if (entry < 0) {
@ -245,26 +245,26 @@ int QAccessibleMenuItem::navigate(RelationFlag relation, int entry, QAccessibleI
}
switch (relation) {
case Child:
case QAccessible::Child:
*target = child(entry - 1);
break;
case Ancestor:
case QAccessible::Ancestor:
*target = parent();
break;
case Up:
case Down:{
case QAccessible::Up:
case QAccessible::Down:{
QAccessibleInterface *parentIface = parent();
if (parentIface) {
int index = parentIface->indexOfChild(this);
if (index != -1) {
index += (relation == Down ? +1 : -1);
index += (relation == QAccessible::Down ? +1 : -1);
*target = parentIface->child(index - 1);
}
}
delete parentIface;
break;
}
case Sibling: {
case QAccessible::Sibling: {
QAccessibleInterface *parentIface = parent();
if (parentIface)
*target = parentIface->child(entry - 1);
@ -312,59 +312,59 @@ QRect QAccessibleMenuItem::rect() const
QAccessible::Relation QAccessibleMenuItem::relationTo(const QAccessibleInterface *other) const
{
if (other->object() == owner()) {
return Child;
return QAccessible::Child;
}
Q_UNUSED(other)
// ###
return Unrelated;
return QAccessible::Unrelated;
}
QAccessible::Role QAccessibleMenuItem::role() const
{
return m_action->isSeparator() ? Separator : MenuItem;
return m_action->isSeparator() ? QAccessible::Separator : QAccessible::MenuItem;
}
void QAccessibleMenuItem::setText ( Text /*t*/, const QString & /*text */)
void QAccessibleMenuItem::setText(QAccessible::Text /*t*/, const QString & /*text */)
{
}
QAccessible::State QAccessibleMenuItem::state() const
{
QAccessible::State s = Normal;
QAccessible::State s = QAccessible::Normal;
QWidget *own = owner();
if (own->testAttribute(Qt::WA_WState_Visible) == false || m_action->isVisible() == false) {
s |= Invisible;
s |= QAccessible::Invisible;
}
if (QMenu *menu = qobject_cast<QMenu*>(own)) {
if (menu->activeAction() == m_action)
s |= Focused;
s |= QAccessible::Focused;
#ifndef QT_NO_MENUBAR
} else if (QMenuBar *menuBar = qobject_cast<QMenuBar*>(own)) {
if (menuBar->activeAction() == m_action)
s |= Focused;
s |= QAccessible::Focused;
#endif
}
if (own->style()->styleHint(QStyle::SH_Menu_MouseTracking))
s |= HotTracked;
s |= QAccessible::HotTracked;
if (m_action->isSeparator() || !m_action->isEnabled())
s |= Unavailable;
s |= QAccessible::Unavailable;
if (m_action->isChecked())
s |= Checked;
s |= QAccessible::Checked;
return s;
}
QString QAccessibleMenuItem::text(Text t) const
QString QAccessibleMenuItem::text(QAccessible::Text t) const
{
QString str;
switch (t) {
case Name:
case QAccessible::Name:
str = m_action->text();
str = qt_accStripAmp(str);
break;
case Accelerator: {
case QAccessible::Accelerator: {
#ifndef QT_NO_SHORTCUT
QKeySequence key = m_action->shortcut();
if (!key.isEmpty()) {

View File

@ -61,11 +61,11 @@ public:
int childCount() const;
int childAt(int x, int y) const;
QString text(Text t) const;
Role role() const;
QString text(QAccessible::Text t) const;
QAccessible::Role role() const;
QAccessibleInterface *child(int index) const;
QAccessibleInterface *parent() const;
int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
int indexOfChild( const QAccessibleInterface *child ) const;
protected:
@ -81,7 +81,7 @@ public:
QAccessibleInterface *child(int index) const;
int childCount() const;
int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
int indexOfChild(const QAccessibleInterface *child) const;
protected:

View File

@ -251,7 +251,7 @@ static int qTextBlockPosition(QTextBlock block)
Constructs a QAccessibleTextEdit object for a \a widget.
*/
QAccessibleTextEdit::QAccessibleTextEdit(QWidget *o)
: QAccessibleWidget(o, EditableText)
: QAccessibleWidget(o, QAccessible::EditableText)
{
Q_ASSERT(widget()->inherits("QTextEdit"));
}
@ -262,17 +262,17 @@ QTextEdit *QAccessibleTextEdit::textEdit() const
return static_cast<QTextEdit *>(widget());
}
QString QAccessibleTextEdit::text(Text t) const
QString QAccessibleTextEdit::text(QAccessible::Text t) const
{
if (t == Value)
if (t == QAccessible::Value)
return textEdit()->toPlainText();
return QAccessibleWidget::text(t);
}
void QAccessibleTextEdit::setText(Text t, const QString &text)
void QAccessibleTextEdit::setText(QAccessible::Text t, const QString &text)
{
if (t != Value) {
if (t != QAccessible::Value) {
QAccessibleWidget::setText(t, text);
return;
}
@ -286,16 +286,16 @@ QVariant QAccessibleTextEdit::invokeMethod(QAccessible::Method method,
const QVariantList &params)
{
switch (method) {
case ListSupportedMethods: {
case QAccessible::ListSupportedMethods: {
QSet<QAccessible::Method> set;
set << ListSupportedMethods << SetCursorPosition << GetCursorPosition;
set << QAccessible::ListSupportedMethods << QAccessible::SetCursorPosition << QAccessible::GetCursorPosition;
return QVariant::fromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
QAccessibleWidget::invokeMethod(method, params)));
}
case SetCursorPosition:
case QAccessible::SetCursorPosition:
setCursorPosition(params.value(0).toInt());
return true;
case GetCursorPosition:
case QAccessible::GetCursorPosition:
return textEdit()->textCursor().position();
default:
return QAccessibleWidget::invokeMethod(method, params);
@ -711,7 +711,7 @@ void QAccessibleTextEdit::setAttributes(int startOffset, int endOffset, const QS
#ifndef QT_NO_STACKEDWIDGET
// ======================= QAccessibleStackedWidget ======================
QAccessibleStackedWidget::QAccessibleStackedWidget(QWidget *widget)
: QAccessibleWidget(widget, LayeredPane)
: QAccessibleWidget(widget, QAccessible::LayeredPane)
{
Q_ASSERT(qobject_cast<QStackedWidget *>(widget));
}
@ -759,10 +759,10 @@ QAccessibleInterface *QAccessibleStackedWidget::child(int index) const
return QAccessible::queryAccessibleInterface(stackedWidget()->widget(index));
}
int QAccessibleStackedWidget::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
int QAccessibleStackedWidget::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
{
switch (relation) {
case Child:
case QAccessible::Child:
*target = child(entry - 1);
return *target ? 0 : -1;
default:
@ -779,7 +779,7 @@ QStackedWidget *QAccessibleStackedWidget::stackedWidget() const
#ifndef QT_NO_TOOLBOX
// ======================= QAccessibleToolBox ======================
QAccessibleToolBox::QAccessibleToolBox(QWidget *widget)
: QAccessibleWidget(widget, LayeredPane)
: QAccessibleWidget(widget, QAccessible::LayeredPane)
{
Q_ASSERT(qobject_cast<QToolBox *>(widget));
}
@ -793,7 +793,7 @@ QToolBox * QAccessibleToolBox::toolBox() const
// ======================= QAccessibleMdiArea ======================
#ifndef QT_NO_MDIAREA
QAccessibleMdiArea::QAccessibleMdiArea(QWidget *widget)
: QAccessibleWidget(widget, LayeredPane)
: QAccessibleWidget(widget, QAccessible::LayeredPane)
{
Q_ASSERT(qobject_cast<QMdiArea *>(widget));
}
@ -815,21 +815,21 @@ int QAccessibleMdiArea::indexOfChild(const QAccessibleInterface *child) const
return -1;
}
int QAccessibleMdiArea::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
int QAccessibleMdiArea::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
{
*target = 0;
QWidget *targetObject = 0;
QList<QMdiSubWindow *> subWindows = mdiArea()->subWindowList();
switch (relation) {
case Child:
case QAccessible::Child:
if (entry < 1 || subWindows.isEmpty() || entry > subWindows.count())
return -1;
targetObject = subWindows.at(entry - 1);
break;
case Up:
case Down:
case Left:
case Right:
case QAccessible::Up:
case QAccessible::Down:
case QAccessible::Left:
case QAccessible::Right:
targetObject = mdiAreaNavigate(mdiArea(), relation, entry);
break;
default:
@ -851,7 +851,7 @@ QAccessibleMdiSubWindow::QAccessibleMdiSubWindow(QWidget *widget)
Q_ASSERT(qobject_cast<QMdiSubWindow *>(widget));
}
QString QAccessibleMdiSubWindow::text(Text textType) const
QString QAccessibleMdiSubWindow::text(QAccessible::Text textType) const
{
if (textType == QAccessible::Name) {
QString title = mdiSubWindow()->windowTitle();
@ -861,7 +861,7 @@ QString QAccessibleMdiSubWindow::text(Text textType) const
return QAccessibleWidget::text(textType);
}
void QAccessibleMdiSubWindow::setText(Text textType, const QString &text)
void QAccessibleMdiSubWindow::setText(QAccessible::Text textType, const QString &text)
{
if (textType == QAccessible::Name)
mdiSubWindow()->setWindowTitle(text);
@ -900,7 +900,7 @@ int QAccessibleMdiSubWindow::indexOfChild(const QAccessibleInterface *child) con
return -1;
}
int QAccessibleMdiSubWindow::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
int QAccessibleMdiSubWindow::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
{
*target = 0;
@ -910,15 +910,15 @@ int QAccessibleMdiSubWindow::navigate(RelationFlag relation, int entry, QAccessi
QWidget *targetObject = 0;
QMdiSubWindow *source = mdiSubWindow();
switch (relation) {
case Child:
case QAccessible::Child:
if (entry != 1 || !source->widget())
return -1;
targetObject = source->widget();
break;
case Up:
case Down:
case Left:
case Right: {
case QAccessible::Up:
case QAccessible::Down:
case QAccessible::Left:
case QAccessible::Right: {
if (entry != 0)
break;
QWidget *parent = source->parentWidget();
@ -981,7 +981,7 @@ QMdiSubWindow *QAccessibleMdiSubWindow::mdiSubWindow() const
// ======================= QAccessibleWorkspace ======================
#ifndef QT_NO_WORKSPACE
QAccessibleWorkspace::QAccessibleWorkspace(QWidget *widget)
: QAccessibleWidget(widget, LayeredPane)
: QAccessibleWidget(widget, QAccessible::LayeredPane)
{
Q_ASSERT(qobject_cast<QWorkspace *>(widget));
}
@ -1003,21 +1003,21 @@ int QAccessibleWorkspace::indexOfChild(const QAccessibleInterface *child) const
return -1;
}
int QAccessibleWorkspace::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
int QAccessibleWorkspace::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
{
*target = 0;
QWidget *targetObject = 0;
QWidgetList subWindows = workspace()->windowList();
switch (relation) {
case Child:
case QAccessible::Child:
if (entry < 1 || subWindows.isEmpty() || entry > subWindows.count())
return -1;
targetObject = subWindows.at(entry - 1);
break;
case Up:
case Down:
case Left:
case Right:
case QAccessible::Up:
case QAccessible::Down:
case QAccessible::Left:
case QAccessible::Right:
targetObject = mdiAreaNavigate(workspace(), relation, entry);
break;
default:
@ -1036,7 +1036,7 @@ QWorkspace *QAccessibleWorkspace::workspace() const
#ifndef QT_NO_DIALOGBUTTONBOX
// ======================= QAccessibleDialogButtonBox ======================
QAccessibleDialogButtonBox::QAccessibleDialogButtonBox(QWidget *widget)
: QAccessibleWidget(widget, Grouping)
: QAccessibleWidget(widget, QAccessible::Grouping)
{
Q_ASSERT(qobject_cast<QDialogButtonBox*>(widget));
}
@ -1063,7 +1063,7 @@ QAccessible::Role QAccessibleTextBrowser::role() const
#ifndef QT_NO_CALENDARWIDGET
// ===================== QAccessibleCalendarWidget ========================
QAccessibleCalendarWidget::QAccessibleCalendarWidget(QWidget *widget)
: QAccessibleWidget(widget, Table)
: QAccessibleWidget(widget, QAccessible::Table)
{
Q_ASSERT(qobject_cast<QCalendarWidget *>(widget));
}
@ -1093,33 +1093,33 @@ QAccessibleInterface *QAccessibleCalendarWidget::child(int index) const
return 0;
if (childCount() > 1 && index == 0)
return queryAccessibleInterface(navigationBar());
return QAccessible::queryAccessibleInterface(navigationBar());
return queryAccessibleInterface(calendarView());
return QAccessible::queryAccessibleInterface(calendarView());
}
int QAccessibleCalendarWidget::navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const
int QAccessibleCalendarWidget::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
{
*target = 0;
if (entry <= 0 || entry > childCount())
return QAccessibleWidget::navigate(relation, entry, target);
QWidget *targetWidget = 0;
switch (relation) {
case Child:
case QAccessible::Child:
*target = child(entry - 1);
return *target ? 0 : -1;
case Up:
case QAccessible::Up:
if (entry == 2)
targetWidget = navigationBar();
break;
case Down:
case QAccessible::Down:
if (entry == 1 && childCount() == 2)
targetWidget = calendarView();
break;
default:
return QAccessibleWidget::navigate(relation, entry, target);
}
*target = queryAccessibleInterface(targetWidget);
*target = QAccessible::queryAccessibleInterface(targetWidget);
return *target ? 0 : -1;
}
@ -1149,7 +1149,7 @@ QWidget *QAccessibleCalendarWidget::navigationBar() const
#ifndef QT_NO_DOCKWIDGET
QAccessibleDockWidget::QAccessibleDockWidget(QWidget *widget)
: QAccessibleWidget(widget, Window)
: QAccessibleWidget(widget, QAccessible::Window)
{
}
@ -1172,7 +1172,7 @@ int QAccessibleDockWidget::childCount() const
int QAccessibleDockWidget::indexOfChild(const QAccessibleInterface *child) const
{
if (child) {
if (child->role() == TitleBar) {
if (child->role() == QAccessible::TitleBar) {
return 1;
} else {
return 2; //###
@ -1183,7 +1183,7 @@ int QAccessibleDockWidget::indexOfChild(const QAccessibleInterface *child) const
QAccessible::Role QAccessibleDockWidget::role() const
{
return Window;
return QAccessible::Window;
}
QRect QAccessibleDockWidget::rect() const
@ -1237,13 +1237,13 @@ QAccessibleInterface *QAccessibleTitleBar::child(int index) const
return 0;
}
int QAccessibleTitleBar::navigate(RelationFlag relation, int entry, QAccessibleInterface **iface) const
int QAccessibleTitleBar::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **iface) const
{
switch (relation) {
case Child:
case QAccessible::Child:
*iface = child(entry - 1);
return *iface ? 0 : -1;
case FocusChild:
case QAccessible::FocusChild:
// ###
if (entry >= 1) {
QDockWidgetLayout *layout = dockWidgetLayout();
@ -1261,7 +1261,7 @@ int QAccessibleTitleBar::navigate(RelationFlag relation, int entry, QAccessibleI
return role > QDockWidgetLayout::FloatButton ? -1 : index;
}
break;
case Ancestor:
case QAccessible::Ancestor:
*iface = parent();
return iface ? 0 : -1;
default:
@ -1273,7 +1273,7 @@ int QAccessibleTitleBar::navigate(RelationFlag relation, int entry, QAccessibleI
QAccessible::Relation QAccessibleTitleBar::relationTo(const QAccessibleInterface * /*otherChild*/) const
{
return Unrelated; //###
return QAccessible::Unrelated; //###
}
int QAccessibleTitleBar::indexOfChild(const QAccessibleInterface * /*child*/) const
@ -1293,9 +1293,9 @@ int QAccessibleTitleBar::childCount() const
return count;
}
QString QAccessibleTitleBar::text(Text t) const
QString QAccessibleTitleBar::text(QAccessible::Text t) const
{
if (t == Name || t == Value) {
if (t == QAccessible::Name || t == QAccessible::Value) {
return qt_accStripAmp(dockWidget()->windowTitle());
}
return QString();
@ -1303,17 +1303,17 @@ QString QAccessibleTitleBar::text(Text t) const
QAccessible::State QAccessibleTitleBar::state() const
{
QAccessible::State state = Normal;
QAccessible::State state = QAccessible::Normal;
QDockWidget *w = dockWidget();
if (w->testAttribute(Qt::WA_WState_Visible) == false)
state |= Invisible;
state |= QAccessible::Invisible;
if (w->focusPolicy() != Qt::NoFocus && w->isActiveWindow())
state |= Focusable;
state |= QAccessible::Focusable;
if (w->hasFocus())
state |= Focused;
state |= QAccessible::Focused;
if (!w->isEnabled())
state |= Unavailable;
state |= QAccessible::Unavailable;
return state;
}
@ -1418,10 +1418,10 @@ QDockWidget *QAccessibleTitleBar::dockWidget() const
QAccessible::Role QAccessibleTitleBar::role() const
{
return TitleBar;
return QAccessible::TitleBar;
}
void QAccessibleTitleBar::setText(Text /*t*/, const QString &/*text*/)
void QAccessibleTitleBar::setText(QAccessible::Text /*t*/, const QString &/*text*/)
{
}
@ -1434,7 +1434,7 @@ bool QAccessibleTitleBar::isValid() const
#ifndef QT_NO_MAINWINDOW
QAccessibleMainWindow::QAccessibleMainWindow(QWidget *widget)
: QAccessibleWidget(widget, Window) { }
: QAccessibleWidget(widget, QAccessible::Window) { }
QVariant QAccessibleMainWindow::invokeMethod(QAccessible::Method /*method*/, int /*child*/, const QVariantList & /*params*/)
{

View File

@ -72,8 +72,8 @@ class QAccessibleTextEdit : public QAccessibleWidget, public QAccessibleTextInte
public:
explicit QAccessibleTextEdit(QWidget *o);
QString text(Text t) const;
void setText(Text t, const QString &text);
QString text(QAccessible::Text t) const;
void setText(QAccessible::Text t, const QString &text);
QVariant invokeMethod(QAccessible::Method method, const QVariantList &params);
void *interface_cast(QAccessible::InterfaceType t);
@ -126,7 +126,7 @@ public:
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
QAccessibleInterface *child(int index) const;
int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
protected:
QStackedWidget *stackedWidget() const;
@ -155,7 +155,7 @@ public:
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
protected:
QMdiArea *mdiArea() const;
@ -166,12 +166,12 @@ class QAccessibleMdiSubWindow : public QAccessibleWidget
public:
explicit QAccessibleMdiSubWindow(QWidget *widget);
QString text(Text textType) const;
void setText(Text textType, const QString &text);
State state() const;
QString text(QAccessible::Text textType) const;
void setText(QAccessible::Text textType, const QString &text);
QAccessible::State state() const;
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
QRect rect() const;
int childAt(int x, int y) const;
@ -188,7 +188,7 @@ public:
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
protected:
QWorkspace *workspace() const;
@ -209,7 +209,7 @@ class QAccessibleTextBrowser : public QAccessibleTextEdit
public:
explicit QAccessibleTextBrowser(QWidget *widget);
Role role() const;
QAccessible::Role role() const;
};
#endif // QT_NO_TEXTBROWSER
@ -221,7 +221,7 @@ public:
int childCount() const;
int indexOfChild(const QAccessibleInterface *child) const;
int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const;
QAccessibleInterface *child(int index) const;
@ -245,7 +245,7 @@ public:
int indexOfChild(const QAccessibleInterface *child) const;
int childCount() const;
QRect rect () const;
Role role() const;
QAccessible::Role role() const;
QDockWidget *dockWidget() const;
};
@ -257,15 +257,15 @@ public:
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
int navigate(RelationFlag relation, int entry, QAccessibleInterface **iface) const;
int navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **iface) const;
int indexOfChild(const QAccessibleInterface *child) const;
int childCount() const;
Relation relationTo(const QAccessibleInterface *other) const;
void setText(Text t, const QString &text);
QString text(Text t) const;
Role role() const;
QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
void setText(QAccessible::Text t, const QString &text);
QString text(QAccessible::Text t) const;
QAccessible::Role role() const;
QRect rect () const;
State state() const;
QAccessible::State state() const;
int childAt(int x, int y) const;
QObject *object() const;
bool isValid() const;

View File

@ -67,7 +67,7 @@ extern QStyleOptionSlider Q_GUI_EXPORT qt_qsliderStyleOption(QSlider *slider);
#ifndef QT_NO_SPINBOX
QAccessibleAbstractSpinBox::QAccessibleAbstractSpinBox(QWidget *w)
: QAccessibleWidget(w, SpinBox)
: QAccessibleWidget(w, QAccessible::SpinBox)
{
Q_ASSERT(abstractSpinBox());
}
@ -80,7 +80,7 @@ QAbstractSpinBox *QAccessibleAbstractSpinBox::abstractSpinBox() const
return qobject_cast<QAbstractSpinBox*>(object());
}
QString QAccessibleAbstractSpinBox::text(Text t) const
QString QAccessibleAbstractSpinBox::text(QAccessible::Text t) const
{
if (t == QAccessible::Value)
return abstractSpinBox()->text();
@ -167,9 +167,9 @@ QDoubleSpinBox *QAccessibleDoubleSpinBox::doubleSpinBox() const
return static_cast<QDoubleSpinBox*>(object());
}
QString QAccessibleDoubleSpinBox::text(Text textType) const
QString QAccessibleDoubleSpinBox::text(QAccessible::Text textType) const
{
if (textType == Value)
if (textType == QAccessible::Value)
return doubleSpinBox()->textFromValue(doubleSpinBox()->value());
return QAccessibleWidget::text(textType);
}
@ -190,7 +190,7 @@ QString QAccessibleDoubleSpinBox::text(Text textType) const
\a name is propagated to the QAccessibleWidget constructor.
*/
QAccessibleScrollBar::QAccessibleScrollBar(QWidget *w)
: QAccessibleAbstractSlider(w, ScrollBar)
: QAccessibleAbstractSlider(w, QAccessible::ScrollBar)
{
Q_ASSERT(scrollBar());
addControllingSignal(QLatin1String("valueChanged(int)"));
@ -202,9 +202,9 @@ QScrollBar *QAccessibleScrollBar::scrollBar() const
return qobject_cast<QScrollBar*>(object());
}
QString QAccessibleScrollBar::text(Text t) const
QString QAccessibleScrollBar::text(QAccessible::Text t) const
{
if (t == Value)
if (t == QAccessible::Value)
return QString::number(scrollBar()->value());
return QAccessibleAbstractSlider::text(t);
}
@ -237,15 +237,15 @@ QSlider *QAccessibleSlider::slider() const
return qobject_cast<QSlider*>(object());
}
QString QAccessibleSlider::text(Text t) const
QString QAccessibleSlider::text(QAccessible::Text t) const
{
if (t == Value)
if (t == QAccessible::Value)
return QString::number(slider()->value());
return QAccessibleAbstractSlider::text(t);
}
QAccessibleAbstractSlider::QAccessibleAbstractSlider(QWidget *w, Role r)
QAccessibleAbstractSlider::QAccessibleAbstractSlider(QWidget *w, QAccessible::Role r)
: QAccessibleWidget(w, r)
{
Q_ASSERT(qobject_cast<QAbstractSlider *>(w));
@ -288,15 +288,15 @@ QAbstractSlider *QAccessibleAbstractSlider::abstractSlider() const
#ifndef QT_NO_DIAL
// ======================================= QAccessibleDial ======================================
QAccessibleDial::QAccessibleDial(QWidget *widget)
: QAccessibleAbstractSlider(widget, Dial)
: QAccessibleAbstractSlider(widget, QAccessible::Dial)
{
Q_ASSERT(qobject_cast<QDial *>(widget));
addControllingSignal(QLatin1String("valueChanged(int)"));
}
QString QAccessibleDial::text(Text textType) const
QString QAccessibleDial::text(QAccessible::Text textType) const
{
if (textType == Value)
if (textType == QAccessible::Value)
return QString::number(dial()->value());
return QAccessibleAbstractSlider::text(textType);

View File

@ -63,7 +63,7 @@ class QAccessibleAbstractSpinBox: public QAccessibleWidget, public QAccessibleVa
public:
explicit QAccessibleAbstractSpinBox(QWidget *w);
QString text(Text t) const;
QString text(QAccessible::Text t) const;
void *interface_cast(QAccessible::InterfaceType t);
// QAccessibleValueInterface
@ -92,7 +92,7 @@ class QAccessibleDoubleSpinBox : public QAccessibleAbstractSpinBox
public:
explicit QAccessibleDoubleSpinBox(QWidget *widget);
QString text(Text t) const;
QString text(QAccessible::Text t) const;
protected:
QDoubleSpinBox *doubleSpinBox() const;
@ -102,7 +102,7 @@ protected:
class QAccessibleAbstractSlider: public QAccessibleWidget, public QAccessibleValueInterface
{
public:
explicit QAccessibleAbstractSlider(QWidget *w, Role r = Slider);
explicit QAccessibleAbstractSlider(QWidget *w, QAccessible::Role r = QAccessible::Slider);
void *interface_cast(QAccessible::InterfaceType t);
// QAccessibleValueInterface
@ -120,7 +120,7 @@ class QAccessibleScrollBar : public QAccessibleAbstractSlider
{
public:
explicit QAccessibleScrollBar(QWidget *w);
QString text(Text t) const;
QString text(QAccessible::Text t) const;
protected:
QScrollBar *scrollBar() const;
@ -132,7 +132,7 @@ class QAccessibleSlider : public QAccessibleAbstractSlider
{
public:
explicit QAccessibleSlider(QWidget *w);
QString text(Text t) const;
QString text(QAccessible::Text t) const;
protected:
QSlider *slider() const;
@ -145,7 +145,7 @@ class QAccessibleDial : public QAccessibleAbstractSlider
public:
explicit QAccessibleDial(QWidget *w);
QString text(Text textType) const;
QString text(QAccessible::Text textType) const;
protected:
QDial *dial() const;

View File

@ -88,7 +88,7 @@ QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::Bounda
Creates a QAccessibleButton object for \a w.
\a role is propagated to the QAccessibleWidget constructor.
*/
QAccessibleButton::QAccessibleButton(QWidget *w, Role role)
QAccessibleButton::QAccessibleButton(QWidget *w, QAccessible::Role role)
: QAccessibleWidget(w, role)
{
Q_ASSERT(button());
@ -105,11 +105,11 @@ QAbstractButton *QAccessibleButton::button() const
}
/*! \reimp */
QString QAccessibleButton::text(Text t) const
QString QAccessibleButton::text(QAccessible::Text t) const
{
QString str;
switch (t) {
case Accelerator:
case QAccessible::Accelerator:
{
#ifndef QT_NO_SHORTCUT
QPushButton *pb = qobject_cast<QPushButton*>(object());
@ -120,7 +120,7 @@ QString QAccessibleButton::text(Text t) const
str = qt_accHotKey(button()->text());
}
break;
case Name:
case QAccessible::Name:
str = widget()->accessibleName();
if (str.isEmpty())
str = button()->text();
@ -135,23 +135,23 @@ QString QAccessibleButton::text(Text t) const
QAccessible::State QAccessibleButton::state() const
{
State state = QAccessibleWidget::state();
QAccessible::State state = QAccessibleWidget::state();
QAbstractButton *b = button();
QCheckBox *cb = qobject_cast<QCheckBox *>(b);
if (b->isChecked())
state |= Checked;
state |= QAccessible::Checked;
else if (cb && cb->checkState() == Qt::PartiallyChecked)
state |= Mixed;
state |= QAccessible::Mixed;
if (b->isDown())
state |= Pressed;
state |= QAccessible::Pressed;
QPushButton *pb = qobject_cast<QPushButton*>(b);
if (pb) {
if (pb->isDefault())
state |= DefaultButton;
state |= QAccessible::DefaultButton;
#ifndef QT_NO_MENU
if (pb->menu())
state |= HasPopup;
state |= QAccessible::HasPopup;
#endif
}
@ -163,15 +163,15 @@ QStringList QAccessibleButton::actionNames() const
QStringList names;
if (widget()->isEnabled()) {
switch (role()) {
case ButtonMenu:
case QAccessible::ButtonMenu:
names << showMenuAction();
break;
case RadioButton:
case QAccessible::RadioButton:
names << checkAction();
break;
default:
if (button()->isCheckable()) {
if (state() & Checked) {
if (state() & QAccessible::Checked) {
names << uncheckAction();
} else {
// FIXME
@ -235,7 +235,7 @@ QStringList QAccessibleButton::keyBindingsForAction(const QString &actionName) c
Creates a QAccessibleToolButton object for \a w.
\a role is propagated to the QAccessibleWidget constructor.
*/
QAccessibleToolButton::QAccessibleToolButton(QWidget *w, Role role)
QAccessibleToolButton::QAccessibleToolButton(QWidget *w, QAccessible::Role role)
: QAccessibleButton(w, role)
{
Q_ASSERT(toolButton());
@ -263,10 +263,10 @@ QAccessible::State QAccessibleToolButton::state() const
{
QAccessible::State st = QAccessibleButton::state();
if (toolButton()->autoRaise())
st |= HotTracked;
st |= QAccessible::HotTracked;
#ifndef QT_NO_MENU
if (toolButton()->menu())
st |= HasPopup;
st |= QAccessible::HasPopup;
#endif
return st;
}
@ -281,7 +281,7 @@ QAccessibleInterface *QAccessibleToolButton::child(int index) const
#ifndef QT_NO_MENU
if (index == 0 && toolButton()->menu())
{
return queryAccessibleInterface(toolButton()->menu());
return QAccessible::queryAccessibleInterface(toolButton()->menu());
}
#endif
return 0;
@ -293,11 +293,11 @@ QAccessibleInterface *QAccessibleToolButton::child(int index) const
Returns the button's text label, depending on the text \a t, and
the \a child.
*/
QString QAccessibleToolButton::text(Text t) const
QString QAccessibleToolButton::text(QAccessible::Text t) const
{
QString str;
switch (t) {
case Name:
case QAccessible::Name:
str = toolButton()->accessibleName();
if (str.isEmpty())
str = toolButton()->text();
@ -362,7 +362,7 @@ void QAccessibleToolButton::doAction(const QString &actionName)
Constructs a QAccessibleDisplay object for \a w.
\a role is propagated to the QAccessibleWidget constructor.
*/
QAccessibleDisplay::QAccessibleDisplay(QWidget *w, Role role)
QAccessibleDisplay::QAccessibleDisplay(QWidget *w, QAccessible::Role role)
: QAccessibleWidget(w, role)
{
}
@ -372,28 +372,28 @@ QAccessible::Role QAccessibleDisplay::role() const
QLabel *l = qobject_cast<QLabel*>(object());
if (l) {
if (l->pixmap())
return Graphic;
return QAccessible::Graphic;
#ifndef QT_NO_PICTURE
if (l->picture())
return Graphic;
return QAccessible::Graphic;
#endif
#ifndef QT_NO_MOVIE
if (l->movie())
return Animation;
return QAccessible::Animation;
#endif
#ifndef QT_NO_PROGRESSBAR
} else if (qobject_cast<QProgressBar*>(object())) {
return ProgressBar;
return QAccessible::ProgressBar;
#endif
}
return QAccessibleWidget::role();
}
QString QAccessibleDisplay::text(Text t) const
QString QAccessibleDisplay::text(QAccessible::Text t) const
{
QString str;
switch (t) {
case Name:
case QAccessible::Name:
str = widget()->accessibleName();
if (str.isEmpty()) {
if (qobject_cast<QLabel*>(object())) {
@ -413,7 +413,7 @@ QString QAccessibleDisplay::text(Text t) const
}
}
break;
case Value:
case QAccessible::Value:
#ifndef QT_NO_PROGRESSBAR
if (qobject_cast<QProgressBar*>(object()))
str = QString::number(qobject_cast<QProgressBar*>(object())->value());
@ -429,30 +429,30 @@ QString QAccessibleDisplay::text(Text t) const
QAccessible::Relation QAccessibleDisplay::relationTo(const QAccessibleInterface *other) const
{
Relation relation = QAccessibleWidget::relationTo(other);
QAccessible::Relation relation = QAccessibleWidget::relationTo(other);
QObject *o = other->object();
QLabel *label = qobject_cast<QLabel*>(object());
if (label) {
#ifndef QT_NO_SHORTCUT
if (o == label->buddy())
relation |= Label;
relation |= QAccessible::Label;
#endif
#ifndef QT_NO_GROUPBOX
} else {
QGroupBox *groupbox = qobject_cast<QGroupBox*>(object());
if (groupbox && !groupbox->title().isEmpty())
if (groupbox->children().contains(o))
relation |= Label;
relation |= QAccessible::Label;
#endif
}
return relation;
}
int QAccessibleDisplay::navigate(RelationFlag rel, int entry, QAccessibleInterface **target) const
int QAccessibleDisplay::navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const
{
*target = 0;
if (rel == Labelled) {
if (rel == QAccessible::Labelled) {
QObject *targetObject = 0;
QLabel *label = qobject_cast<QLabel*>(object());
if (label) {
@ -464,7 +464,7 @@ int QAccessibleDisplay::navigate(RelationFlag rel, int entry, QAccessibleInterfa
} else {
QGroupBox *groupbox = qobject_cast<QGroupBox*>(object());
if (groupbox && !groupbox->title().isEmpty())
rel = Child;
rel = QAccessible::Child;
#endif
}
*target = QAccessible::queryAccessibleInterface(targetObject);
@ -537,7 +537,7 @@ QRect QAccessibleDisplay::imagePosition(QAccessible2::CoordinateType coordType)
\a name is propagated to the QAccessibleWidget constructor.
*/
QAccessibleLineEdit::QAccessibleLineEdit(QWidget *w, const QString &name)
: QAccessibleWidget(w, EditableText, name), QAccessibleSimpleEditableTextInterface(this)
: QAccessibleWidget(w, QAccessible::EditableText, name), QAccessibleSimpleEditableTextInterface(this)
{
addControllingSignal(QLatin1String("textChanged(const QString&)"));
addControllingSignal(QLatin1String("returnPressed()"));
@ -549,11 +549,11 @@ QLineEdit *QAccessibleLineEdit::lineEdit() const
return qobject_cast<QLineEdit*>(object());
}
QString QAccessibleLineEdit::text(Text t) const
QString QAccessibleLineEdit::text(QAccessible::Text t) const
{
QString str;
switch (t) {
case Value:
case QAccessible::Value:
if (lineEdit()->echoMode() == QLineEdit::Normal)
str = lineEdit()->text();
break;
@ -565,9 +565,9 @@ QString QAccessibleLineEdit::text(Text t) const
return qt_accStripAmp(str);
}
void QAccessibleLineEdit::setText(Text t, const QString &text)
void QAccessibleLineEdit::setText(QAccessible::Text t, const QString &text)
{
if (t != Value) {
if (t != QAccessible::Value) {
QAccessibleWidget::setText(t, text);
return;
}
@ -583,20 +583,20 @@ void QAccessibleLineEdit::setText(Text t, const QString &text)
QAccessible::State QAccessibleLineEdit::state() const
{
State state = QAccessibleWidget::state();
QAccessible::State state = QAccessibleWidget::state();
QLineEdit *l = lineEdit();
if (l->isReadOnly())
state |= ReadOnly;
state |= QAccessible::ReadOnly;
if (l->echoMode() != QLineEdit::Normal)
state |= Protected;
state |= Selectable;
state |= QAccessible::Protected;
state |= QAccessible::Selectable;
if (l->hasSelectedText())
state |= Selected;
state |= QAccessible::Selected;
if (l->contextMenuPolicy() != Qt::NoContextMenu
&& l->contextMenuPolicy() != Qt::PreventContextMenu)
state |= HasPopup;
state |= QAccessible::HasPopup;
return state;
}
@ -605,16 +605,16 @@ QVariant QAccessibleLineEdit::invokeMethod(QAccessible::Method method,
const QVariantList &params)
{
switch (method) {
case ListSupportedMethods: {
case QAccessible::ListSupportedMethods: {
QSet<QAccessible::Method> set;
set << ListSupportedMethods << SetCursorPosition << GetCursorPosition;
set << QAccessible::ListSupportedMethods << QAccessible::SetCursorPosition << QAccessible::GetCursorPosition;
return QVariant::fromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
QAccessibleWidget::invokeMethod(method, params)));
}
case SetCursorPosition:
case QAccessible::SetCursorPosition:
setCursorPosition(params.value(0).toInt());
return true;
case GetCursorPosition:
case QAccessible::GetCursorPosition:
return cursorPosition();
default:
return QAccessibleWidget::invokeMethod(method, params);

View File

@ -59,10 +59,10 @@ class QAccessibleButton : public QAccessibleWidget
{
Q_DECLARE_TR_FUNCTIONS(QAccessibleButton)
public:
QAccessibleButton(QWidget *w, Role r);
QAccessibleButton(QWidget *w, QAccessible::Role r);
QString text(Text t) const;
State state() const;
QString text(QAccessible::Text t) const;
QAccessible::State state() const;
QStringList actionNames() const;
void doAction(const QString &actionName);
@ -76,14 +76,14 @@ protected:
class QAccessibleToolButton : public QAccessibleButton
{
public:
QAccessibleToolButton(QWidget *w, Role role);
QAccessibleToolButton(QWidget *w, QAccessible::Role role);
State state() const;
QAccessible::State state() const;
int childCount() const;
QAccessibleInterface *child(int index) const;
QString text(Text t) const;
QString text(QAccessible::Text t) const;
// QAccessibleActionInterface
QStringList actionNames() const;
@ -99,13 +99,13 @@ protected:
class QAccessibleDisplay : public QAccessibleWidget, public QAccessibleImageInterface
{
public:
explicit QAccessibleDisplay(QWidget *w, Role role = StaticText);
explicit QAccessibleDisplay(QWidget *w, QAccessible::Role role = QAccessible::StaticText);
QString text(Text t) const;
Role role() const;
QString text(QAccessible::Text t) const;
QAccessible::Role role() const;
Relation relationTo(const QAccessibleInterface *other) const;
int navigate(RelationFlag, int entry, QAccessibleInterface **target) const;
QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
int navigate(QAccessible::RelationFlag, int entry, QAccessibleInterface **target) const;
void *interface_cast(QAccessible::InterfaceType t);
// QAccessibleImageInterface
@ -121,9 +121,9 @@ class QAccessibleLineEdit : public QAccessibleWidget, public QAccessibleTextInte
public:
explicit QAccessibleLineEdit(QWidget *o, const QString &name = QString());
QString text(Text t) const;
void setText(Text t, const QString &text);
State state() const;
QString text(QAccessible::Text t) const;
void setText(QAccessible::Text t, const QString &text);
QAccessible::State state() const;
QVariant invokeMethod(QAccessible::Method method, const QVariantList &params);
void *interface_cast(QAccessible::InterfaceType t);

View File

@ -52,6 +52,10 @@ QT_BEGIN_NAMESPACE
QTouchEventSenderQPA::QTouchEventSenderQPA(const QString &spec)
{
m_forceToActiveWindow = spec.split(QLatin1Char(':')).contains(QLatin1String("force_window"));
m_device = new QTouchDevice;
m_device->setType(QTouchDevice::TouchScreen);
m_device->setCapabilities(QTouchDevice::Position | QTouchDevice::Area);
QWindowSystemInterface::registerTouchDevice(m_device);
}
void QTouchEventSenderQPA::touch_configure(int x_min, int x_max, int y_min, int y_max)
@ -103,7 +107,7 @@ void QTouchEventSenderQPA::touch_point(QEvent::Type state,
#endif
}
QWindowSystemInterface::handleTouchEvent(0, state, QTouchEvent::TouchScreen, touchPoints);
QWindowSystemInterface::handleTouchEvent(0, state, m_device, touchPoints);
}
QT_END_NAMESPACE

View File

@ -48,6 +48,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QTouchDevice;
class QTouchEventSenderQPA : public QTouchScreenObserver
{
public:
@ -61,6 +63,7 @@ private:
int hw_range_x_max;
int hw_range_y_min;
int hw_range_y_max;
QTouchDevice *m_device;
};
QT_END_NAMESPACE

View File

@ -55,7 +55,7 @@ public:
explicit QCocoaCursor(QPlatformScreen *);
virtual void changeCursor(QCursor * widgetCursor, QWindow * widget);
virtual QPoint pos();
virtual QPoint pos() const;
virtual void setPos(const QPoint &position);
private:
QHash<Qt::CursorShape, NSCursor *> m_cursors;

View File

@ -113,7 +113,7 @@ void QCocoaCursor::changeCursor(QCursor *cursor, QWindow *window)
}
}
QPoint QCocoaCursor::pos()
QPoint QCocoaCursor::pos() const
{
return qt_mac_flipPoint([NSEvent mouseLocation]).toPoint();
}

View File

@ -93,7 +93,6 @@ private:
QPlatformFontDatabase *mFontDb;
QAbstractEventDispatcher *mEventDispatcher;
QCocoaAutoReleasePool *mPool;
QPlatformAccessibility *mAccessibility;
QPlatformTheme *mPlatformTheme;
};

View File

@ -90,8 +90,6 @@ QCocoaIntegration::QCocoaIntegration()
: mFontDb(new QCoreTextFontDatabase())
, mEventDispatcher(new QCocoaEventDispatcher())
{
mPool = new QCocoaAutoReleasePool;
qApp->setAttribute(Qt::AA_DontUseNativeMenuBar, false);
NSApplication *cocoaApplication = [NSApplication sharedApplication];
@ -141,7 +139,6 @@ QCocoaIntegration::QCocoaIntegration()
QCocoaIntegration::~QCocoaIntegration()
{
delete mAccessibility;
delete mPool;
}
bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const

View File

@ -54,6 +54,8 @@
#include <accessibilityinspector.h>
#endif
static QTouchDevice *touchDevice = 0;
@interface NSEvent (Qt_Compile_Leopard_DeviceDelta)
- (CGFloat)deviceDeltaX;
- (CGFloat)deviceDeltaY;
@ -69,6 +71,12 @@
m_cgImage = 0;
m_window = 0;
m_buttons = Qt::NoButton;
if (!touchDevice) {
touchDevice = new QTouchDevice;
touchDevice->setType(QTouchDevice::TouchPad);
touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::NormalizedPosition);
QWindowSystemInterface::registerTouchDevice(touchDevice);
}
}
return self;
}
@ -287,28 +295,28 @@
{
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchBegin, QTouchEvent::TouchPad, points);
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchBegin, touchDevice, points);
}
- (void)touchesMovedWithEvent:(NSEvent *)event
{
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchUpdate, QTouchEvent::TouchPad, points);
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchUpdate, touchDevice, points);
}
- (void)touchesEndedWithEvent:(NSEvent *)event
{
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchEnd, QTouchEvent::TouchPad, points);
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchEnd, touchDevice, points);
}
- (void)touchesCancelledWithEvent:(NSEvent *)event
{
const NSTimeInterval timestamp = [event timestamp];
const QList<QWindowSystemInterface::TouchPoint> points = QCocoaTouch::getCurrentTouchPointList(event, /*acceptSingleTouch= ### true or false?*/false);
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchEnd, QTouchEvent::TouchPad, points);
QWindowSystemInterface::handleTouchEvent(m_window, timestamp * 1000, QEvent::TouchEnd, touchDevice, points);
}
#ifndef QT_NO_WHEELEVENT

View File

@ -48,6 +48,7 @@
#include <QtGui/QScreen>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <EGL/egl.h>
@ -158,6 +159,20 @@ QDirectFbWindowEGL::~QDirectFbWindowEGL()
}
}
EGLSurface QDirectFbWindowEGL::eglSurface()
{
if (m_eglSurface == EGL_NO_SURFACE) {
QDirectFbScreenEGL *dfbScreen = static_cast<QDirectFbScreenEGL *>(screen());
EGLConfig config = q_configFromGLFormat(dfbScreen->eglDisplay(), format(), true);
m_eglSurface = eglCreateWindowSurface(dfbScreen->eglDisplay(), config, dfbSurface(), NULL);
if (m_eglSurface == EGL_NO_SURFACE)
eglGetError();
}
return m_eglSurface;
}
QSurfaceFormat QDirectFbWindowEGL::format() const
{
return window()->requestedFormat();

View File

@ -43,6 +43,7 @@
#define QDIRECTFBSCREEN_H
#include "qdirectfbconvenience.h"
#include "qdirectfbcursor.h"
#include <QtGui/QPlatformIntegration>
@ -50,7 +51,6 @@
QT_BEGIN_NAMESPACE
class QDirectFBCursor;
class QDirectFbScreen : public QPlatformScreen
{

View File

@ -124,7 +124,8 @@ static inline void compressMouseMove(MSG *msg)
*/
QWindowsMouseHandler::QWindowsMouseHandler() :
m_windowUnderMouse(0)
m_windowUnderMouse(0),
m_touchDevice(0)
{
}
@ -277,10 +278,17 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
if ((allStates & Qt::TouchPointStateMask) == Qt::TouchPointReleased)
m_touchInputIDToTouchPointID.clear();
if (!m_touchDevice) {
m_touchDevice = new QTouchDevice;
m_touchDevice->setType(QTouchDevice::TouchScreen);
m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::NormalizedPosition);
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
}
// TODO: Device used to be hardcoded to screen in previous code.
// What is the correct event type? Which parts of translateRawTouchEvent() are required?
QWindowSystemInterface::handleTouchEvent(window, QEvent::TouchBegin,
QTouchEvent::TouchScreen,
m_touchDevice,
touchPoints);
return true;
}

View File

@ -51,6 +51,7 @@
QT_BEGIN_NAMESPACE
class QWindow;
class QTouchDevice;
class QWindowsMouseHandler
{
@ -76,6 +77,7 @@ private:
QPointer<QWindow> m_windowUnderMouse;
QHash<DWORD, int> m_touchInputIDToTouchPointID;
QTouchDevice *m_touchDevice;
};
Qt::MouseButtons QWindowsMouseHandler::keyStateToMouseButtons(int wParam)

View File

@ -65,12 +65,20 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat
, m_screen(screen)
, m_context(0)
{
GLXContext shareGlxContext = 0;
m_shareContext = 0;
if (share)
shareGlxContext = static_cast<const QGLXContext*>(share)->glxContext();
m_shareContext = static_cast<const QGLXContext*>(share)->glxContext();
GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen),screen->screenNumber(),format);
m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, shareGlxContext, TRUE);
m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, m_shareContext, TRUE);
if (!m_context && m_shareContext) {
// re-try without a shared glx context
m_shareContext = 0;
m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, 0, TRUE);
}
if (m_context)
m_format = qglx_surfaceFormatFromGLXFBConfig(DISPLAY_FROM_XCB(screen), config, m_context);
}
@ -137,4 +145,14 @@ QSurfaceFormat QGLXContext::format() const
return m_format;
}
bool QGLXContext::isSharing() const
{
return m_shareContext != 0;
}
bool QGLXContext::isValid() const
{
return m_context != 0;
}
QT_END_NAMESPACE

View File

@ -66,12 +66,15 @@ public:
void (*getProcAddress(const QByteArray &procName)) ();
QSurfaceFormat format() const;
bool isSharing() const;
bool isValid() const;
GLXContext glxContext() const { return m_context; }
private:
QXcbScreen *m_screen;
GLXContext m_context;
GLXContext m_shareContext;
QSurfaceFormat m_format;
};

View File

@ -86,6 +86,11 @@ extern "C" {
QT_BEGIN_NAMESPACE
static int nullErrorHandler(Display *, XErrorEvent *)
{
return 0;
}
QXcbConnection::QXcbConnection(const char *displayName)
: m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY"))
#ifdef XCB_USE_XINPUT2_MAEMO
@ -106,6 +111,7 @@ QXcbConnection::QXcbConnection(const char *displayName)
m_primaryScreen = DefaultScreen(dpy);
m_connection = XGetXCBConnection(dpy);
XSetEventQueueOwner(dpy, XCBOwnsEventQueue);
XSetErrorHandler(nullErrorHandler);
m_xlib_display = dpy;
#ifdef XCB_USE_EGL
EGLDisplay eglDisplay = eglGetDisplay(dpy);
@ -1002,7 +1008,6 @@ void QXcbConnection::initializeXFixes()
xfixes_first_event = 0;
}
free(xfixes_query);
}
void QXcbConnection::initializeXRender()

View File

@ -62,6 +62,7 @@ struct XInput2Data {
, xideviceinfo(0)
, xibuttonclassinfo(0)
, xiMaxContacts(0)
, qtTouchDevice(0)
{
}
// true if Qt is compiled w/ XInput2 or Tablet support and we have a tablet.
@ -74,6 +75,7 @@ struct XInput2Data {
XIButtonClassInfo *xibuttonclassinfo;
int xiMaxContacts;
QList<QWindowSystemInterface::TouchPoint> allTouchPoints;
QTouchDevice *qtTouchDevice;
};
bool QXcbConnection::isUsingXInput2()
@ -277,8 +279,17 @@ void QXcbConnection::handleGenericEvent(xcb_ge_event_t *event)
if (!(active & (1 << i)) && touchPoints.at(i).state != Qt::TouchPointReleased)
touchPoints[i].state = Qt::TouchPointReleased;
if (QXcbWindow *platformWindow = platformWindowFromId(xideviceevent->event))
QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xideviceevent->time, (QEvent::Type)0 /*None*/, QTouchEvent::TouchScreen, touchPoints);
if (QXcbWindow *platformWindow = platformWindowFromId(xideviceevent->event)) {
QTouchDevice *dev = m_xinputData->qtTouchDevice;
if (!dev) {
dev = new QTouchDevice;
dev->setType(QTouchDevice::TouchScreen);
dev->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure | QTouchDevice::NormalizedPosition);
QWindowSystemInterface::registerTouchDevice(dev);
m_xinputData->qtTouchDevice = dev;
}
QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xideviceevent->time, (QEvent::Type)0 /*None*/, dev, touchPoints);
}
if (xideviceevent->evtype == XI_ButtonRelease) {
// final event, forget touch state

View File

@ -239,6 +239,9 @@
#define XF86XK_TopMenu 0x1008FFA2
#define XF86XK_Suspend 0x1008FFA7
#define XF86XK_Hibernate 0x1008FFA8
#define XF86XK_TouchpadToggle 0x1008FFA9
#define XF86XK_TouchpadOn 0x1008FFB0
#define XF86XK_TouchpadOff 0x1008FFB1
// end of XF86keysyms.h
@ -549,6 +552,9 @@ static const unsigned int KeyTbl[] = {
XF86XK_Bluetooth, Qt::Key_Bluetooth,
XF86XK_Suspend, Qt::Key_Suspend,
XF86XK_Hibernate, Qt::Key_Hibernate,
XF86XK_TouchpadToggle, Qt::Key_TouchpadToggle,
XF86XK_TouchpadOn, Qt::Key_TouchpadOn,
XF86XK_TouchpadOff, Qt::Key_TouchpadOff,
XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly
XF86XK_Launch1, Qt::Key_Launch3,
XF86XK_Launch2, Qt::Key_Launch4,

View File

@ -236,6 +236,9 @@
#define XF86XK_TopMenu 0x1008FFA2
#define XF86XK_Suspend 0x1008FFA7
#define XF86XK_Hibernate 0x1008FFA8
#define XF86XK_TouchpadToggle 0x1008FFA9
#define XF86XK_TouchpadOn 0x1008FFB0
#define XF86XK_TouchpadOff 0x1008FFB1
// end of XF86keysyms.h
@ -544,6 +547,9 @@ static const unsigned int KeyTbl[] = {
XF86XK_Bluetooth, Qt::Key_Bluetooth,
XF86XK_Suspend, Qt::Key_Suspend,
XF86XK_Hibernate, Qt::Key_Hibernate,
XF86XK_TouchpadToggle, Qt::Key_TouchpadToggle,
XF86XK_TouchpadOn, Qt::Key_TouchpadOn,
XF86XK_TouchpadOff, Qt::Key_TouchpadOff,
XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly
XF86XK_Launch1, Qt::Key_Launch3,
XF86XK_Launch2, Qt::Key_Launch4,

View File

@ -1652,6 +1652,8 @@ QRect QPrinter::paperRect() const
This function sets the \a left, \a top, \a right and \a bottom
page margins for this printer. The unit of the margins are
specified with the \a unit parameter.
\sa getPageMargins
*/
void QPrinter::setPageMargins(qreal left, qreal top, qreal right, qreal bottom, QPrinter::Unit unit)
{
@ -1683,6 +1685,8 @@ void QPrinter::setMargins(const Margins &m)
Returns the page margins for this printer in \a left, \a top, \a
right, \a bottom. The unit of the returned margins are specified
with the \a unit parameter.
\sa setPageMargins
*/
void QPrinter::getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, QPrinter::Unit unit) const
{

View File

@ -65,6 +65,7 @@ src_platformsupport.target = sub-platformsupport
src_declarative.depends += src_opengl
src_webkit.depends += src_opengl
}
src_v8.depends += src_tools_mkv8snapshot
}

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