Merge branch 'master' into refactor

Conflicts:
	src/gui/kernel/qapplication_qpa.cpp
	src/gui/kernel/qcursor_qpa.cpp
	src/gui/kernel/qwindowsysteminterface_qpa.cpp
	src/gui/kernel/qwindowsysteminterface_qpa.h
	src/gui/kernel/qwindowsysteminterface_qpa_p.h
	src/gui/text/qtextcontrol.cpp
	src/plugins/platforms/wayland/wayland.pro
	src/widgets/accessible/qaccessible2.h
	src/widgets/widgets/qwidgetlinecontrol_p.h

Change-Id: I5e6f4eb184159dccc67e8f13673edb884d179c74
This commit is contained in:
Gunnar Sletta 2011-08-25 10:11:49 +02:00
commit 04d0a9626c
176 changed files with 5594 additions and 6879 deletions

44
.gitignore vendored
View File

@ -269,3 +269,47 @@ src/xml/lib/
*.dep *.dep
*.map *.map
work work
#generated module def and version header files
mkspecs/modules/qt_*.pri
mkspecs/qmodule.pri
src/uitools/qtuitoolsversion.h
tools/uilib/qtdesignerversion.h
#unit tests executables
selftests/assert/assert
selftests/badxml/badxml
selftests/benchlibcallgrind/benchlibcallgrind
selftests/benchlibeventcounter/benchlibeventcounter
selftests/benchliboptions/benchliboptions
selftests/benchlibtickcounter/benchlibtickcounter
selftests/benchlibwalltime/benchlibwalltime
selftests/cmptest/cmptest
selftests/commandlinedata/commandlinedata
selftests/crashes/crashes
selftests/datatable/datatable
selftests/datetime/datetime
selftests/differentexec/differentexec
selftests/exceptionthrow/exceptionthrow
selftests/expectfail/expectfail
selftests/failinit/failinit
selftests/failinitdata/failinitdata
selftests/fetchbogus/fetchbogus
selftests/globaldata/globaldata
selftests/longstring/longstring
selftests/maxwarnings/maxwarnings
selftests/multiexec/multiexec
selftests/qexecstringlist/qexecstringlist
selftests/singleskip/singleskip
selftests/skip/skip
selftests/skipglobal/skipglobal
selftests/skipinit/skipinit
selftests/skipinitdata/skipinitdata
selftests/sleep/sleep
selftests/strcmp/strcmp
selftests/subtest/subtest
selftests/waitwithoutgui/waitwithoutgui
selftests/warnings/warnings
selftests/xunit/xunit

View File

@ -262,7 +262,7 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) {
$| = 1; $| = 1;
# Now run the configuration tests # Now run the configuration tests
print "Configuration tests:\n"; print "Configuration tests:\n" if (%configtests);
while ((my $testName, my $testParameters) = each %configtests) { while ((my $testName, my $testParameters) = each %configtests) {
printf " % *s: ", $maxNameLength, $testName; # right aligned, yes/no lines up printf " % *s: ", $maxNameLength, $testName; # right aligned, yes/no lines up

View File

@ -777,8 +777,8 @@ die "Cannot automatically detect/use provided path to QtBase's build directory!\
# if we have no $basedir we cannot be sure which sources you want, so die # if we have no $basedir we cannot be sure which sources you want, so die
die "Could not find any sync.profile for your module!\nPass <module directory> to syncqt to sync your header files.\nsyncqt failed" if (!$basedir); die "Could not find any sync.profile for your module!\nPass <module directory> to syncqt to sync your header files.\nsyncqt failed" if (!$basedir);
my @ignore_headers = ();
my $class_lib_map_contents = ""; my $class_lib_map_contents = "";
our @ignore_headers = ();
our @ignore_for_master_contents = (); our @ignore_for_master_contents = ();
our @ignore_for_include_check = (); our @ignore_for_include_check = ();
our @ignore_for_qt_begin_header_check = (); our @ignore_for_qt_begin_header_check = ();
@ -900,7 +900,7 @@ foreach my $lib (@modules_to_sync) {
# FIXME: this creates a file in the source location for shadow-builds # FIXME: this creates a file in the source location for shadow-builds
my $moduleversionheader = "$modules{$lib}/" . lc($lib) . "version.h"; my $moduleversionheader = "$modules{$lib}/" . lc($lib) . "version.h";
my $modulehexstring = sprintf("0x%02X%02X%02X", int($module_major_version), int($module_minor_version), int($module_patch_version)); my $modulehexstring = sprintf("0x%02X%02X%02X", int($module_major_version), int($module_minor_version), int($module_patch_version));
open MODULE_VERSION_HEADER_FILE, ">$moduleversionheader"; open MODULE_VERSION_HEADER_FILE, ">$moduleversionheader" or die "Can't open $moduleversionheader for writing";
print MODULE_VERSION_HEADER_FILE "/* This file was generated by syncqt with the info from sync.profile. */\n"; print MODULE_VERSION_HEADER_FILE "/* This file was generated by syncqt with the info from sync.profile. */\n";
print MODULE_VERSION_HEADER_FILE "#ifndef QT_". uc($lib) . "_VERSION_H\n"; print MODULE_VERSION_HEADER_FILE "#ifndef QT_". uc($lib) . "_VERSION_H\n";
print MODULE_VERSION_HEADER_FILE "#define QT_". uc($lib) . "_VERSION_H\n"; print MODULE_VERSION_HEADER_FILE "#define QT_". uc($lib) . "_VERSION_H\n";

38
configure vendored
View File

@ -2508,23 +2508,6 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "ye
echo echo
fi fi
# detect build style
if [ "$CFG_DEBUG" = "auto" ]; then
if [ "$PLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
CFG_DEBUG_RELEASE=yes
CFG_DEBUG=yes
elif [ "$CFG_DEV" = "yes" ]; then
CFG_DEBUG_RELEASE=no
CFG_DEBUG=yes
else
CFG_DEBUG_RELEASE=no
CFG_DEBUG=no
fi
fi
if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG build_all"
fi
if [ "$CFG_SILENT" = "yes" ]; then if [ "$CFG_SILENT" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG silent" QMAKE_CONFIG="$QMAKE_CONFIG silent"
fi fi
@ -3241,6 +3224,23 @@ fi
# tests that don't need qmake (must be run before displaying help) # tests that don't need qmake (must be run before displaying help)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# detect build style
if [ "$CFG_DEBUG" = "auto" ]; then
if [ "$CFG_ARCH" = "macosx" -o "$XPLATFORM_MINGW" = "yes" ]; then
CFG_DEBUG_RELEASE=yes
CFG_DEBUG=yes
elif [ "$CFG_DEV" = "yes" ]; then
CFG_DEBUG_RELEASE=no
CFG_DEBUG=yes
else
CFG_DEBUG_RELEASE=no
CFG_DEBUG=no
fi
fi
if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG build_all"
fi
if [ -z "$PKG_CONFIG" ]; then if [ -z "$PKG_CONFIG" ]; then
# See if PKG_CONFIG is set in the mkspec: # See if PKG_CONFIG is set in the mkspec:
PKG_CONFIG=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%PKG_CONFIG[^_].*=%%p' | tr '\n' ' '` PKG_CONFIG=`getQMakeConf "$XQMAKESPEC" | sed -n -e 's%PKG_CONFIG[^_].*=%%p' | tr '\n' ' '`
@ -7068,10 +7068,10 @@ fi
if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
QMakeVar add QMAKE_CFLAGS -g QMakeVar add QMAKE_CFLAGS -g
QMakeVar add QMAKE_CXXFLAGS -g QMakeVar add QMAKE_CXXFLAGS -g
QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info" QT_CONFIG="$QT_CONFIG separate_debug_info"
fi fi
if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info_nocopy" QT_CONFIG="$QT_CONFIG separate_debug_info_nocopy"
fi fi
[ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx" [ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
[ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow" [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"

11
dist/changes-4.8.0 vendored
View File

@ -72,6 +72,17 @@ QtGui
like UltraLight. [QTBUG-19366] like UltraLight. [QTBUG-19366]
- Visual text cursor movement behavior is added to QTextEdit and QLineEdit controls, - Visual text cursor movement behavior is added to QTextEdit and QLineEdit controls,
which can be used as an optional mode for bi-directional text editing. [QTBUG-13859] which can be used as an optional mode for bi-directional text editing. [QTBUG-13859]
- Accessibility: Fix potential crash in QDockWidget.
- Accessibility: Fix crash when asking for relations of child accessibles.
- Accessibility: More consistency in reporting names (especially when widget is invisible).
- Accessibility: Make focus handling more consistent.
- Accessibility: Send updates when text changes.
- Accessibility: Add IAccessible2 events.
- Accessibility: Fix crash when accessing ItemViews during initialization.
- Accessibility: Make QTabWidget child hierarchy consistent.
- Accessibility: Report correct window title and application name.
- Accessibility: Return text attributes for QTextEdit.
QtNetwork QtNetwork
--------- ---------

4
dist/changes-5.0.0 vendored
View File

@ -20,6 +20,10 @@ information about a particular change.
- QLibrary::resolve() now returns a function pointer instead of a void - QLibrary::resolve() now returns a function pointer instead of a void
pointer. pointer.
- QSslCertificate::alternateSubjectNames() is deprecated (but can be enabled
via QT_DISABLE_DEPRECATED_BEFORE), use
QSslCertificate::subjectAlternativeNames() instead.
**************************************************************************** ****************************************************************************
* General * * General *
**************************************************************************** ****************************************************************************

View File

@ -434,6 +434,21 @@ hostNameLabel->setText(tr("Name:"));
QString example = tr("Example"); QString example = tr("Example");
//! [40] //! [40]
//! [41]
QPushButton *button = parentWidget->findChild<QPushButton *>("button1", Qt::FindDirectChildOnly);
//! [41]
//! [42]
QListWidget *list = parentWidget->findChild<QListWidget *>(QString(), Qt::FindDirectChildOnly);
//! [42]
//! [43]
QList<QPushButton *> childButtons = parentWidget.findChildren<QPushButton *>(QString(), Qt::FindDirectChildOnly);
//! [43]
//! [meta data] //! [meta data]
//: This is a comment for the translator. //: This is a comment for the translator.
//= qtn_foo_bar //= qtn_foo_bar

View File

@ -48,8 +48,10 @@
#include <QQuaternion> #include <QQuaternion>
#include <QVector2D> #include <QVector2D>
QT_BEGIN_NAMESPACE
class QBasicTimer; class QBasicTimer;
class QGLShaderProgram; class QGLShaderProgram;
QT_END_NAMESPACE
class GeometryEngine; class GeometryEngine;

View File

@ -46,7 +46,9 @@
#include "ui_landscape.h" #include "ui_landscape.h"
#include "ui_portrait.h" #include "ui_portrait.h"
QT_BEGIN_NAMESPACE
class QAbstractButton; class QAbstractButton;
QT_END_NAMESPACE
//! [0] //! [0]
class MainWindow : public QWidget class MainWindow : public QWidget

View File

@ -99,10 +99,16 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
# Let every project have a standard GNU `check' target # Let every project have a standard GNU `check' target
!contains(QMAKE_EXTRA_TARGETS, check) { !contains(QMAKE_EXTRA_TARGETS, check) {
# `make check' should iterate through all subdirs # `make check' should iterate through all subdirs
# (except those with no_default_target)
contains(TEMPLATE, subdirs) { contains(TEMPLATE, subdirs) {
check.CONFIG = recursive check.CONFIG = recursive
check.recurse = $$SUBDIRS
check.recurse_target = check check.recurse_target = check
for(subdir, SUBDIRS) {
subdir_config=$$eval($${subdir}.CONFIG)
!contains(subdir_config, no_default_target):check.recurse += $$subdir
unset(subdir_config)
}
} }
# `make check' should imply building the project # `make check' should imply building the project
else { else {

View File

@ -59,6 +59,8 @@ linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions
contains(QT_CONFIG, largefile):CONFIG += largefile contains(QT_CONFIG, largefile):CONFIG += largefile
contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info
contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy
#mac frameworks #mac frameworks
mac:!static:contains(QT_CONFIG, qt_framework) { mac:!static:contains(QT_CONFIG, qt_framework) {

View File

@ -9,6 +9,8 @@ CONFIG += qt plugin
win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
TARGET = $$qtLibraryTarget($$TARGET) TARGET = $$qtLibraryTarget($$TARGET)
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info
contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy
load(qt_targets) load(qt_targets)

View File

@ -152,6 +152,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
asm volatile("0:\n" asm volatile("0:\n"
"ldrex %[result], [%[_q_value]]\n" "ldrex %[result], [%[_q_value]]\n"
"eors %[result], %[result], %[expectedValue]\n" "eors %[result], %[result], %[expectedValue]\n"
"itt eq\n"
"strexeq %[result], %[newValue], [%[_q_value]]\n" "strexeq %[result], %[newValue], [%[_q_value]]\n"
"teqeq %[result], #1\n" "teqeq %[result], #1\n"
"beq 0b\n" "beq 0b\n"
@ -210,6 +211,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu
asm volatile("0:\n" asm volatile("0:\n"
"ldrex %[result], [%[_q_value]]\n" "ldrex %[result], [%[_q_value]]\n"
"eors %[result], %[result], %[expectedValue]\n" "eors %[result], %[result], %[expectedValue]\n"
"itt eq\n"
"strexeq %[result], %[newValue], [%[_q_value]]\n" "strexeq %[result], %[newValue], [%[_q_value]]\n"
"teqeq %[result], #1\n" "teqeq %[result], #1\n"
"beq 0b\n" "beq 0b\n"

View File

@ -1288,7 +1288,11 @@ public:
AnchorBottom AnchorBottom
}; };
enum FindChildOption {
FindDirectChildrenOnly = 0x0,
FindChildrenRecursively = 0x1
};
Q_DECLARE_FLAGS(FindChildOptions, FindChildOption)
enum DropAction { enum DropAction {
CopyAction = 0x1, CopyAction = 0x1,

View File

@ -2110,6 +2110,13 @@
\sa QWidget::windowFlags, {Window Flags Example} \sa QWidget::windowFlags, {Window Flags Example}
*/ */
/*!
\enum Qt::FindChildOption
\value FindDirectChildrenOnly Looks only at the direct children of the object.
\value FindChildrenRecursively Looks at all children of the object (recursive search).
*/
/*! /*!
\enum Qt::DropAction \enum Qt::DropAction

View File

@ -366,7 +366,7 @@ QFileInfo::~QFileInfo()
} }
/*! /*!
\fn bool QFileInfo::operator!=(const QFileInfo &fileinfo) \fn bool QFileInfo::operator!=(const QFileInfo &fileinfo) const
Returns true if this QFileInfo object refers to a different file Returns true if this QFileInfo object refers to a different file
than the one specified by \a fileinfo; otherwise returns false. than the one specified by \a fileinfo; otherwise returns false.
@ -380,7 +380,19 @@ QFileInfo::~QFileInfo()
*/ */
/*! /*!
\overload Returns true if this QFileInfo object refers to a file in the same
location as \a fileinfo; otherwise returns false.
Note that the result of comparing two empty QFileInfo objects,
containing no file references, is undefined.
\warning This will not compare two different symbolic links
pointing to the same file.
\warning Long and short file names that refer to the same file on Windows
are treated as if they referred to different files.
\sa operator!=()
*/ */
bool QFileInfo::operator==(const QFileInfo &fileinfo) const bool QFileInfo::operator==(const QFileInfo &fileinfo) const
{ {
@ -409,26 +421,6 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const
return canonicalFilePath().compare(fileinfo.canonicalFilePath(), sensitive) == 0; return canonicalFilePath().compare(fileinfo.canonicalFilePath(), sensitive) == 0;
} }
/*!
Returns true if this QFileInfo object refers to a file in the same
location as \a fileinfo; otherwise returns false.
Note that the result of comparing two empty QFileInfo objects,
containing no file references, is undefined.
\warning This will not compare two different symbolic links
pointing to the same file.
\warning Long and short file names that refer to the same file on Windows
are treated as if they referred to different files.
\sa operator!=()
*/
bool QFileInfo::operator==(const QFileInfo &fileinfo)
{
return const_cast<const QFileInfo *>(this)->operator==(fileinfo);
}
/*! /*!
Makes a copy of the given \a fileinfo and assigns it to this QFileInfo. Makes a copy of the given \a fileinfo and assigns it to this QFileInfo.
*/ */

View File

@ -75,9 +75,7 @@ public:
inline QFileInfo&operator=(QFileInfo &&other) inline QFileInfo&operator=(QFileInfo &&other)
{ qSwap(d_ptr, other.d_ptr); return *this; } { qSwap(d_ptr, other.d_ptr); return *this; }
#endif #endif
bool operator==(const QFileInfo &fileinfo); // 5.0 - remove me
bool operator==(const QFileInfo &fileinfo) const; bool operator==(const QFileInfo &fileinfo) const;
inline bool operator!=(const QFileInfo &fileinfo) { return !(operator==(fileinfo)); } // 5.0 - remove me
inline bool operator!=(const QFileInfo &fileinfo) const { return !(operator==(fileinfo)); } inline bool operator!=(const QFileInfo &fileinfo) const { return !(operator==(fileinfo)); }
void setFile(const QString &file); void setFile(const QString &file);

View File

@ -1029,8 +1029,8 @@ QObjectPrivate::Connection::~Connection()
\brief the name of this object \brief the name of this object
You can find an object by name (and type) using findChild(). You can You can find an object by name (and type) using findChild().
find a set of objects with findChildren(). You can find a set of objects with findChildren().
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 5 \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 5
@ -1546,12 +1546,13 @@ void QObject::killTimer(int id)
/*! /*!
\fn T *QObject::findChild(const QString &name) const \fn T *QObject::findChild(const QString &name, Qt::FindChildOptions options) const
Returns the child of this object that can be cast into type T and Returns the child of this object that can be cast into type T and
that is called \a name, or 0 if there is no such object. that is called \a name, or 0 if there is no such object.
Omitting the \a name argument causes all object names to be matched. Omitting the \a name argument causes all object names to be matched.
The search is performed recursively. The search is performed recursively, unless \a options specifies the
option FindDirectChildrenOnly.
If there is more than one child matching the search, the most If there is more than one child matching the search, the most
direct ancestor is returned. If there are several direct direct ancestor is returned. If there are several direct
@ -1559,7 +1560,8 @@ void QObject::killTimer(int id)
case, findChildren() should be used. case, findChildren() should be used.
This example returns a child \l{QPushButton} of \c{parentWidget} This example returns a child \l{QPushButton} of \c{parentWidget}
named \c{"button1"}: named \c{"button1"}, even if the button isn't a direct child of
the parent:
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 10 \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 10
@ -1567,16 +1569,27 @@ void QObject::killTimer(int id)
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 11 \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 11
This example returns a child \l{QPushButton} of \c{parentWidget}
(its direct parent) named \c{"button1"}:
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 41
This example returns a \l{QListWidget} child of \c{parentWidget},
its direct parent:
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 42
\sa findChildren() \sa findChildren()
*/ */
/*! /*!
\fn QList<T> QObject::findChildren(const QString &name) const \fn QList<T> QObject::findChildren(const QString &name, Qt::FindChildOptions options) const
Returns all children of this object with the given \a name that can be Returns all children of this object with the given \a name that can be
cast to type T, or an empty list if there are no such objects. cast to type T, or an empty list if there are no such objects.
Omitting the \a name argument causes all object names to be matched. Omitting the \a name argument causes all object names to be matched.
The search is performed recursively. The search is performed recursively, unless \a options specifies the
option FindDirectChildrenOnly.
The following example shows how to find a list of child \l{QWidget}s of The following example shows how to find a list of child \l{QWidget}s of
the specified \c{parentWidget} named \c{widgetname}: the specified \c{parentWidget} named \c{widgetname}:
@ -1587,11 +1600,15 @@ void QObject::killTimer(int id)
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 13 \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 13
This example returns all \c{QPushButton}s that are immediate children of \c{parentWidget}:
\snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 43
\sa findChild() \sa findChild()
*/ */
/*! /*!
\fn QList<T> QObject::findChildren(const QRegExp &regExp) const \fn QList<T> QObject::findChildren(const QRegExp &regExp, Qt::FindChildOptions options) const
\overload findChildren() \overload findChildren()
Returns the children of this object that can be cast to type T Returns the children of this object that can be cast to type T
@ -1651,7 +1668,7 @@ void QObject::killTimer(int id)
\internal \internal
*/ */
void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re, void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re,
const QMetaObject &mo, QList<void*> *list) const QMetaObject &mo, QList<void*> *list, Qt::FindChildOptions options)
{ {
if (!parent || !list) if (!parent || !list)
return; return;
@ -1668,13 +1685,14 @@ void qt_qFindChildren_helper(const QObject *parent, const QString &name, const Q
list->append(obj); list->append(obj);
} }
} }
qt_qFindChildren_helper(obj, name, re, mo, list); if (options & Qt::FindChildrenRecursively)
qt_qFindChildren_helper(obj, name, re, mo, list, options);
} }
} }
/*! \internal /*! \internal
*/ */
QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo) QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options)
{ {
if (!parent) if (!parent)
return 0; return 0;
@ -1686,11 +1704,13 @@ QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const
if (mo.cast(obj) && (name.isNull() || obj->objectName() == name)) if (mo.cast(obj) && (name.isNull() || obj->objectName() == name))
return obj; return obj;
} }
if (options & Qt::FindChildrenRecursively) {
for (i = 0; i < children.size(); ++i) { for (i = 0; i < children.size(); ++i) {
obj = qt_qFindChild_helper(children.at(i), name, mo); obj = qt_qFindChild_helper(children.at(i), name, mo, options);
if (obj) if (obj)
return obj; return obj;
} }
}
return 0; return 0;
} }

View File

@ -78,8 +78,8 @@ class QObjectUserData;
typedef QList<QObject*> QObjectList; typedef QList<QObject*> QObjectList;
Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re, Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re,
const QMetaObject &mo, QList<void *> *list); const QMetaObject &mo, QList<void *> *list, Qt::FindChildOptions options);
Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo); Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options);
class class
#if defined(__INTEL_COMPILER) && defined(Q_OS_WIN) #if defined(__INTEL_COMPILER) && defined(Q_OS_WIN)
@ -157,11 +157,11 @@ public:
void killTimer(int id); void killTimer(int id);
template<typename T> template<typename T>
inline T findChild(const QString &aName = QString()) const inline T findChild(const QString &aName = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
{ return static_cast<T>(qt_qFindChild_helper(this, aName, reinterpret_cast<T>(0)->staticMetaObject)); } { return static_cast<T>(qt_qFindChild_helper(this, aName, reinterpret_cast<T>(0)->staticMetaObject, options)); }
template<typename T> template<typename T>
inline QList<T> findChildren(const QString &aName = QString()) const inline QList<T> findChildren(const QString &aName = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
{ {
QList<T> list; QList<T> list;
union { union {
@ -169,13 +169,13 @@ public:
QList<void *> *voidList; QList<void *> *voidList;
} u; } u;
u.typedList = &list; u.typedList = &list;
qt_qFindChildren_helper(this, aName, 0, reinterpret_cast<T>(0)->staticMetaObject, u.voidList); qt_qFindChildren_helper(this, aName, 0, reinterpret_cast<T>(0)->staticMetaObject, u.voidList, options);
return list; return list;
} }
#ifndef QT_NO_REGEXP #ifndef QT_NO_REGEXP
template<typename T> template<typename T>
inline QList<T> findChildren(const QRegExp &re) const inline QList<T> findChildren(const QRegExp &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
{ {
QList<T> list; QList<T> list;
union { union {
@ -183,7 +183,7 @@ public:
QList<void *> *voidList; QList<void *> *voidList;
} u; } u;
u.typedList = &list; u.typedList = &list;
qt_qFindChildren_helper(this, QString(), &re, reinterpret_cast<T>(0)->staticMetaObject, u.voidList); qt_qFindChildren_helper(this, QString(), &re, reinterpret_cast<T>(0)->staticMetaObject, u.voidList, options);
return list; return list;
} }
#endif #endif

View File

@ -101,6 +101,10 @@ public:
// default argument causes thread to block indefinately // default argument causes thread to block indefinately
bool wait(unsigned long time = ULONG_MAX); bool wait(unsigned long time = ULONG_MAX);
static void sleep(unsigned long);
static void msleep(unsigned long);
static void usleep(unsigned long);
Q_SIGNALS: Q_SIGNALS:
void started(); void started();
void finished(); void finished();
@ -112,10 +116,6 @@ protected:
static void setTerminationEnabled(bool enabled = true); static void setTerminationEnabled(bool enabled = true);
static void sleep(unsigned long);
static void msleep(unsigned long);
static void usleep(unsigned long);
protected: protected:
QThread(QThreadPrivate &dd, QObject *parent = 0); QThread(QThreadPrivate &dd, QObject *parent = 0);

View File

@ -352,8 +352,8 @@ public:
// ### Qt 5: not sure this is necessary anymore // ### Qt 5: not sure this is necessary anymore
#ifdef QT_STRICT_ITERATORS #ifdef QT_STRICT_ITERATORS
private: private:
inline bool operator==(const iterator &o) { return operator==(const_iterator(o)); } inline bool operator==(const iterator &o) const { return operator==(const_iterator(o)); }
inline bool operator!=(const iterator &o) { return operator!=(const_iterator(o)); } inline bool operator!=(const iterator &o) const { return operator!=(const_iterator(o)); }
#endif #endif
private: private:

View File

@ -52,7 +52,8 @@ PUB_HEADERS = qdbusargument.h \
qdbusmetatype.h \ qdbusmetatype.h \
qdbuspendingcall.h \ qdbuspendingcall.h \
qdbuspendingreply.h \ qdbuspendingreply.h \
qdbuscontext.h qdbuscontext.h \
qdbusvirtualobject.h
HEADERS += $$PUB_HEADERS \ HEADERS += $$PUB_HEADERS \
qdbusconnection_p.h \ qdbusconnection_p.h \
qdbusmessage_p.h \ qdbusmessage_p.h \
@ -95,4 +96,5 @@ SOURCES += qdbusconnection.cpp \
qdbuspendingreply.cpp \ qdbuspendingreply.cpp \
qdbus_symbols.cpp \ qdbus_symbols.cpp \
qdbusservicewatcher.cpp \ qdbusservicewatcher.cpp \
qdbusunixfiledescriptor.cpp qdbusunixfiledescriptor.cpp \
qdbusvirtualobject.cpp

View File

@ -221,6 +221,18 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP
\sa registerObject(), QDBusAbstractAdaptor, {usingadaptors.html}{Using adaptors} \sa registerObject(), QDBusAbstractAdaptor, {usingadaptors.html}{Using adaptors}
*/ */
/*!
\internal
\since 4.8
\enum QDBusConnection::VirtualObjectRegisterOption
Specifies the options for registering virtual objects with the connection. The possible values are:
\value SingleNode register a virtual object to handle one path only
\value SubPath register a virtual object so that it handles all sub paths
\sa registerVirtualObject(), QDBusVirtualObject
*/
/*! /*!
\enum QDBusConnection::UnregisterMode \enum QDBusConnection::UnregisterMode
The mode for unregistering an object path: The mode for unregistering an object path:
@ -801,9 +813,21 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
// this node exists // this node exists
// consider it free if there's no object here and the user is not trying to // consider it free if there's no object here and the user is not trying to
// replace the object sub-tree // replace the object sub-tree
if ((options & ExportChildObjects && !node->children.isEmpty()) || node->obj) if (node->obj)
return false; return false;
if (options & QDBusConnectionPrivate::VirtualObject) {
// technically the check for children needs to go even deeper
if (options & SubPath) {
foreach (const QDBusConnectionPrivate::ObjectTreeNode &child, node->children) {
if (child.obj)
return false;
}
}
} else {
if ((options & ExportChildObjects && !node->children.isEmpty()))
return false;
}
// we can add the object here // we can add the object here
node->obj = object; node->obj = object;
node->flags = options; node->flags = options;
@ -813,6 +837,13 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
return true; return true;
} }
// if a virtual object occupies this path, return false
if (node->obj && (node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath)) {
qDebug("Cannot register object at %s because QDBusVirtualObject handles all sub-paths.",
qPrintable(path));
return false;
}
// find the position where we'd insert the node // find the position where we'd insert the node
QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it =
qLowerBound(node->children.begin(), node->children.end(), pathComponents.at(i)); qLowerBound(node->children.begin(), node->children.end(), pathComponents.at(i));
@ -840,6 +871,21 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
return false; return false;
} }
/*!
\internal
\since 4.8
Registers a QDBusTreeNode for a path. It can handle a path including all child paths, thus
handling multiple DBus nodes.
To unregister a QDBusTreeNode use the unregisterObject() function with its path.
*/
bool QDBusConnection::registerVirtualObject(const QString &path, QDBusVirtualObject *treeNode,
VirtualObjectRegisterOption options)
{
int opts = options | QDBusConnectionPrivate::VirtualObject;
return registerObject(path, (QObject*) treeNode, (RegisterOptions) opts);
}
/*! /*!
Unregisters an object that was registered with the registerObject() at the object path given by Unregisters an object that was registered with the registerObject() at the object path given by
\a path and, if \a mode is QDBusConnection::UnregisterTree, all of its sub-objects too. \a path and, if \a mode is QDBusConnection::UnregisterTree, all of its sub-objects too.
@ -905,6 +951,8 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
while (node) { while (node) {
if (pathComponents.count() == i) if (pathComponents.count() == i)
return node->obj; return node->obj;
if ((node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath))
return node->obj;
QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it =
qLowerBound(node->children.constBegin(), node->children.constEnd(), pathComponents.at(i)); qLowerBound(node->children.constBegin(), node->children.constEnd(), pathComponents.at(i));
@ -917,6 +965,8 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
return 0; return 0;
} }
/*! /*!
Returns a QDBusConnectionInterface object that represents the Returns a QDBusConnectionInterface object that represents the
D-Bus server interface on this connection. D-Bus server interface on this connection.

View File

@ -69,6 +69,7 @@ class QDBusError;
class QDBusMessage; class QDBusMessage;
class QDBusPendingCall; class QDBusPendingCall;
class QDBusConnectionInterface; class QDBusConnectionInterface;
class QDBusVirtualObject;
class QObject; class QObject;
class QDBusConnectionPrivate; class QDBusConnectionPrivate;
@ -104,8 +105,8 @@ public:
// Qt 4.2 had a misspelling here // Qt 4.2 had a misspelling here
ExportAllSignal = ExportAllSignals, ExportAllSignal = ExportAllSignals,
#endif #endif
ExportChildObjects = 0x1000 ExportChildObjects = 0x1000
// Reserved = 0xff000000
}; };
enum UnregisterMode { enum UnregisterMode {
UnregisterNode, UnregisterNode,
@ -113,6 +114,15 @@ public:
}; };
Q_DECLARE_FLAGS(RegisterOptions, RegisterOption) Q_DECLARE_FLAGS(RegisterOptions, RegisterOption)
enum VirtualObjectRegisterOption {
SingleNode = 0x0,
SubPath = 0x1
// Reserved = 0xff000000
};
#ifndef Q_QDOC
Q_DECLARE_FLAGS(VirtualObjectRegisterOptions, VirtualObjectRegisterOption)
#endif
enum ConnectionCapability { enum ConnectionCapability {
UnixFileDescriptorPassing = 0x0001 UnixFileDescriptorPassing = 0x0001
}; };
@ -163,6 +173,9 @@ public:
void unregisterObject(const QString &path, UnregisterMode mode = UnregisterNode); void unregisterObject(const QString &path, UnregisterMode mode = UnregisterNode);
QObject *objectRegisteredAt(const QString &path) const; QObject *objectRegisteredAt(const QString &path) const;
bool registerVirtualObject(const QString &path, QDBusVirtualObject *object,
VirtualObjectRegisterOption options = SingleNode);
bool registerService(const QString &serviceName); bool registerService(const QString &serviceName);
bool unregisterService(const QString &serviceName); bool unregisterService(const QString &serviceName);
@ -192,6 +205,7 @@ private:
}; };
Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::RegisterOptions) Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::RegisterOptions)
Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::VirtualObjectRegisterOptions)
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -129,6 +129,11 @@ public:
QByteArray matchRule; QByteArray matchRule;
}; };
enum TreeNodeType {
Object = 0x0,
VirtualObject = 0x01000000
};
struct ObjectTreeNode struct ObjectTreeNode
{ {
typedef QVector<ObjectTreeNode> DataList; typedef QVector<ObjectTreeNode> DataList;
@ -143,8 +148,12 @@ public:
{ return QStringRef(&name) < other; } { return QStringRef(&name) < other; }
QString name; QString name;
QObject* obj; union {
QObject *obj;
QDBusVirtualObject *treeNode;
};
int flags; int flags;
DataList children; DataList children;
}; };
@ -333,7 +342,7 @@ extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name);
extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo); extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
// in qdbusinternalfilters.cpp // in qdbusinternalfilters.cpp
extern QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node); extern QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path);
extern QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node, extern QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg); const QDBusMessage &msg);
extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node, extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node,

View File

@ -57,6 +57,7 @@
#include "qdbusabstractadaptor.h" #include "qdbusabstractadaptor.h"
#include "qdbusabstractadaptor_p.h" #include "qdbusabstractadaptor_p.h"
#include "qdbusutil_p.h" #include "qdbusutil_p.h"
#include "qdbusvirtualobject.h"
#include "qdbusmessage_p.h" #include "qdbusmessage_p.h"
#include "qdbuscontext_p.h" #include "qdbuscontext_p.h"
#include "qdbuspendingcall_p.h" #include "qdbuspendingcall_p.h"
@ -442,7 +443,11 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root,
// walk the object tree // walk the object tree
const QDBusConnectionPrivate::ObjectTreeNode *node = root; const QDBusConnectionPrivate::ObjectTreeNode *node = root;
while (start < length && node && !(node->flags & QDBusConnection::ExportChildObjects)) { while (start < length && node) {
if (node->flags & QDBusConnection::ExportChildObjects)
break;
if ((node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath))
break;
int end = fullpath.indexOf(QLatin1Char('/'), start); int end = fullpath.indexOf(QLatin1Char('/'), start);
end = (end == -1 ? length : end); end = (end == -1 ? length : end);
QStringRef pathComponent(&fullpath, start, end - start); QStringRef pathComponent(&fullpath, start, end - start);
@ -1328,7 +1333,7 @@ bool QDBusConnectionPrivate::activateInternalFilters(const ObjectTreeNode &node,
if (interface.isEmpty() || interface == QLatin1String(DBUS_INTERFACE_INTROSPECTABLE)) { if (interface.isEmpty() || interface == QLatin1String(DBUS_INTERFACE_INTROSPECTABLE)) {
if (msg.member() == QLatin1String("Introspect") && msg.signature().isEmpty()) { if (msg.member() == QLatin1String("Introspect") && msg.signature().isEmpty()) {
//qDebug() << "QDBusConnectionPrivate::activateInternalFilters introspect" << msg.d_ptr->msg; //qDebug() << "QDBusConnectionPrivate::activateInternalFilters introspect" << msg.d_ptr->msg;
QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node)); QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node, msg.path()));
send(reply); send(reply);
return true; return true;
} }
@ -1375,6 +1380,15 @@ void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMes
// object may be null // object may be null
if (node.flags & QDBusConnectionPrivate::VirtualObject) {
if (node.treeNode->handleMessage(msg, q(this))) {
return;
} else {
if (activateInternalFilters(node, msg))
return;
}
}
if (pathStartPos != msg.path().length()) { if (pathStartPos != msg.path().length()) {
node.flags &= ~QDBusConnection::ExportAllSignals; node.flags &= ~QDBusConnection::ExportAllSignals;
node.obj = findChildObject(&node, msg.path(), pathStartPos); node.obj = findChildObject(&node, msg.path(), pathStartPos);

View File

@ -56,6 +56,7 @@
#include "qdbusmetatype_p.h" #include "qdbusmetatype_p.h"
#include "qdbusmessage_p.h" #include "qdbusmessage_p.h"
#include "qdbusutil_p.h" #include "qdbusutil_p.h"
#include "qdbusvirtualobject.h"
#ifndef QT_NO_DBUS #ifndef QT_NO_DBUS
@ -108,7 +109,7 @@ static QString generateSubObjectXml(QObject *object)
// declared as extern in qdbusconnection_p.h // declared as extern in qdbusconnection_p.h
QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node) QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path)
{ {
// object may be null // object may be null
@ -155,6 +156,11 @@ QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node
} }
} }
// is it a virtual node that handles introspection itself?
if (node.flags & QDBusConnectionPrivate::VirtualObject) {
xml_data += node.treeNode->introspect(path);
}
xml_data += QLatin1String( propertiesInterfaceXml ); xml_data += QLatin1String( propertiesInterfaceXml );
} }

View File

@ -0,0 +1,97 @@
/****************************************************************************
**
** 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 QtDBus 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 "qdbusvirtualobject.h"
#ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE
QDBusVirtualObject::QDBusVirtualObject(QObject *parent) :
QObject(parent)
{
}
QDBusVirtualObject::~QDBusVirtualObject()
{
}
QT_END_NAMESPACE
/*!
\internal
\class QDBusVirtualObject
\inmodule QtDBus
\since 4.8
\brief The QDBusVirtualObject class is used to handle several DBus paths with one class.
*/
/*!
\internal
\fn bool QDBusVirtualObject::handleMessage(const QDBusMessage &message, const QDBusConnection &connection) = 0
This function needs to handle all messages to the path of the
virtual object, when the SubPath option is specified.
The service, path, interface and methos are all part of the message.
Must return true when the message is handled, otherwise false (will generate dbus error message).
*/
/*!
\internal
\fn QString QDBusVirtualObject::introspect(const QString &path) const
This function needs to handle the introspection of the
virtual object. It must return xml of the form:
\code
<interface name="com.trolltech.QtDBus.MyObject" >
<property access="readwrite" type="i" name="prop1" />
</interface>
\endcode
If you pass the SubPath option, this introspection has to include all child nodes.
Otherwise QDBus handles the introspection of the child nodes.
*/
#endif // QT_NO_DBUS

View File

@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com) ** Contact: Nokia Corporation (qt-info@nokia.com)
** **
** This file is part of the QtXml module of the Qt Toolkit. ** This file is part of the QtDBus module of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:LGPL$ ** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage ** GNU Lesser General Public License Usage
@ -39,35 +39,43 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef OLD_QXMLSTREAM_H #ifndef QDBUSTREENODE_H
#define OLD_QXMLSTREAM_H #define QDBUSTREENODE_H
#include <QtCore/qxmlstream.h> #include <QtDBus/qdbusmacros.h>
#include <QtCore/qstring.h>
#include <QtCore/qobject.h>
#ifndef QT_NO_DBUS
QT_BEGIN_HEADER QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QT_MODULE(Xml) QT_MODULE(DBus)
#if 0 class QDBusMessage;
// make syncqt generate forwarding headers for this file too class QDBusConnection;
#pragma qt_class(QXmlStreamAttribute)
#pragma qt_class(QXmlStreamAttributes) class QDBusVirtualObjectPrivate;
#pragma qt_class(QXmlStreamEntityDeclaration) class Q_DBUS_EXPORT QDBusVirtualObject : public QObject
#pragma qt_class(QXmlStreamEntityDeclarations) {
#pragma qt_class(QXmlStreamEntityResolver) Q_OBJECT
#pragma qt_class(QXmlStreamNamespaceDeclaration) public:
#pragma qt_class(QXmlStreamNamespaceDeclarations) explicit QDBusVirtualObject(QObject *parent = 0);
#pragma qt_class(QXmlStreamNotationDeclaration) virtual ~QDBusVirtualObject();
#pragma qt_class(QXmlStreamNotationDeclarations)
#pragma qt_class(QXmlStreamReader) virtual QString introspect(const QString &path) const = 0;
#pragma qt_class(QXmlStreamStringRef) virtual bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) = 0;
#pragma qt_class(QXmlStreamWriter)
#endif private:
Q_DECLARE_PRIVATE(QDBusVirtualObject)
Q_DISABLE_COPY(QDBusVirtualObject)
};
QT_END_NAMESPACE QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER
#endif // OLD_QXMLSTREAM_H #endif // QT_NO_DBUS
#endif

View File

@ -108,19 +108,11 @@ void QCursorData::update()
#endif //QT_NO_CURSOR #endif //QT_NO_CURSOR
extern int qt_last_x; extern qreal qt_last_x,qt_last_y;
extern int qt_last_y;
QPoint QCursor::pos() QPoint QCursor::pos()
{ {
QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances(); return QPointF(qt_last_x, qt_last_y).toPoint();
int cursorCount = cursors.count();
for (int i = 0; i < cursorCount; ++i) {
const QWeakPointer<QPlatformCursor> &cursor(cursors.at(i));
if (cursor)
return cursor.data()->pos();
}
return QPoint(qt_last_x, qt_last_y);
} }
void QCursor::setPos(int x, int y) void QCursor::setPos(int x, int y)

View File

@ -91,8 +91,8 @@ bool QGuiApplicationPrivate::app_do_modal = false;
QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
int qt_last_x = 0; qreal qt_last_x = 0;
int qt_last_y = 0; qreal qt_last_y = 0;
Qt::MouseButtons QGuiApplicationPrivate::buttons = Qt::NoButton; Qt::MouseButtons QGuiApplicationPrivate::buttons = Qt::NoButton;
ulong QGuiApplicationPrivate::mousePressTime = 0; ulong QGuiApplicationPrivate::mousePressTime = 0;
@ -554,7 +554,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QEvent::Type type; QEvent::Type type;
// move first // move first
Qt::MouseButtons stateChange = e->buttons ^ buttons; Qt::MouseButtons stateChange = e->buttons ^ buttons;
if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { if (e->globalPos != QPointF(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) {
QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent = QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent =
new QWindowSystemInterfacePrivate::MouseEvent(e->window.data(), e->timestamp, e->localPos, e->globalPos, e->buttons); new QWindowSystemInterfacePrivate::MouseEvent(e->window.data(), e->timestamp, e->localPos, e->globalPos, e->buttons);
QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop
@ -563,8 +563,8 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QWindow *window = e->window.data(); QWindow *window = e->window.data();
QPoint localPoint = e->localPos; QPointF localPoint = e->localPos;
QPoint globalPoint = e->globalPos; QPointF globalPoint = e->globalPos;
Qt::MouseButton button = Qt::NoButton; Qt::MouseButton button = Qt::NoButton;
@ -629,7 +629,7 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
if (!e->window) if (!e->window)
return; return;
QPoint globalPoint = e->globalPos; QPointF globalPoint = e->globalPos;
qt_last_x = globalPoint.x(); qt_last_x = globalPoint.x();
qt_last_y = globalPoint.y(); qt_last_y = globalPoint.y();

View File

@ -114,12 +114,12 @@ void QWindowSystemInterface::handleCloseEvent(QWindow *tlw)
*/ */
void QWindowSystemInterface::handleMouseEvent(QWindow *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { void QWindowSystemInterface::handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleMouseEvent(w, time, local, global, b); handleMouseEvent(w, time, local, global, b);
} }
void QWindowSystemInterface::handleMouseEvent(QWindow *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) void QWindowSystemInterface::handleMouseEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b)
{ {
QWindowSystemInterfacePrivate::MouseEvent * e = QWindowSystemInterfacePrivate::MouseEvent * e =
new QWindowSystemInterfacePrivate::MouseEvent(tlw, timestamp, local, global, b); new QWindowSystemInterfacePrivate::MouseEvent(tlw, timestamp, local, global, b);
@ -162,12 +162,12 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestam
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
} }
void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
handleWheelEvent(w, time, local, global, d, o); handleWheelEvent(w, time, local, global, d, o);
} }
void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o)
{ {
QWindowSystemInterfacePrivate::WheelEvent *e = QWindowSystemInterfacePrivate::WheelEvent *e =
new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, d, o); new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, d, o);

View File

@ -62,8 +62,8 @@ QT_MODULE(Gui)
class Q_GUI_EXPORT QWindowSystemInterface class Q_GUI_EXPORT QWindowSystemInterface
{ {
public: public:
static void handleMouseEvent(QWindow *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b); static void handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b);
static void handleMouseEvent(QWindow *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b); static void handleMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b);
static void handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); static void handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
static void handleKeyEvent(QWindow *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); static void handleKeyEvent(QWindow *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
@ -79,8 +79,8 @@ public:
const QString& text = QString(), bool autorep = false, const QString& text = QString(), bool autorep = false,
ushort count = 1); ushort count = 1);
static void handleWheelEvent(QWindow *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o);
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o);
struct TouchPoint { struct TouchPoint {
int id; // for application use int id; // for application use

View File

@ -135,20 +135,20 @@ public:
class MouseEvent : public UserEvent { class MouseEvent : public UserEvent {
public: public:
MouseEvent(QWindow * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b) MouseEvent(QWindow * w, ulong time, const QPointF & local, const QPointF & global, Qt::MouseButtons b)
: UserEvent(w, time, Mouse), localPos(local), globalPos(global), buttons(b) { } : UserEvent(w, time, Mouse), localPos(local), globalPos(global), buttons(b) { }
QPoint localPos; QPointF localPos;
QPoint globalPos; QPointF globalPos;
Qt::MouseButtons buttons; Qt::MouseButtons buttons;
}; };
class WheelEvent : public UserEvent { class WheelEvent : public UserEvent {
public: public:
WheelEvent(QWindow *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, int d, Qt::Orientation o)
: UserEvent(w, time, Wheel), delta(d), localPos(local), globalPos(global), orient(o) { } : UserEvent(w, time, Wheel), delta(d), localPos(local), globalPos(global), orient(o) { }
int delta; int delta;
QPoint localPos; QPointF localPos;
QPoint globalPos; QPointF globalPos;
Qt::Orientation orient; Qt::Orientation orient;
}; };

View File

@ -162,27 +162,27 @@ inline void QBezier::coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal &
inline QPointF QBezier::pointAt(qreal t) const inline QPointF QBezier::pointAt(qreal t) const
{ {
#if 1
qreal a, b, c, d;
coefficients(t, a, b, c, d);
return QPointF(a*x1 + b*x2 + c*x3 + d*x4, a*y1 + b*y2 + c*y3 + d*y4);
#else
// numerically more stable: // numerically more stable:
qreal x, y;
qreal m_t = 1. - t; qreal m_t = 1. - t;
{
qreal a = x1*m_t + x2*t; qreal a = x1*m_t + x2*t;
qreal b = x2*m_t + x3*t; qreal b = x2*m_t + x3*t;
qreal c = x3*m_t + x4*t; qreal c = x3*m_t + x4*t;
a = a*m_t + b*t; a = a*m_t + b*t;
b = b*m_t + c*t; b = b*m_t + c*t;
qreal x = a*m_t + b*t; x = a*m_t + b*t;
}
{
qreal a = y1*m_t + y2*t; qreal a = y1*m_t + y2*t;
qreal b = y2*m_t + y3*t; qreal b = y2*m_t + y3*t;
qreal c = y3*m_t + y4*t; qreal c = y3*m_t + y4*t;
a = a*m_t + b*t; a = a*m_t + b*t;
b = b*m_t + c*t; b = b*m_t + c*t;
qreal y = a*m_t + b*t; y = a*m_t + b*t;
}
return QPointF(x, y); return QPointF(x, y);
#endif
} }
inline QPointF QBezier::normalVector(qreal t) const inline QPointF QBezier::normalVector(qreal t) const

View File

@ -1537,14 +1537,6 @@ bool QGradient::operator==(const QGradient &gradient) const
return stops() == gradient.stops(); return stops() == gradient.stops();
} }
/*!
\internal
*/
bool QGradient::operator==(const QGradient &gradient)
{
return const_cast<const QGradient *>(this)->operator==(gradient);
}
/*! /*!
\class QLinearGradient \class QLinearGradient
\ingroup painting \ingroup painting

View File

@ -239,8 +239,6 @@ public:
inline bool operator!=(const QGradient &other) const inline bool operator!=(const QGradient &other) const
{ return !operator==(other); } { return !operator==(other); }
bool operator==(const QGradient &gradient); // ### Qt 5: remove
private: private:
friend class QLinearGradient; friend class QLinearGradient;
friend class QRadialGradient; friend class QRadialGradient;

View File

@ -275,7 +275,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
if (!engine) { if (!engine) {
if (!request.family.isEmpty()) { if (!request.family.isEmpty()) {
QStringList fallbacks = fallbackFamilies(request.family,QFont::Style(request.style),QFont::StyleHint(request.styleHint),QUnicodeTables::Script(script)); QStringList fallbacks = fallbackFamilies(request.family,QFont::Style(request.style),QFont::StyleHint(request.styleHint),QUnicodeTables::Script(script));
for (int i = 0; i < fallbacks.size(); i++) { for (int i = 0; !engine && i < fallbacks.size(); i++) {
QFontDef def = request; QFontDef def = request;
def.family = fallbacks.at(i); def.family = fallbacks.at(i);
QFontCache::Key key(def,script); QFontCache::Key key(def,script);
@ -289,7 +289,6 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
engine = loadEngine(script, def, desc.family, desc.foundry, desc.style, desc.size); engine = loadEngine(script, def, desc.family, desc.foundry, desc.style, desc.size);
if (engine) { if (engine) {
initFontDef(desc, def, &engine->fontDef); initFontDef(desc, def, &engine->fontDef);
break;
} }
} }
} }

View File

@ -291,7 +291,7 @@ private:
struct GlyphCacheEntry { struct GlyphCacheEntry {
void *context; void *context;
QExplicitlySharedDataPointer<QFontEngineGlyphCache> cache; QExplicitlySharedDataPointer<QFontEngineGlyphCache> cache;
bool operator==(const GlyphCacheEntry &other) { return context == other.context && cache == other.cache; } bool operator==(const GlyphCacheEntry &other) const { return context == other.context && cache == other.cache; }
}; };
mutable QLinkedList<GlyphCacheEntry> m_glyphCaches; mutable QLinkedList<GlyphCacheEntry> m_glyphCaches;

View File

@ -224,7 +224,6 @@ QFontMetrics &QFontMetrics::operator=(const QFontMetrics &fm)
} }
/*! /*!
\overload
Returns true if \a other is equal to this object; otherwise Returns true if \a other is equal to this object; otherwise
returns false. returns false.
@ -239,21 +238,6 @@ bool QFontMetrics::operator ==(const QFontMetrics &other) const
return d == other.d; return d == other.d;
} }
/*!
Returns true if \a other is equal to this object; otherwise
returns false.
Two font metrics are considered equal if they were constructed
from the same QFont and the paint devices they were constructed
for are considered compatible.
\sa operator!=()
*/
bool QFontMetrics::operator ==(const QFontMetrics &other)
{
return d == other.d;
}
/*! /*!
\fn bool QFontMetrics::operator!=(const QFontMetrics &other) \fn bool QFontMetrics::operator!=(const QFontMetrics &other)
@ -1118,7 +1102,6 @@ QFontMetricsF &QFontMetricsF::operator=(const QFontMetricsF &fm)
} }
/*! /*!
\overload
Returns true if the font metrics are equal to the \a other font Returns true if the font metrics are equal to the \a other font
metrics; otherwise returns false. metrics; otherwise returns false.
@ -1131,19 +1114,6 @@ bool QFontMetricsF::operator ==(const QFontMetricsF &other) const
return d == other.d; return d == other.d;
} }
/*!
Returns true if the font metrics are equal to the \a other font
metrics; otherwise returns false.
Two font metrics are considered equal if they were constructed from the
same QFont and the paint devices they were constructed for are
considered to be compatible.
*/
bool QFontMetricsF::operator ==(const QFontMetricsF &other)
{
return d == other.d;
}
/*! /*!
\fn bool QFontMetricsF::operator!=(const QFontMetricsF &other) \fn bool QFontMetricsF::operator!=(const QFontMetricsF &other)

View File

@ -117,9 +117,7 @@ public:
int strikeOutPos() const; int strikeOutPos() const;
int lineWidth() const; int lineWidth() const;
bool operator==(const QFontMetrics &other); // 5.0 - remove me
bool operator==(const QFontMetrics &other) const; bool operator==(const QFontMetrics &other) const;
inline bool operator !=(const QFontMetrics &other) { return !operator==(other); } // 5.0 - remove me
inline bool operator !=(const QFontMetrics &other) const { return !operator==(other); } inline bool operator !=(const QFontMetrics &other) const { return !operator==(other); }
private: private:
@ -183,9 +181,7 @@ public:
qreal strikeOutPos() const; qreal strikeOutPos() const;
qreal lineWidth() const; qreal lineWidth() const;
bool operator==(const QFontMetricsF &other); // 5.0 - remove me
bool operator==(const QFontMetricsF &other) const; bool operator==(const QFontMetricsF &other) const;
inline bool operator !=(const QFontMetricsF &other) { return !operator==(other); } // 5.0 - remove me
inline bool operator !=(const QFontMetricsF &other) const { return !operator==(other); } inline bool operator !=(const QFontMetricsF &other) const { return !operator==(other); }
private: private:

View File

@ -45,6 +45,7 @@
#include "qglyphrun.h" #include "qglyphrun.h"
#include "qglyphrun_p.h" #include "qglyphrun_p.h"
#include <qdebug.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -343,12 +344,44 @@ void QGlyphRun::setStrikeOut(bool strikeOut)
} }
/*! /*!
Returns the smallest rectangle that contains all glyphs in this QGlyphRun. Sets the bounding rect of the glyphs in this QGlyphRun to be \a boundingRect. This rectangle
will be returned by boundingRect() unless it is empty, in which case the bounding rectangle of the
glyphs in the glyph run will be returned instead.
\note Unless you are implementing text shaping, you should not have to use this function.
It is used specifically when the QGlyphRun should represent an area which is smaller than the
area of the glyphs it contains. This could happen e.g. if the glyph run is retrieved by calling
QTextLayout::glyphRuns() and the specified range only includes part of a ligature (where two or
more characters are combined to a single glyph.) When this is the case, the bounding rect should
only include the appropriate part of the ligature glyph, based on a calculation of the average
width of the characters in the ligature.
In order to support such a case (an example is selections which should be drawn with a different
color than the main text color), it is necessary to clip the painting mechanism to the rectangle
returned from boundingRect() to avoid drawing the entire ligature glyph.
\sa boundingRect()
\since 5.0
*/
void QGlyphRun::setBoundingRect(const QRectF &boundingRect)
{
detach();
d->boundingRect = boundingRect;
}
/*!
Returns the smallest rectangle that contains all glyphs in this QGlyphRun. If a bounding rect
has been set using setBoundingRect(), then this will be returned. Otherwise the bounding rect
will be calculated based on the font metrics of the glyphs in the glyph run.
\since 5.0 \since 5.0
*/ */
QRectF QGlyphRun::boundingRect() const QRectF QGlyphRun::boundingRect() const
{ {
if (!d->boundingRect.isEmpty())
return d->boundingRect;
qreal minX, minY, maxX, maxY; qreal minX, minY, maxX, maxY;
for (int i=0; i<qMin(d->glyphPositions.size(), d->glyphIndexes.size()); ++i) { for (int i=0; i<qMin(d->glyphPositions.size(), d->glyphIndexes.size()); ++i) {
@ -371,6 +404,16 @@ QRectF QGlyphRun::boundingRect() const
return QRectF(QPointF(minX, minY), QPointF(maxX, maxY)); return QRectF(QPointF(minX, minY), QPointF(maxX, maxY));
} }
/*!
Returns true if the QGlyphRun does not contain any glyphs.
\since 5.0
*/
bool QGlyphRun::isEmpty() const
{
return d->glyphIndexes.isEmpty();
}
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_RAWFONT #endif // QT_NO_RAWFONT

View File

@ -91,8 +91,11 @@ public:
void setStrikeOut(bool strikeOut); void setStrikeOut(bool strikeOut);
bool strikeOut() const; bool strikeOut() const;
void setBoundingRect(const QRectF &boundingRect);
QRectF boundingRect() const; QRectF boundingRect() const;
bool isEmpty() const;
private: private:
friend class QGlyphRunPrivate; friend class QGlyphRunPrivate;
friend class QTextLine; friend class QTextLine;

View File

@ -83,6 +83,7 @@ public:
, glyphIndexes(other.glyphIndexes) , glyphIndexes(other.glyphIndexes)
, glyphPositions(other.glyphPositions) , glyphPositions(other.glyphPositions)
, rawFont(other.rawFont) , rawFont(other.rawFont)
, boundingRect(other.boundingRect)
, overline(other.overline) , overline(other.overline)
, underline(other.underline) , underline(other.underline)
, strikeOut(other.strikeOut) , strikeOut(other.strikeOut)
@ -96,6 +97,7 @@ public:
QVector<quint32> glyphIndexes; QVector<quint32> glyphIndexes;
QVector<QPointF> glyphPositions; QVector<QPointF> glyphPositions;
QRawFont rawFont; QRawFont rawFont;
QRectF boundingRect;
uint overline : 1; uint overline : 1;
uint underline : 1; uint underline : 1;

View File

@ -406,6 +406,8 @@ void QTextControlPrivate::init(Qt::TextFormat format, const QString &text, QText
doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable); doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable);
q->setCursorWidth(-1); q->setCursorWidth(-1);
QObject::connect(q, SIGNAL(updateCursorRequest(QRectF)), q, SIGNAL(updateRequest(QRectF)));
} }
void QTextControlPrivate::setContent(Qt::TextFormat format, const QString &text, QTextDocument *document) void QTextControlPrivate::setContent(Qt::TextFormat format, const QString &text, QTextDocument *document)
@ -544,7 +546,7 @@ void QTextControlPrivate::setCursorPosition(int pos, QTextCursor::MoveMode mode)
void QTextControlPrivate::repaintCursor() void QTextControlPrivate::repaintCursor()
{ {
Q_Q(QTextControl); Q_Q(QTextControl);
emit q->updateRequest(cursorRectPlusUnicodeDirectionMarkers(cursor)); emit q->updateCursorRequest(cursorRectPlusUnicodeDirectionMarkers(cursor));
} }
void QTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelection) void QTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelection)
@ -561,11 +563,18 @@ void QTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelect
differenceSelection.setPosition(oldSelection.position()); differenceSelection.setPosition(oldSelection.position());
differenceSelection.setPosition(cursor.position(), QTextCursor::KeepAnchor); differenceSelection.setPosition(cursor.position(), QTextCursor::KeepAnchor);
emit q->updateRequest(q->selectionRect(differenceSelection)); emit q->updateRequest(q->selectionRect(differenceSelection));
} else {
if (!oldSelection.hasSelection() && !cursor.hasSelection()) {
if (!oldSelection.isNull())
emit q->updateCursorRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection));
emit q->updateCursorRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor));
} else { } else {
if (!oldSelection.isNull()) if (!oldSelection.isNull())
emit q->updateRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection)); emit q->updateRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection));
emit q->updateRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor)); emit q->updateRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor));
} }
}
} }
void QTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged /*=false*/) void QTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged /*=false*/)
@ -2750,6 +2759,12 @@ void QTextControl::setPalette(const QPalette &pal)
d->palette = pal; d->palette = pal;
} }
bool QTextControl::cursorOn() const
{
Q_D(const QTextControl);
return d->cursorOn;
}
QAbstractTextDocumentLayout::PaintContext QTextControl::getPaintContext() const QAbstractTextDocumentLayout::PaintContext QTextControl::getPaintContext() const
{ {
Q_D(const QTextControl); Q_D(const QTextControl);
@ -2887,6 +2902,7 @@ void QTextEditMimeData::setup() const
fragment = QTextDocumentFragment(); fragment = QTextDocumentFragment();
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qtextcontrol_p.cpp" #include "moc_qtextcontrol_p.cpp"

View File

@ -215,6 +215,7 @@ Q_SIGNALS:
void cursorPositionChanged(); void cursorPositionChanged();
// control signals // control signals
void updateCursorRequest(const QRectF &rect = QRectF());
void updateRequest(const QRectF &rect = QRectF()); void updateRequest(const QRectF &rect = QRectF());
void documentSizeChanged(const QSizeF &); void documentSizeChanged(const QSizeF &);
void blockCountChanged(int newBlockCount); void blockCountChanged(int newBlockCount);
@ -247,6 +248,8 @@ public:
bool setFocusToNextOrPreviousAnchor(bool next); bool setFocusToNextOrPreviousAnchor(bool next);
bool findNextPrevAnchor(const QTextCursor& from, bool next, QTextCursor& newAnchor); bool findNextPrevAnchor(const QTextCursor& from, bool next, QTextCursor& newAnchor);
bool cursorOn() const;
protected: protected:
virtual void timerEvent(QTimerEvent *e); virtual void timerEvent(QTimerEvent *e);

View File

@ -1532,33 +1532,38 @@ void QTextEngine::itemize() const
const ushort *e = uc + length; const ushort *e = uc + length;
int lastScript = QUnicodeTables::Common; int lastScript = QUnicodeTables::Common;
while (uc < e) { while (uc < e) {
int script = QUnicodeTables::script(*uc); switch (*uc) {
if (script == QUnicodeTables::Inherited) case QChar::ObjectReplacementCharacter:
script = lastScript;
analysis->flags = QScriptAnalysis::None;
if (*uc == QChar::ObjectReplacementCharacter) {
if (analysis->bidiLevel % 2)
--analysis->bidiLevel;
analysis->script = QUnicodeTables::Common; analysis->script = QUnicodeTables::Common;
analysis->flags = QScriptAnalysis::Object; analysis->flags = QScriptAnalysis::Object;
} else if (*uc == QChar::LineSeparator) { break;
case QChar::LineSeparator:
if (analysis->bidiLevel % 2) if (analysis->bidiLevel % 2)
--analysis->bidiLevel; --analysis->bidiLevel;
analysis->script = QUnicodeTables::Common; analysis->script = QUnicodeTables::Common;
analysis->flags = QScriptAnalysis::LineOrParagraphSeparator; analysis->flags = QScriptAnalysis::LineOrParagraphSeparator;
if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
*const_cast<ushort*>(uc) = 0x21B5; // visual line separator *const_cast<ushort*>(uc) = 0x21B5; // visual line separator
} else if (*uc == 9) { break;
case 9: // Tab
analysis->script = QUnicodeTables::Common; analysis->script = QUnicodeTables::Common;
analysis->flags = QScriptAnalysis::Tab; analysis->flags = QScriptAnalysis::Tab;
analysis->bidiLevel = control.baseLevel(); analysis->bidiLevel = control.baseLevel();
} else if ((*uc == 32 || *uc == QChar::Nbsp) break;
&& (option.flags() & QTextOption::ShowTabsAndSpaces)) { case 32: // Space
case QChar::Nbsp:
if (option.flags() & QTextOption::ShowTabsAndSpaces) {
analysis->script = QUnicodeTables::Common; analysis->script = QUnicodeTables::Common;
analysis->flags = QScriptAnalysis::Space; analysis->flags = QScriptAnalysis::Space;
analysis->bidiLevel = control.baseLevel(); analysis->bidiLevel = control.baseLevel();
} else { break;
analysis->script = script; }
// fall through
default:
int script = QUnicodeTables::script(*uc);
analysis->script = script == QUnicodeTables::Inherited ? lastScript : script;
analysis->flags = QScriptAnalysis::None;
break;
} }
lastScript = analysis->script; lastScript = analysis->script;
++uc; ++uc;
@ -2432,7 +2437,7 @@ void QTextEngine::indexAdditionalFormats()
between the text that gets truncated and the ellipsis. This is important to get between the text that gets truncated and the ellipsis. This is important to get
correctly shaped results for arabic text. correctly shaped results for arabic text.
*/ */
static bool nextCharJoins(const QString &string, int pos) static inline bool nextCharJoins(const QString &string, int pos)
{ {
while (pos < string.length() && string.at(pos).category() == QChar::Mark_NonSpacing) while (pos < string.length() && string.at(pos).category() == QChar::Mark_NonSpacing)
++pos; ++pos;
@ -2441,13 +2446,14 @@ static bool nextCharJoins(const QString &string, int pos)
return string.at(pos).joining() != QChar::OtherJoining; return string.at(pos).joining() != QChar::OtherJoining;
} }
static bool prevCharJoins(const QString &string, int pos) static inline bool prevCharJoins(const QString &string, int pos)
{ {
while (pos > 0 && string.at(pos - 1).category() == QChar::Mark_NonSpacing) while (pos > 0 && string.at(pos - 1).category() == QChar::Mark_NonSpacing)
--pos; --pos;
if (pos == 0) if (pos == 0)
return false; return false;
return (string.at(pos - 1).joining() == QChar::Dual || string.at(pos - 1).joining() == QChar::Center); QChar::Joining joining = string.at(pos - 1).joining();
return (joining == QChar::Dual || joining == QChar::Center);
} }
QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags) const QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags) const

View File

@ -42,6 +42,7 @@
#include "qtextlayout.h" #include "qtextlayout.h"
#include "qtextengine_p.h" #include "qtextengine_p.h"
#include <qthread.h>
#include <qfont.h> #include <qfont.h>
#include <qpainter.h> #include <qpainter.h>
#include <qvarlengtharray.h> #include <qvarlengtharray.h>
@ -2106,8 +2107,10 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q
} }
#if !defined(QT_NO_RAWFONT)
static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &glyphLayout, static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &glyphLayout,
const QPointF &pos, const QTextItem::RenderFlags &flags) const QPointF &pos, const QTextItem::RenderFlags &flags,
const QFixed &selectionX, const QFixed &selectionWidth)
{ {
QGlyphRun glyphRun; QGlyphRun glyphRun;
@ -2115,6 +2118,7 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
QRawFont font; QRawFont font;
QRawFontPrivate *fontD = QRawFontPrivate::get(font); QRawFontPrivate *fontD = QRawFontPrivate::get(font);
fontD->fontEngine = fontEngine; fontD->fontEngine = fontEngine;
fontD->thread = QThread::currentThread();
fontD->fontEngine->ref.ref(); fontD->fontEngine->ref.ref();
#if defined(Q_WS_WIN) #if defined(Q_WS_WIN)
@ -2149,12 +2153,26 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
positionsArray); positionsArray);
Q_ASSERT(glyphsArray.size() == positionsArray.size()); Q_ASSERT(glyphsArray.size() == positionsArray.size());
qreal fontHeight = font.ascent() + font.descent();
qreal minY;
qreal maxY;
QVector<quint32> glyphs; QVector<quint32> glyphs;
QVector<QPointF> positions; QVector<QPointF> positions;
for (int i=0; i<glyphsArray.size(); ++i) { for (int i=0; i<glyphsArray.size(); ++i) {
glyphs.append(glyphsArray.at(i) & 0xffffff); glyphs.append(glyphsArray.at(i) & 0xffffff);
positions.append(positionsArray.at(i).toPointF() + pos);
QPointF position = positionsArray.at(i).toPointF() + pos;
positions.append(position);
if (i == 0) {
maxY = minY = position.y();
} else {
minY = qMin(minY, position.y());
maxY = qMax(maxY, position.y());
} }
}
qreal height = maxY + fontHeight - minY;
glyphRun.setGlyphIndexes(glyphs); glyphRun.setGlyphIndexes(glyphs);
glyphRun.setPositions(positions); glyphRun.setPositions(positions);
@ -2164,6 +2182,8 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
glyphRun.setStrikeOut(flags.testFlag(QTextItem::StrikeOut)); glyphRun.setStrikeOut(flags.testFlag(QTextItem::StrikeOut));
glyphRun.setRawFont(font); glyphRun.setRawFont(font);
glyphRun.setBoundingRect(QRectF(selectionX.toReal(), minY, selectionWidth.toReal(), height));
return glyphRun; return glyphRun;
} }
@ -2180,7 +2200,6 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
\sa QTextLayout::glyphRuns() \sa QTextLayout::glyphRuns()
*/ */
#if !defined(QT_NO_RAWFONT)
QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
{ {
const QScriptLine &line = eng->lines[i]; const QScriptLine &line = eng->lines[i];
@ -2194,7 +2213,14 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
if (length < 0) if (length < 0)
length = textLength(); length = textLength();
QTextLineItemIterator iterator(eng, i); if (length == 0)
return QList<QGlyphRun>();
QTextLayout::FormatRange selection;
selection.start = from;
selection.length = length;
QTextLineItemIterator iterator(eng, i, QPointF(), &selection);
qreal y = line.y.toReal() + line.base().toReal(); qreal y = line.y.toReal() + line.base().toReal();
QList<QGlyphRun> glyphRuns; QList<QGlyphRun> glyphRuns;
while (!iterator.atEnd()) { while (!iterator.atEnd()) {
@ -2204,7 +2230,10 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
QPointF pos(iterator.x.toReal(), y); QPointF pos(iterator.x.toReal(), y);
if (from >= 0 && length >= 0 && if (from >= 0 && length >= 0 &&
(from >= si.position + eng->length(&si) || from + length <= si.position)) { (from >= si.position + eng->length(&si)
|| from + length <= si.position
|| from + length <= iterator.itemStart
|| from >= iterator.itemEnd)) {
continue; continue;
} }
@ -2233,19 +2262,22 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
? si.num_glyphs - 1 ? si.num_glyphs - 1
: logClusters[relativeTo]; : logClusters[relativeTo];
int itemGlyphsStart = logClusters[iterator.itemStart - si.position];
int itemGlyphsEnd = logClusters[iterator.itemEnd - 1 - si.position];
QGlyphLayout glyphLayout = eng->shapedGlyphs(&si); QGlyphLayout glyphLayout = eng->shapedGlyphs(&si);
// Calculate new x position of glyph layout for a subset. This becomes somewhat complex // Calculate new x position of glyph layout for a subset. This becomes somewhat complex
// when we're breaking a RTL script item, since the expected position passed into // when we're breaking a RTL script item, since the expected position passed into
// getGlyphPositions() is the left-most edge of the left-most glyph in an RTL run. // getGlyphPositions() is the left-most edge of the left-most glyph in an RTL run.
if (relativeFrom != (iterator.itemStart - si.position) && !rtl) { if (relativeFrom != (iterator.itemStart - si.position) && !rtl) {
for (int i=0; i<glyphsStart; ++i) { for (int i=itemGlyphsStart; i<glyphsStart; ++i) {
QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6); QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6);
pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(), pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(),
glyphLayout.advances_y[i].toReal()); glyphLayout.advances_y[i].toReal());
} }
} else if (relativeTo != (iterator.itemEnd - si.position - 1) && rtl) { } else if (relativeTo != (iterator.itemEnd - si.position - 1) && rtl) {
for (int i=glyphLayout.numGlyphs - 1; i>glyphsEnd; --i) { for (int i=itemGlyphsEnd; i>glyphsEnd; --i) {
QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6); QFixed justification = QFixed::fromFixed(glyphLayout.justifications[i].space_18d6);
pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(), pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(),
glyphLayout.advances_y[i].toReal()); glyphLayout.advances_y[i].toReal());
@ -2254,6 +2286,10 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
glyphLayout = glyphLayout.mid(glyphsStart, glyphsEnd - glyphsStart + 1); glyphLayout = glyphLayout.mid(glyphsStart, glyphsEnd - glyphsStart + 1);
QFixed x;
QFixed width;
iterator.getSelectionBounds(&x, &width);
if (glyphLayout.numGlyphs > 0) { if (glyphLayout.numGlyphs > 0) {
QFontEngine *mainFontEngine = font.d->engineForScript(si.analysis.script); QFontEngine *mainFontEngine = font.d->engineForScript(si.analysis.script);
if (mainFontEngine->type() == QFontEngine::Multi) { if (mainFontEngine->type() == QFontEngine::Multi) {
@ -2268,7 +2304,7 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
QGlyphLayout subLayout = glyphLayout.mid(start, end - start); QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which), glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which),
subLayout, pos, flags)); subLayout, pos, flags, x, width));
for (int i = 0; i < subLayout.numGlyphs; i++) { for (int i = 0; i < subLayout.numGlyphs; i++) {
pos += QPointF(subLayout.advances_x[i].toReal(), pos += QPointF(subLayout.advances_x[i].toReal(),
subLayout.advances_y[i].toReal()); subLayout.advances_y[i].toReal());
@ -2279,10 +2315,15 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
} }
QGlyphLayout subLayout = glyphLayout.mid(start, end - start); QGlyphLayout subLayout = glyphLayout.mid(start, end - start);
glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which), QGlyphRun glyphRun = glyphRunWithInfo(multiFontEngine->engine(which),
subLayout, pos, flags)); subLayout, pos, flags, x, width);
if (!glyphRun.isEmpty())
glyphRuns.append(glyphRun);
} else { } else {
glyphRuns.append(glyphRunWithInfo(mainFontEngine, glyphLayout, pos, flags)); QGlyphRun glyphRun = glyphRunWithInfo(mainFontEngine, glyphLayout, pos, flags, x,
width);
if (!glyphRun.isEmpty())
glyphRuns.append(glyphRun);
} }
} }
} }

View File

@ -1667,21 +1667,24 @@ QTextBlock::iterator &QTextBlock::iterator::operator--()
\sa QGlyphRun, QTextBlock::layout(), QTextLayout::position(), QPainter::drawGlyphRun() \sa QGlyphRun, QTextBlock::layout(), QTextLayout::position(), QPainter::drawGlyphRun()
*/ */
#if !defined(QT_NO_RAWFONT) #if !defined(QT_NO_RAWFONT)
QList<QGlyphRun> QTextFragment::glyphRuns() const QList<QGlyphRun> QTextFragment::glyphRuns(int pos, int len) const
{ {
if (!p || !n) if (!p || !n)
return QList<QGlyphRun>(); return QList<QGlyphRun>();
int pos = position(); int blockNode = p->blockMap().findNode(position());
int len = length();
if (len == 0)
return QList<QGlyphRun>();
int blockNode = p->blockMap().findNode(pos);
const QTextBlockData *blockData = p->blockMap().fragment(blockNode); const QTextBlockData *blockData = p->blockMap().fragment(blockNode);
QTextLayout *layout = blockData->layout; QTextLayout *layout = blockData->layout;
int blockPosition = p->blockMap().position(blockNode);
if (pos < 0)
pos = position() - blockPosition;
if (len < 0)
len = length();
if (len == 0)
return QList<QGlyphRun>();
QList<QGlyphRun> ret; QList<QGlyphRun> ret;
for (int i=0; i<layout->lineCount(); ++i) { for (int i=0; i<layout->lineCount(); ++i) {
QTextLine textLine = layout->lineAt(i); QTextLine textLine = layout->lineAt(i);

View File

@ -317,7 +317,7 @@ public:
QString text() const; QString text() const;
#if !defined(QT_NO_RAWFONT) #if !defined(QT_NO_RAWFONT)
QList<QGlyphRun> glyphRuns() const; QList<QGlyphRun> glyphRuns(int from = -1, int length = -1) const;
#endif #endif
private: private:

View File

@ -395,7 +395,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByt
case Basic: case Basic:
if(realm.isEmpty()) if(realm.isEmpty())
this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm")); this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
if (user.isEmpty()) if (user.isEmpty() && password.isEmpty())
phase = Done; phase = Done;
break; break;
case Ntlm: case Ntlm:
@ -406,7 +406,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByt
this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm")); this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
if (options.value("stale").toLower() == "true") if (options.value("stale").toLower() == "true")
phase = Start; phase = Start;
if (user.isEmpty()) if (user.isEmpty() && password.isEmpty())
phase = Done; phase = Done;
break; break;
} }

View File

@ -82,9 +82,9 @@ QT_BEGIN_NAMESPACE
*/ */
/*! /*!
\enum QSsl::AlternateNameEntryType \enum QSsl::AlternativeNameEntryType
Describes the key types for alternate name entries in QSslCertificate. Describes the key types for alternative name entries in QSslCertificate.
\value EmailEntry An email entry; the entry contains an email address that \value EmailEntry An email entry; the entry contains an email address that
the certificate is valid for. the certificate is valid for.
@ -92,7 +92,7 @@ QT_BEGIN_NAMESPACE
\value DnsEntry A DNS host name entry; the entry contains a host name \value DnsEntry A DNS host name entry; the entry contains a host name
entry that the certificate is valid for. The entry may contain wildcards. entry that the certificate is valid for. The entry may contain wildcards.
\sa QSslCertificate::alternateSubjectNames() \sa QSslCertificate::subjectAlternativeNames()
*/ */

View File

@ -67,11 +67,15 @@ namespace QSsl {
Dsa Dsa
}; };
enum AlternateNameEntryType { enum AlternativeNameEntryType {
EmailEntry, EmailEntry,
DnsEntry DnsEntry
}; };
#if QT_DEPRECATED_SINCE(5,0)
typedef AlternativeNameEntryType AlternateNameEntryType;
#endif
enum SslProtocol { enum SslProtocol {
SslV3, SslV3,
SslV2, SslV2,

View File

@ -426,7 +426,7 @@ QList<QByteArray> QSslCertificate::issuerInfoAttributes() const
/*! /*!
Returns the list of alternative subject names for this Returns the list of alternative subject names for this
certificate. The alternate subject names typically contain host certificate. The alternative names typically contain host
names, optionally with wildcards, that are valid for this names, optionally with wildcards, that are valid for this
certificate. certificate.
@ -437,9 +437,9 @@ QList<QByteArray> QSslCertificate::issuerInfoAttributes() const
\sa subjectInfo() \sa subjectInfo()
*/ */
QMultiMap<QSsl::AlternateNameEntryType, QString> QSslCertificate::alternateSubjectNames() const QMultiMap<QSsl::AlternativeNameEntryType, QString> QSslCertificate::subjectAlternativeNames() const
{ {
QMultiMap<QSsl::AlternateNameEntryType, QString> result; QMultiMap<QSsl::AlternativeNameEntryType, QString> result;
if (!d->x509) if (!d->x509)
return result; return result;
@ -922,7 +922,7 @@ QDebug operator<<(QDebug debug, const QSslCertificate &certificate)
<< ',' << certificate.digest().toBase64() << ',' << certificate.digest().toBase64()
<< ',' << certificate.issuerInfo(QSslCertificate::Organization) << ',' << certificate.issuerInfo(QSslCertificate::Organization)
<< ',' << certificate.subjectInfo(QSslCertificate::Organization) << ',' << certificate.subjectInfo(QSslCertificate::Organization)
<< ',' << certificate.alternateSubjectNames() << ',' << certificate.subjectAlternativeNames()
#ifndef QT_NO_TEXTSTREAM #ifndef QT_NO_TEXTSTREAM
<< ',' << certificate.effectiveDate() << ',' << certificate.effectiveDate()
<< ',' << certificate.expiryDate() << ',' << certificate.expiryDate()

View File

@ -48,6 +48,7 @@
#include <QtCore/qcryptographichash.h> #include <QtCore/qcryptographichash.h>
#include <QtCore/qregexp.h> #include <QtCore/qregexp.h>
#include <QtCore/qsharedpointer.h> #include <QtCore/qsharedpointer.h>
#include <QtCore/qmap.h>
#include <QtNetwork/qssl.h> #include <QtNetwork/qssl.h>
typedef struct x509_st X509; // ### check if this works typedef struct x509_st X509; // ### check if this works
@ -65,7 +66,6 @@ class QIODevice;
class QSslError; class QSslError;
class QSslKey; class QSslKey;
class QStringList; class QStringList;
template <typename T, typename U> class QMultiMap;
class QSslCertificatePrivate; class QSslCertificatePrivate;
class Q_NETWORK_EXPORT QSslCertificate class Q_NETWORK_EXPORT QSslCertificate
@ -106,7 +106,11 @@ public:
QStringList subjectInfo(const QByteArray &attribute) const; QStringList subjectInfo(const QByteArray &attribute) const;
QList<QByteArray> subjectInfoAttributes() const; QList<QByteArray> subjectInfoAttributes() const;
QList<QByteArray> issuerInfoAttributes() const; QList<QByteArray> issuerInfoAttributes() const;
QMultiMap<QSsl::AlternateNameEntryType, QString> alternateSubjectNames() const; #if QT_DEPRECATED_SINCE(5,0)
QT_DEPRECATED inline QMultiMap<QSsl::AlternateNameEntryType, QString>
alternateSubjectNames() const { return subjectAlternativeNames(); }
#endif
QMultiMap<QSsl::AlternativeNameEntryType, QString> subjectAlternativeNames() const;
QDateTime effectiveDate() const; QDateTime effectiveDate() const;
QDateTime expiryDate() const; QDateTime expiryDate() const;
QSslKey publicKey() const; QSslKey publicKey() const;

View File

@ -1435,7 +1435,7 @@ bool QSslSocketBackendPrivate::isMatchingHostname(const QSslCertificate &cert, c
} }
} }
foreach (const QString &altName, cert.alternateSubjectNames().values(QSsl::DnsEntry)) { foreach (const QString &altName, cert.subjectAlternativeNames().values(QSsl::DnsEntry)) {
if (isMatchingHostname(altName.toLower(), peerName.toLower())) { if (isMatchingHostname(altName.toLower(), peerName.toLower())) {
return true; return true;
} }

View File

@ -401,7 +401,7 @@ public:
bool useOpacityAttribute; bool useOpacityAttribute;
bool usePmvMatrixAttribute; bool usePmvMatrixAttribute;
bool operator==(const QGLEngineShaderProg& other) { bool operator==(const QGLEngineShaderProg& other) const {
// We don't care about the program // We don't care about the program
return ( mainVertexShader == other.mainVertexShader && return ( mainVertexShader == other.mainVertexShader &&
positionVertexShader == other.positionVertexShader && positionVertexShader == other.positionVertexShader &&

View File

@ -1776,16 +1776,12 @@ QString QAccessibleComboBox::text(Text t, int child) const
switch (t) { switch (t) {
case Name: case Name:
#ifndef Q_WS_X11 // on Linux we use relations for this, name is text (fall through to Value)
if (child == OpenList) if (child == OpenList)
str = QComboBox::tr("Open"); str = QComboBox::tr("Open");
else else
str = QAccessibleWidgetEx::text(t, 0); str = QAccessibleWidgetEx::text(t, 0);
break; break;
#ifndef QT_NO_SHORTCUT
case Accelerator:
if (child == OpenList)
str = (QString)QKeySequence(Qt::Key_Down);
// missing break?
#endif #endif
case Value: case Value:
if (comboBox()->isEditable()) if (comboBox()->isEditable())
@ -1793,6 +1789,12 @@ QString QAccessibleComboBox::text(Text t, int child) const
else else
str = comboBox()->currentText(); str = comboBox()->currentText();
break; break;
#ifndef QT_NO_SHORTCUT
case Accelerator:
if (child == OpenList)
str = (QString)QKeySequence(Qt::Key_Down);
break;
#endif
default: default:
break; break;
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,319 @@
/****************************************************************************
**
** 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 plugins 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$
**
****************************************************************************/
#ifndef ACCESSIBLE_ITEMVIEWS_H
#define ACCESSIBLE_ITEMVIEWS_H
#include <QtWidgets/qabstractitemview.h>
#include <QtWidgets/qheaderview.h>
#include <QtWidgets/qaccessible.h>
#include <QtWidgets/qaccessible2.h>
#include <QtWidgets/qaccessiblewidget.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
#ifndef QT_NO_ITEMVIEWS
class QAccessibleTable2Cell;
class QAccessibleTable2HeaderCell;
class QAccessibleTable2: public QAccessibleTable2Interface, public QAccessibleObjectEx
{
Q_ACCESSIBLE_OBJECT
public:
explicit QAccessibleTable2(QWidget *w);
virtual ~QAccessibleTable2();
QObject *object() const { return view; }
Role role(int child) const;
State state(int child) const;
QString text(Text t, int child) const;
QRect rect(int child) const;
int childAt(int x, int y) const;
int childCount() const;
int indexOfChild(const QAccessibleInterface *) const;
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
#ifndef QT_NO_ACTION
int userActionCount(int child) const;
QString actionText(int action, Text t, int child) const;
bool doAction(int action, int child, const QVariantList &params);
#endif
QVariant invokeMethodEx(Method, int, const QVariantList &) { return QVariant(); }
// table2 interface
virtual QAccessibleTable2CellInterface *cellAt(int row, int column) const;
virtual QAccessibleInterface *caption() const;
virtual QAccessibleInterface *summary() const;
virtual QString columnDescription(int column) const;
virtual QString rowDescription(int row) const;
virtual int columnCount() const;
virtual int rowCount() const;
virtual QAccessible2::TableModelChange modelChange() const;
// selection
virtual int selectedCellCount() const;
virtual int selectedColumnCount() const;
virtual int selectedRowCount() const;
virtual QList<QAccessibleTable2CellInterface*> selectedCells() const;
virtual QList<int> selectedColumns() const;
virtual QList<int> selectedRows() const;
virtual bool isColumnSelected(int column) const;
virtual bool isRowSelected(int row) const;
virtual bool selectRow(int row);
virtual bool selectColumn(int column);
virtual bool unselectRow(int row);
virtual bool unselectColumn(int column);
protected:
virtual void modelReset();
virtual void rowsInserted(const QModelIndex &parent, int first, int last);
virtual void rowsRemoved(const QModelIndex &parent, int first, int last);
virtual void columnsInserted(const QModelIndex &parent, int first, int last);
virtual void columnsRemoved(const QModelIndex &parent, int first, int last);
virtual void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row);
virtual void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column);
protected:
QAbstractItemView* view;
QAccessible2::TableModelChange lastChange;
inline QAccessibleTable2Cell *cell(const QModelIndex &index) const;
inline QAccessible::Role cellRole() const {
switch (m_role) {
case QAccessible::List:
return QAccessible::ListItem;
case QAccessible::Table:
return QAccessible::Cell;
case QAccessible::Tree:
return QAccessible::TreeItem;
default:
Q_ASSERT(0);
}
return QAccessible::NoRole;
}
QHeaderView *horizontalHeader() const;
QHeaderView *verticalHeader() const;
private:
// the child index for a model index
inline int logicalIndex(const QModelIndex &index) const;
// the model index from the child index
QAccessibleInterface *childFromLogical(int logicalIndex) const;
QAccessible::Role m_role;
};
class QAccessibleTree :public QAccessibleTable2
{
public:
explicit QAccessibleTree(QWidget *w)
: QAccessibleTable2(w)
{}
virtual ~QAccessibleTree() {}
int childAt(int x, int y) const;
int childCount() const;
int indexOfChild(const QAccessibleInterface *) const;
int rowCount() const;
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
// table2 interface
QAccessibleTable2CellInterface *cellAt(int row, int column) const;
QString rowDescription(int row) const;
bool isRowSelected(int row) const;
bool selectRow(int row);
private:
QModelIndex indexFromLogical(int row, int column = 0) const;
};
class QAccessibleTable2Cell: public QAccessibleTable2CellInterface /*), public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface*/
{
public:
QAccessibleTable2Cell(QAbstractItemView *view, const QModelIndex &m_index, QAccessible::Role role);
QObject *object() const { return 0; }
Role role(int child) const;
State state(int child) const;
QRect rect(int child) const;
bool isValid() const;
int childAt(int, int) const { return 0; }
int childCount() const { return 0; }
int indexOfChild(const QAccessibleInterface *) const { return -1; }
QString text(Text t, int child) const;
void setText(Text t, int child, const QString &text);
int navigate(RelationFlag relation, int m_index, QAccessibleInterface **iface) const;
Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
bool isExpandable() const;
#ifndef QT_NO_ACTION
int userActionCount(int child) const;
QString actionText(int action, Text t, int child) const;
bool doAction(int action, int child, const QVariantList &params);
#endif
// cell interface
virtual int columnExtent() const;
virtual QList<QAccessibleInterface*> columnHeaderCells() const;
virtual int columnIndex() const;
virtual int rowExtent() const;
virtual QList<QAccessibleInterface*> rowHeaderCells() const;
virtual int rowIndex() const;
virtual bool isSelected() const;
virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const;
virtual QAccessibleTable2Interface* table() const;
private:
QHeaderView *verticalHeader() const;
QHeaderView *horizontalHeader() const;
QAbstractItemView *view;
QModelIndex m_index;
QAccessible::Role m_role;
friend class QAccessibleTable2;
friend class QAccessibleTree;
};
class QAccessibleTable2HeaderCell: public QAccessibleInterface /*), public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface*/
{
public:
// For header cells, pass the header view in addition
QAccessibleTable2HeaderCell(QAbstractItemView *view, int index, Qt::Orientation orientation);
QObject *object() const { return 0; }
Role role(int child) const;
State state(int child) const;
QRect rect(int child) const;
bool isValid() const;
int childAt(int, int) const { return 0; }
int childCount() const { return 0; }
int indexOfChild(const QAccessibleInterface *) const { return -1; }
QString text(Text t, int child) const;
void setText(Text t, int child, const QString &text);
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
#ifndef QT_NO_ACTION
int userActionCount(int child) const;
QString actionText(int action, Text t, int child) const;
bool doAction(int action, int child, const QVariantList &params);
#endif
private:
QAbstractItemView *view;
int index;
Qt::Orientation orientation;
friend class QAccessibleTable2;
friend class QAccessibleTree;
};
// This is the corner button on the top left of a table.
// It can be used to select all cells or it is not active at all.
// For now it is ignored.
class QAccessibleTable2CornerButton: public QAccessibleInterface
{
public:
QAccessibleTable2CornerButton(QAbstractItemView *view_)
:view(view_)
{}
QObject *object() const { return 0; }
Role role(int child) const { Q_ASSERT(child == 0); return QAccessible::Pane; }
State state(int child) const { Q_ASSERT(child == 0); return QAccessible::Normal; }
QRect rect(int child) const { Q_ASSERT(child == 0); return QRect(); }
bool isValid() const { return true; }
int childAt(int, int) const { return 0; }
int childCount() const { return 0; }
int indexOfChild(const QAccessibleInterface *) const { return -1; }
QString text(Text, int) const { return QString(); }
void setText(Text, int, const QString &) {}
int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
{
if (relation == QAccessible::Ancestor && index == 1) {
*iface = QAccessible::queryAccessibleInterface(view);
return 0;
}
return -1;
}
Relation relationTo(int, const QAccessibleInterface *, int) const
{
return QAccessible::Unrelated;
}
#ifndef QT_NO_ACTION
int userActionCount(int) const { return 0; }
QString actionText(int, Text, int) const { return QString(); }
bool doAction(int, int, const QVariantList &) { return false; }
#endif
private:
QAbstractItemView *view;
};
#endif
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE
#endif // ACCESSIBLE_ITEMVIEWS_H

View File

@ -44,11 +44,13 @@
#include "simplewidgets.h" #include "simplewidgets.h"
#include "rangecontrols.h" #include "rangecontrols.h"
#include "complexwidgets.h" #include "complexwidgets.h"
#include "itemviews.h"
#include <qaccessibleplugin.h> #include <qaccessibleplugin.h>
#include <qplugin.h> #include <qplugin.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qtoolbutton.h> #include <qtoolbutton.h>
#include <qtreeview.h>
#include <qvariant.h> #include <qvariant.h>
#include <qaccessible.h> #include <qaccessible.h>
@ -56,6 +58,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class AccessibleFactory : public QAccessiblePlugin class AccessibleFactory : public QAccessiblePlugin
{ {
public: public:
@ -251,6 +254,22 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
iface = new QAccessibleMenu(widget); iface = new QAccessibleMenu(widget);
#endif #endif
#ifndef QT_NO_ITEMVIEWS #ifndef QT_NO_ITEMVIEWS
#ifdef Q_WS_X11
} else if (classname == QLatin1String("QAbstractItemView")) {
if (qobject_cast<const QTreeView*>(widget)) {
iface = new QAccessibleTree(widget);
} else {
iface = new QAccessibleTable2(widget);
}
} else if (classname == QLatin1String("QWidget")
&& widget->objectName() == QLatin1String("qt_scrollarea_viewport")
&& qobject_cast<QAbstractItemView*>(widget->parentWidget())) {
if (qobject_cast<const QTreeView*>(widget->parentWidget())) {
iface = new QAccessibleTree(widget->parentWidget());
} else {
iface = new QAccessibleTable2(widget->parentWidget());
}
#else
} else if (classname == QLatin1String("QHeaderView")) { } else if (classname == QLatin1String("QHeaderView")) {
iface = new QAccessibleHeader(widget); iface = new QAccessibleHeader(widget);
} else if (classname == QLatin1String("QAbstractItemView")) { } else if (classname == QLatin1String("QAbstractItemView")) {
@ -259,7 +278,8 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
&& widget->objectName() == QLatin1String("qt_scrollarea_viewport") && widget->objectName() == QLatin1String("qt_scrollarea_viewport")
&& qobject_cast<QAbstractItemView*>(widget->parentWidget())) { && qobject_cast<QAbstractItemView*>(widget->parentWidget())) {
iface = new QAccessibleItemView(widget); iface = new QAccessibleItemView(widget);
#endif #endif // Q_WS_X11
#endif // QT_NO_ITEMVIEWS
#ifndef QT_NO_TABBAR #ifndef QT_NO_TABBAR
} else if (classname == QLatin1String("QTabBar")) { } else if (classname == QLatin1String("QTabBar")) {
iface = new QAccessibleTabBar(widget); iface = new QAccessibleTabBar(widget);

View File

@ -73,6 +73,9 @@ QT_BEGIN_NAMESPACE
using namespace QAccessible2; using namespace QAccessible2;
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel) QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel)
{ {
if (widget == 0) if (widget == 0)
@ -1139,8 +1142,8 @@ int QAccessibleTitleBar::childCount() const
QString QAccessibleTitleBar::text(Text t, int child) const QString QAccessibleTitleBar::text(Text t, int child) const
{ {
if (!child) { if (!child) {
if (t == Value) { if (t == Name || t == Value) {
return dockWidget()->windowTitle(); return qt_accStripAmp(dockWidget()->windowTitle());
} }
} }
return QString(); return QString();
@ -1171,17 +1174,19 @@ QAccessible::State QAccessibleTitleBar::state(int child) const
return state; return state;
} }
QRect QAccessibleTitleBar::rect (int child ) const QRect QAccessibleTitleBar::rect(int child) const
{ {
bool mapToGlobal = true; bool mapToGlobal = true;
QRect rect; QRect rect;
if (child == 0) { if (child == 0) {
if (dockWidget()->isFloating()) { if (dockWidget()->isFloating()) {
rect = dockWidget()->frameGeometry(); rect = dockWidget()->frameGeometry();
QPoint globalPos = dockWidget()->mapToGlobal( dockWidget()->widget()->rect().topLeft() ); if (dockWidget()->widget()) {
QPoint globalPos = dockWidget()->mapToGlobal(dockWidget()->widget()->rect().topLeft());
globalPos.ry()--; globalPos.ry()--;
rect.setBottom(globalPos.y()); rect.setBottom(globalPos.y());
mapToGlobal = false; mapToGlobal = false;
}
} else { } else {
QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(dockWidget()->layout()); QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(dockWidget()->layout());
rect = layout->titleArea(); rect = layout->titleArea();
@ -1316,11 +1321,112 @@ void QAccessibleTextEdit::addSelection(int startOffset, int endOffset)
QString QAccessibleTextEdit::attributes(int offset, int *startOffset, int *endOffset) QString QAccessibleTextEdit::attributes(int offset, int *startOffset, int *endOffset)
{ {
// TODO - wait for a definition of attributes /* The list of attributes can be found at:
Q_UNUSED(offset); http://linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2/textattributes
Q_UNUSED(startOffset); */
Q_UNUSED(endOffset);
if (offset >= characterCount()) {
*startOffset = -1;
*endOffset = -1;
return QString(); return QString();
}
QMap<QString, QString> attrs;
QTextCursor cursor = textEdit()->textCursor();
//cursor.charFormat returns the format of the previous character
cursor.setPosition(offset + 1);
QTextCharFormat charFormat = cursor.charFormat();
cursor.setPosition(offset);
QTextBlockFormat blockFormat = cursor.blockFormat();
QTextCharFormat charFormatComp;
QTextBlockFormat blockFormatComp;
*startOffset = offset;
cursor.setPosition(*startOffset);
while (*startOffset > 0) {
charFormatComp = cursor.charFormat();
cursor.setPosition(*startOffset - 1);
blockFormatComp = cursor.blockFormat();
if ((charFormat == charFormatComp) && (blockFormat == blockFormatComp))
(*startOffset)--;
else
break;
}
int limit = characterCount() + 1;
*endOffset = offset + 1;
cursor.setPosition(*endOffset);
while (*endOffset < limit) {
blockFormatComp = cursor.blockFormat();
cursor.setPosition(*endOffset + 1);
charFormatComp = cursor.charFormat();
if ((charFormat == charFormatComp) && (cursor.blockFormat() == blockFormatComp))
(*endOffset)++;
else
break;
}
QString family = charFormat.fontFamily();
if (!family.isEmpty()) {
family = family.replace('\\',"\\\\");
family = family.replace(':',"\\:");
family = family.replace(',',"\\,");
family = family.replace('=',"\\=");
family = family.replace(';',"\\;");
family = family.replace('\"',"\\\"");
attrs["font-family"] = '"'+family+'"';
}
int fontSize = int(charFormat.fontPointSize());
if (fontSize)
attrs["font-size"] = QString::number(fontSize).append("pt");
//Different weight values are not handled
attrs["font-weight"] = (charFormat.fontWeight() > QFont::Normal) ? "bold" : "normal";
QFont::Style style = charFormat.font().style();
attrs["font-style"] = (style == QFont::StyleItalic) ? "italic" : ((style == QFont::StyleOblique) ? "oblique": "normal");
attrs["text-underline-style"] = charFormat.font().underline() ? "solid" : "none";
QTextCharFormat::VerticalAlignment alignment = charFormat.verticalAlignment();
attrs["text-position"] = (alignment == QTextCharFormat::AlignSubScript) ? "sub" : ((alignment == QTextCharFormat::AlignSuperScript) ? "super" : "baseline" );
QBrush background = charFormat.background();
if (background.style() == Qt::SolidPattern) {
attrs["background-color"] = QString("rgb(%1,%2,%3)").arg(background.color().red()).arg(background.color().green()).arg(background.color().blue());
}
QBrush foreground = charFormat.foreground();
if (foreground.style() == Qt::SolidPattern) {
attrs["color"] = QString("rgb(%1,%2,%3)").arg(foreground.color().red()).arg(foreground.color().green()).arg(foreground.color().blue());
}
switch (blockFormat.alignment() & (Qt::AlignLeft | Qt::AlignRight | Qt::AlignHCenter | Qt::AlignJustify)) {
case Qt::AlignLeft:
attrs["text-align"] = "left";
break;
case Qt::AlignRight:
attrs["text-align"] = "right";
break;
case Qt::AlignHCenter:
attrs["text-align"] = "center";
break;
case Qt::AlignJustify:
attrs["text-align"] = "left";
break;
}
QString result;
foreach (const QString &attributeName, attrs.keys()) {
result.append(attributeName).append(':').append(attrs[attributeName]).append(';');
}
return result;
} }
int QAccessibleTextEdit::cursorPosition() int QAccessibleTextEdit::cursorPosition()
@ -1435,9 +1541,9 @@ QString QAccessibleTextEdit::textAtOffset(int offset, BoundaryType boundaryType,
if (offset >= characterCount()) if (offset >= characterCount())
return QString(); return QString();
cursor.setPosition(offset);
switch (boundaryType) { switch (boundaryType) {
case CharBoundary: case CharBoundary:
cursor.setPosition(offset);
*startOffset = cursor.position(); *startOffset = cursor.position();
cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
*endOffset = cursor.position(); *endOffset = cursor.position();

View File

@ -83,8 +83,6 @@ QAbstractSpinBox *QAccessibleAbstractSpinBox::abstractSpinBox() const
/*! \reimp */ /*! \reimp */
int QAccessibleAbstractSpinBox::childCount() const int QAccessibleAbstractSpinBox::childCount() const
{ {
if (!abstractSpinBox()->isVisible())
return 0;
return ValueDown; return ValueDown;
} }
@ -344,8 +342,6 @@ QDoubleSpinBox *QAccessibleDoubleSpinBox::doubleSpinBox() const
/*! \reimp */ /*! \reimp */
int QAccessibleDoubleSpinBox::childCount() const int QAccessibleDoubleSpinBox::childCount() const
{ {
if (!doubleSpinBox()->isVisible())
return 0;
return ValueDown; return ValueDown;
} }
@ -410,8 +406,6 @@ QVariant QAccessibleDoubleSpinBox::invokeMethodEx(QAccessible::Method, int, cons
/*! \reimp */ /*! \reimp */
QString QAccessibleDoubleSpinBox::text(Text textType, int child) const QString QAccessibleDoubleSpinBox::text(Text textType, int child) const
{ {
if (!doubleSpinBox()->isVisible())
return QString();
switch (textType) { switch (textType) {
case Name: case Name:
if (child == ValueUp) if (child == ValueUp)
@ -540,16 +534,12 @@ QRect QAccessibleScrollBar::rect(int child) const
/*! \reimp */ /*! \reimp */
int QAccessibleScrollBar::childCount() const int QAccessibleScrollBar::childCount() const
{ {
if (!scrollBar()->isVisible())
return 0;
return LineDown; return LineDown;
} }
/*! \reimp */ /*! \reimp */
QString QAccessibleScrollBar::text(Text t, int child) const QString QAccessibleScrollBar::text(Text t, int child) const
{ {
if (!scrollBar()->isVisible())
return QString();
switch (t) { switch (t) {
case Value: case Value:
if (!child || child == Position) if (!child || child == Position)
@ -698,16 +688,12 @@ QRect QAccessibleSlider::rect(int child) const
/*! \reimp */ /*! \reimp */
int QAccessibleSlider::childCount() const int QAccessibleSlider::childCount() const
{ {
if (!slider()->isVisible())
return 0;
return PageRight; return PageRight;
} }
/*! \reimp */ /*! \reimp */
QString QAccessibleSlider::text(Text t, int child) const QString QAccessibleSlider::text(Text t, int child) const
{ {
if (!slider()->isVisible())
return QString();
switch (t) { switch (t) {
case Value: case Value:
if (!child || child == 2) if (!child || child == 2)
@ -932,15 +918,11 @@ QRect QAccessibleDial::rect(int child) const
int QAccessibleDial::childCount() const int QAccessibleDial::childCount() const
{ {
if (!dial()->isVisible())
return 0;
return SliderHandle; return SliderHandle;
} }
QString QAccessibleDial::text(Text textType, int child) const QString QAccessibleDial::text(Text textType, int child) const
{ {
if (!dial()->isVisible())
return QString();
if (textType == Value && child >= Self && child <= SliderHandle) if (textType == Value && child >= Self && child <= SliderHandle)
return QString::number(dial()->value()); return QString::number(dial()->value());
if (textType == Name) { if (textType == Name) {

View File

@ -68,6 +68,13 @@ extern QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text); QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
QString Q_GUI_EXPORT qt_accHotKey(const QString &text); QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
int *startOffset, int *endOffset, const QString& text);
QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
int *startOffset, int *endOffset, const QString& text);
QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
int *startOffset, int *endOffset, const QString& text);
/*! /*!
\class QAccessibleButton \class QAccessibleButton
\brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets. \brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets.
@ -176,7 +183,7 @@ QString QAccessibleButton::text(Text t, int child) const
break; break;
} }
if (str.isEmpty()) if (str.isEmpty())
str = QAccessibleWidgetEx::text(t, child);; str = QAccessibleWidgetEx::text(t, child);
return qt_accStripAmp(str); return qt_accStripAmp(str);
} }
@ -396,7 +403,7 @@ QString QAccessibleToolButton::text(Text t, int child) const
QString str; QString str;
switch (t) { switch (t) {
case Name: case Name:
str = toolButton()->text(); str = toolButton()->accessibleName();
if (str.isEmpty()) if (str.isEmpty())
str = toolButton()->text(); str = toolButton()->text();
break; break;
@ -703,7 +710,14 @@ void QAccessibleLineEdit::setText(Text t, int control, const QString &text)
QAccessibleWidgetEx::setText(t, control, text); QAccessibleWidgetEx::setText(t, control, text);
return; return;
} }
lineEdit()->setText(text);
QString newText = text;
if (lineEdit()->validator()) {
int pos = 0;
if (lineEdit()->validator()->validate(newText, pos) != QValidator::Acceptable)
return;
}
lineEdit()->setText(newText);
} }
/*! \reimp */ /*! \reimp */
@ -801,28 +815,41 @@ QString QAccessibleLineEdit::text(int startOffset, int endOffset)
{ {
if (startOffset > endOffset) if (startOffset > endOffset)
return QString(); return QString();
if (lineEdit()->echoMode() != QLineEdit::Normal)
return QString();
return lineEdit()->text().mid(startOffset, endOffset - startOffset); return lineEdit()->text().mid(startOffset, endOffset - startOffset);
} }
QString QAccessibleLineEdit::textBeforeOffset (int /*offset*/, BoundaryType /*boundaryType*/, QString QAccessibleLineEdit::textBeforeOffset(int offset, BoundaryType boundaryType,
int * /*startOffset*/, int * /*endOffset*/) int *startOffset, int *endOffset)
{ {
// TODO if (lineEdit()->echoMode() != QLineEdit::Normal) {
*startOffset = *endOffset = -1;
return QString(); return QString();
}
return qTextBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
} }
QString QAccessibleLineEdit::textAfterOffset(int /*offset*/, BoundaryType /*boundaryType*/, QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryType,
int * /*startOffset*/, int * /*endOffset*/) int *startOffset, int *endOffset)
{ {
// TODO if (lineEdit()->echoMode() != QLineEdit::Normal) {
*startOffset = *endOffset = -1;
return QString(); return QString();
}
return qTextAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
} }
QString QAccessibleLineEdit::textAtOffset(int /*offset*/, BoundaryType /*boundaryType*/, QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType,
int * /*startOffset*/, int * /*endOffset*/) int *startOffset, int *endOffset)
{ {
// TODO if (lineEdit()->echoMode() != QLineEdit::Normal) {
*startOffset = *endOffset = -1;
return QString(); return QString();
}
return qTextAtOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
} }
void QAccessibleLineEdit::removeSelection(int selectionIndex) void QAccessibleLineEdit::removeSelection(int selectionIndex)

View File

@ -12,10 +12,14 @@ SOURCES += main.cpp \
rangecontrols.cpp \ rangecontrols.cpp \
complexwidgets.cpp \ complexwidgets.cpp \
qaccessiblewidgets.cpp \ qaccessiblewidgets.cpp \
qaccessiblemenu.cpp qaccessiblemenu.cpp \
itemviews.cpp
HEADERS += qaccessiblewidgets.h \ HEADERS += qaccessiblewidgets.h \
simplewidgets.h \ simplewidgets.h \
rangecontrols.h \ rangecontrols.h \
complexwidgets.h \ complexwidgets.h \
qaccessiblemenu.h qaccessiblemenu.h \
itemviews.h

View File

@ -42,6 +42,7 @@
#include "qwaylandclipboard.h" #include "qwaylandclipboard.h"
#include "qwaylanddisplay.h" #include "qwaylanddisplay.h"
#include "qwaylandinputdevice.h" #include "qwaylandinputdevice.h"
#include "qwaylandmime.h"
#include <QtGui/QPlatformNativeInterface> #include <QtGui/QPlatformNativeInterface>
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtCore/QMimeData> #include <QtCore/QMimeData>
@ -49,10 +50,11 @@
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QtDebug> #include <QtCore/QtDebug>
#include <QtGui/private/qdnd_p.h> #include <QtGui/private/qdnd_p.h>
#include <QtCore/private/qcore_unix_p.h> // for QT_READ
static QWaylandClipboard *clipboard = 0; static QWaylandClipboard *clipboard = 0;
class QWaylandMimeData : public QInternalMimeData class QWaylandClipboardMimeData : public QInternalMimeData
{ {
public: public:
void clearAll(); void clearAll();
@ -64,28 +66,28 @@ private:
QStringList mFormatList; QStringList mFormatList;
}; };
void QWaylandMimeData::clearAll() void QWaylandClipboardMimeData::clearAll()
{ {
clear(); clear();
mFormatList.clear(); mFormatList.clear();
} }
void QWaylandMimeData::setFormats(const QStringList &formatList) void QWaylandClipboardMimeData::setFormats(const QStringList &formatList)
{ {
mFormatList = formatList; mFormatList = formatList;
} }
bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const bool QWaylandClipboardMimeData::hasFormat_sys(const QString &mimeType) const
{ {
return formats().contains(mimeType); return formats().contains(mimeType);
} }
QStringList QWaylandMimeData::formats_sys() const QStringList QWaylandClipboardMimeData::formats_sys() const
{ {
return mFormatList; return mFormatList;
} }
QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const QVariant QWaylandClipboardMimeData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const
{ {
return clipboard->retrieveData(mimeType, type); return clipboard->retrieveData(mimeType, type);
} }
@ -147,7 +149,7 @@ void QWaylandSelection::send(void *data,
Q_UNUSED(selection); Q_UNUSED(selection);
QWaylandSelection *self = static_cast<QWaylandSelection *>(data); QWaylandSelection *self = static_cast<QWaylandSelection *>(data);
QString mimeType = QString::fromLatin1(mime_type); QString mimeType = QString::fromLatin1(mime_type);
QByteArray content = self->mMimeData->data(mimeType); QByteArray content = QWaylandMimeHelper::getByteArray(self->mMimeData, mimeType);
if (!content.isEmpty()) { if (!content.isEmpty()) {
QFile f; QFile f;
if (f.open(fd, QIODevice::WriteOnly)) if (f.open(fd, QIODevice::WriteOnly))
@ -218,7 +220,7 @@ QVariant QWaylandClipboard::retrieveData(const QString &mimeType, QVariant::Type
char buf[256]; char buf[256];
int n; int n;
close(pipefd[1]); close(pipefd[1]);
while ((n = read(pipefd[0], &buf, sizeof buf)) > 0) while ((n = QT_READ(pipefd[0], &buf, sizeof buf)) > 0)
content.append(buf, n); content.append(buf, n);
close(pipefd[0]); close(pipefd[0]);
return content; return content;
@ -230,7 +232,7 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
if (!mSelections.isEmpty()) if (!mSelections.isEmpty())
return mSelections.last()->mMimeData; return mSelections.last()->mMimeData;
if (!mMimeDataIn) if (!mMimeDataIn)
mMimeDataIn = new QWaylandMimeData; mMimeDataIn = new QWaylandClipboardMimeData;
mMimeDataIn->clearAll(); mMimeDataIn->clearAll();
if (!mOfferedMimeTypes.isEmpty() && mOffer) if (!mOfferedMimeTypes.isEmpty() && mOffer)
mMimeDataIn->setFormats(mOfferedMimeTypes); mMimeDataIn->setFormats(mOfferedMimeTypes);

View File

@ -48,7 +48,7 @@
class QWaylandDisplay; class QWaylandDisplay;
class QWaylandSelection; class QWaylandSelection;
class QWaylandMimeData; class QWaylandClipboardMimeData;
struct wl_selection_offer; struct wl_selection_offer;
class QWaylandClipboardSignalEmitter : public QObject class QWaylandClipboardSignalEmitter : public QObject
@ -90,7 +90,7 @@ private:
static void forceRoundtrip(struct wl_display *display); static void forceRoundtrip(struct wl_display *display);
QWaylandDisplay *mDisplay; QWaylandDisplay *mDisplay;
QWaylandMimeData *mMimeDataIn; QWaylandClipboardMimeData *mMimeDataIn;
QList<QWaylandSelection *> mSelections; QList<QWaylandSelection *> mSelections;
QStringList mOfferedMimeTypes; QStringList mOfferedMimeTypes;
struct wl_selection_offer *mOffer; struct wl_selection_offer *mOffer;

View File

@ -0,0 +1,83 @@
/****************************************************************************
**
** 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 plugins 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 "qwaylandmime.h"
#include <QImage>
#include <QColor>
#include <QUrl>
#include <QBuffer>
#include <QImageWriter>
QByteArray QWaylandMimeHelper::getByteArray(QMimeData *mimeData, const QString &mimeType)
{
QByteArray content;
if (mimeType == QLatin1String("text/plain")) {
content = mimeData->text().toUtf8();
} else if (mimeData->hasImage()
&& (mimeType == QLatin1String("application/x-qt-image")
|| mimeType.startsWith("image/"))) {
QImage image = qvariant_cast<QImage>(mimeData->imageData());
if (!image.isNull()) {
QBuffer buf;
buf.open(QIODevice::ReadWrite);
QByteArray fmt = "BMP";
if (mimeType.startsWith("image/")) {
QByteArray imgFmt = mimeType.mid(6).toUpper().toAscii();
if (QImageWriter::supportedImageFormats().contains(imgFmt))
fmt = imgFmt;
}
QImageWriter wr(&buf, fmt);
wr.write(image);
content = buf.buffer();
}
} else if (mimeType == QLatin1String("application/x-color")) {
content = qvariant_cast<QColor>(mimeData->colorData()).name().toAscii();
} else if (mimeType == QLatin1String("text/uri-list")) {
QList<QUrl> urls = mimeData->urls();
for (int i = 0; i < urls.count(); ++i) {
content.append(urls.at(i).toEncoded());
content.append('\n');
}
} else {
content = mimeData->data(mimeType);
}
return content;
}

View File

@ -0,0 +1,55 @@
/****************************************************************************
**
** 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 plugins 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$
**
****************************************************************************/
#ifndef QWAYLANDMIME_H
#define QWAYLANDMIME_H
#include <QString>
#include <QByteArray>
#include <QMimeData>
class QWaylandMimeHelper
{
public:
static QByteArray getByteArray(QMimeData *mimeData, const QString &mimeType);
};
#endif

View File

@ -25,7 +25,8 @@ SOURCES = main.cpp \
qwaylandscreen.cpp \ qwaylandscreen.cpp \
qwaylandshmwindow.cpp \ qwaylandshmwindow.cpp \
qwaylandclipboard.cpp \ qwaylandclipboard.cpp \
qwaylanddnd.cpp qwaylanddnd.cpp \
qwaylandmime.cpp
HEADERS = qwaylandintegration.h \ HEADERS = qwaylandintegration.h \
qwaylandnativeinterface.h \ qwaylandnativeinterface.h \
@ -37,7 +38,8 @@ HEADERS = qwaylandintegration.h \
qwaylandbuffer.h \ qwaylandbuffer.h \
qwaylandshmwindow.h \ qwaylandshmwindow.h \
qwaylandclipboard.h \ qwaylandclipboard.h \
qwaylanddnd.h qwaylanddnd.h \
qwaylandmime.h
INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND
LIBS += $$QMAKE_LIBS_WAYLAND LIBS += $$QMAKE_LIBS_WAYLAND

View File

@ -53,7 +53,17 @@
#include "qdri2context.h" #include "qdri2context.h"
#endif #endif
#define class class_name // Yeah, in 2011 ...
#include <xcb/xcb_icccm.h> #include <xcb/xcb_icccm.h>
#undef class
// xcb-icccm 3.8 support
#ifdef XCB_ICCCM_NUM_WM_SIZE_HINTS_ELEMENTS
#define xcb_wm_hints_t xcb_icccm_wm_hints_t
#define xcb_wm_hints_set_iconic xcb_icccm_wm_hints_set_iconic
#define xcb_wm_hints_set_normal xcb_icccm_wm_hints_set_normal
#define xcb_set_wm_hints xcb_icccm_set_wm_hints
#endif
#include <private/qguiapplication_p.h> #include <private/qguiapplication_p.h>
#include <private/qwindow_p.h> #include <private/qwindow_p.h>

View File

@ -123,6 +123,26 @@ QSqlError& QSqlError::operator=(const QSqlError& other)
return *this; return *this;
} }
/*!
Compare the \a other error's values to this error and returns true, if it equal.
*/
bool QSqlError::operator==(const QSqlError& other)
{
return (errorType == other.errorType);
}
/*!
Compare the \a other error's values to this error and returns true if it is not equal.
*/
bool QSqlError::operator!=(const QSqlError& other)
{
return (errorType != other.errorType);
}
/*! /*!
Destroys the object and frees any allocated resources. Destroys the object and frees any allocated resources.
*/ */

View File

@ -66,6 +66,8 @@ public:
int number = -1); int number = -1);
QSqlError(const QSqlError& other); QSqlError(const QSqlError& other);
QSqlError& operator=(const QSqlError& other); QSqlError& operator=(const QSqlError& other);
bool operator==(const QSqlError& other);
bool operator!=(const QSqlError& other);
~QSqlError(); ~QSqlError();
QString driverText() const; QString driverText() const;

View File

@ -1076,9 +1076,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
" -minimumvalue n : Sets the minimum acceptable measurement value\n" " -minimumvalue n : Sets the minimum acceptable measurement value\n"
" -iterations n : Sets the number of accumulation iterations.\n" " -iterations n : Sets the number of accumulation iterations.\n"
" -median n : Sets the number of median iterations.\n" " -median n : Sets the number of median iterations.\n"
" -vb : Print out verbose benchmarking information.\n" " -vb : Print out verbose benchmarking information.\n";
"\n"
" -help : This help\n";
for (int i = 1; i < argc; ++i) { for (int i = 1; i < argc; ++i) {
if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "--help") == 0 if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "--help") == 0
@ -1086,6 +1084,17 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
printf(" Usage: %s [options] [testfunction[:testdata]]...\n" printf(" Usage: %s [options] [testfunction[:testdata]]...\n"
" By default, all testfunctions will be run.\n\n" " By default, all testfunctions will be run.\n\n"
"%s", argv[0], testOptions); "%s", argv[0], testOptions);
if (qml) {
printf ("\nqmltest related options:\n"
" -import : Specify an import directory.\n"
" -input : Specify the root directory for test cases.\n"
" -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
);
}
printf("\n"
" -help : This help\n");
exit(0); exit(0);
} else if (strcmp(argv[i], "-functions") == 0) { } else if (strcmp(argv[i], "-functions") == 0) {
if (qml) { if (qml) {
@ -1228,6 +1237,16 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
} }
} else if (argv[i][0] == '-') { } else if (argv[i][0] == '-') {
printf("Unknown option: '%s'\n\n%s", argv[i], testOptions); printf("Unknown option: '%s'\n\n%s", argv[i], testOptions);
if (qml) {
printf ("\nqmltest related options:\n"
" -import : Specify an import directory.\n"
" -input : Specify the root directory for test cases.\n"
" -qtquick1 : Run with QtQuick 1 rather than QtQuick 2.\n"
);
}
printf("\n"
" -help : This help\n");
exit(1); exit(1);
} else if (qml) { } else if (qml) {
// We can't check the availability of test functions until // We can't check the availability of test functions until

View File

@ -76,12 +76,9 @@ namespace QTest
#if defined(Q_WS_X11) #if defined(Q_WS_X11)
qt_x11_wait_for_window_manager(window); qt_x11_wait_for_window_manager(window);
QCoreApplication::processEvents(); QCoreApplication::processEvents();
#elif defined(Q_WS_QWS)
Q_UNUSED(window);
qWait(100);
#else #else
Q_UNUSED(window); Q_UNUSED(window);
qWait(50); qWait(200);
#endif #endif
return true; return true;
} }

File diff suppressed because it is too large Load Diff

View File

@ -62,17 +62,8 @@
#include <QtCore/QXmlStreamWriter> #include <QtCore/QXmlStreamWriter>
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#if defined(QT_UIC3)
#define QUILOADER_QDOM_READ
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifdef QUILOADER_QDOM_READ
class QDomElement;
#endif
#define QDESIGNER_UILIB_EXTERN Q_DECL_EXPORT #define QDESIGNER_UILIB_EXTERN Q_DECL_EXPORT
#define QDESIGNER_UILIB_IMPORT Q_DECL_IMPORT #define QDESIGNER_UILIB_IMPORT Q_DECL_IMPORT
@ -174,9 +165,6 @@ public:
~DomUI(); ~DomUI();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -374,9 +362,6 @@ public:
~DomIncludes(); ~DomIncludes();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -408,9 +393,6 @@ public:
~DomInclude(); ~DomInclude();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -451,9 +433,6 @@ public:
~DomResources(); ~DomResources();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -493,9 +472,6 @@ public:
~DomResource(); ~DomResource();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -528,9 +504,6 @@ public:
~DomActionGroup(); ~DomActionGroup();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -585,9 +558,6 @@ public:
~DomAction(); ~DomAction();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -640,9 +610,6 @@ public:
~DomActionRef(); ~DomActionRef();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -675,9 +642,6 @@ public:
~DomButtonGroup(); ~DomButtonGroup();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -722,9 +686,6 @@ public:
~DomButtonGroups(); ~DomButtonGroups();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -756,9 +717,6 @@ public:
~DomImages(); ~DomImages();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -790,9 +748,6 @@ public:
~DomImage(); ~DomImage();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -835,9 +790,6 @@ public:
~DomImageData(); ~DomImageData();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -878,9 +830,6 @@ public:
~DomCustomWidgets(); ~DomCustomWidgets();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -912,9 +861,6 @@ public:
~DomHeader(); ~DomHeader();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -947,9 +893,6 @@ public:
~DomCustomWidget(); ~DomCustomWidget();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1067,9 +1010,6 @@ public:
~DomProperties(); ~DomProperties();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1101,9 +1041,6 @@ public:
~DomPropertyData(); ~DomPropertyData();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1136,9 +1073,6 @@ public:
~DomSizePolicyData(); ~DomSizePolicyData();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1179,9 +1113,6 @@ public:
~DomLayoutDefault(); ~DomLayoutDefault();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1222,9 +1153,6 @@ public:
~DomLayoutFunction(); ~DomLayoutFunction();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1265,9 +1193,6 @@ public:
~DomTabStops(); ~DomTabStops();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1299,9 +1224,6 @@ public:
~DomLayout(); ~DomLayout();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1399,9 +1321,6 @@ public:
~DomLayoutItem(); ~DomLayoutItem();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1484,9 +1403,6 @@ public:
~DomRow(); ~DomRow();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1518,9 +1434,6 @@ public:
~DomColumn(); ~DomColumn();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1552,9 +1465,6 @@ public:
~DomItem(); ~DomItem();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1607,9 +1517,6 @@ public:
~DomWidget(); ~DomWidget();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1730,9 +1637,6 @@ public:
~DomSpacer(); ~DomSpacer();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1772,9 +1676,6 @@ public:
~DomColor(); ~DomColor();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1830,9 +1731,6 @@ public:
~DomGradientStop(); ~DomGradientStop();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -1875,9 +1773,6 @@ public:
~DomGradient(); ~DomGradient();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2013,9 +1908,6 @@ public:
~DomBrush(); ~DomBrush();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2066,9 +1958,6 @@ public:
~DomColorRole(); ~DomColorRole();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2111,9 +2000,6 @@ public:
~DomColorGroup(); ~DomColorGroup();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2150,9 +2036,6 @@ public:
~DomPalette(); ~DomPalette();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2203,9 +2086,6 @@ public:
~DomFont(); ~DomFont();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2302,9 +2182,6 @@ public:
~DomPoint(); ~DomPoint();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2345,9 +2222,6 @@ public:
~DomRect(); ~DomRect();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2402,9 +2276,6 @@ public:
~DomLocale(); ~DomLocale();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2445,9 +2316,6 @@ public:
~DomSizePolicy(); ~DomSizePolicy();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2518,9 +2386,6 @@ public:
~DomSize(); ~DomSize();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2561,9 +2426,6 @@ public:
~DomDate(); ~DomDate();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2611,9 +2473,6 @@ public:
~DomTime(); ~DomTime();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2661,9 +2520,6 @@ public:
~DomDateTime(); ~DomDateTime();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2732,9 +2588,6 @@ public:
~DomStringList(); ~DomStringList();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2766,9 +2619,6 @@ public:
~DomResourcePixmap(); ~DomResourcePixmap();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2809,9 +2659,6 @@ public:
~DomResourceIcon(); ~DomResourceIcon();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2918,9 +2765,6 @@ public:
~DomString(); ~DomString();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -2969,9 +2813,6 @@ public:
~DomPointF(); ~DomPointF();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3012,9 +2853,6 @@ public:
~DomRectF(); ~DomRectF();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3069,9 +2907,6 @@ public:
~DomSizeF(); ~DomSizeF();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3112,9 +2947,6 @@ public:
~DomChar(); ~DomChar();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3148,9 +2980,6 @@ public:
~DomUrl(); ~DomUrl();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3185,9 +3014,6 @@ public:
~DomProperty(); ~DomProperty();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3384,9 +3210,6 @@ public:
~DomConnections(); ~DomConnections();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3418,9 +3241,6 @@ public:
~DomConnection(); ~DomConnection();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3483,9 +3303,6 @@ public:
~DomConnectionHints(); ~DomConnectionHints();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3517,9 +3334,6 @@ public:
~DomConnectionHint(); ~DomConnectionHint();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3568,9 +3382,6 @@ public:
~DomScript(); ~DomScript();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3611,9 +3422,6 @@ public:
~DomWidgetData(); ~DomWidgetData();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3645,9 +3453,6 @@ public:
~DomDesignerData(); ~DomDesignerData();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3679,9 +3484,6 @@ public:
~DomSlots(); ~DomSlots();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3718,9 +3520,6 @@ public:
~DomPropertySpecifications(); ~DomPropertySpecifications();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }
@ -3752,9 +3551,6 @@ public:
~DomStringPropertySpecification(); ~DomStringPropertySpecification();
void read(QXmlStreamReader &reader); void read(QXmlStreamReader &reader);
#ifdef QUILOADER_QDOM_READ
void read(const QDomElement &node);
#endif
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
inline QString text() const { return m_text; } inline QString text() const { return m_text; }
inline void setText(const QString &s) { m_text = s; } inline void setText(const QString &s) { m_text = s; }

View File

@ -1,7 +1,7 @@
QPRO_PWD = $$PWD QPRO_PWD = $$PWD
TEMPLATE = lib TEMPLATE = lib
TARGET = $$qtLibraryTarget(QtUiTools) TARGET = $$qtLibraryTarget(QtUiTools)
QT = core xml QT = core
CONFIG += qt staticlib module CONFIG += qt staticlib module
MODULE = uitools MODULE = uitools
@ -56,5 +56,4 @@ unix|win32-g++* {
QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS] QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
QMAKE_PKGCONFIG_DESTDIR = pkgconfig QMAKE_PKGCONFIG_DESTDIR = pkgconfig
QMAKE_PKGCONFIG_REQUIRES += QtXml
} }

View File

@ -1047,6 +1047,11 @@ const QAccessibleInterface *other, int otherChild) const
\internal \internal
*/ */
/*!
\fn QAccessibleTable2Interface *QAccessibleInterface::table2Interface()
\internal
*/
/*! /*!
\fn QAccessibleActionInterface *QAccessibleInterface::actionInterface() \fn QAccessibleActionInterface *QAccessibleInterface::actionInterface()
\internal \internal

View File

@ -151,6 +151,7 @@ public:
ReadOnly = 0x00000040, ReadOnly = 0x00000040,
HotTracked = 0x00000080, HotTracked = 0x00000080,
DefaultButton = 0x00000100, DefaultButton = 0x00000100,
// #### Qt5 Expandable
Expanded = 0x00000200, Expanded = 0x00000200,
Collapsed = 0x00000400, Collapsed = 0x00000400,
Busy = 0x00000800, Busy = 0x00000800,
@ -175,6 +176,8 @@ public:
HasPopup = 0x40000000, HasPopup = 0x40000000,
Modal = 0x80000000, Modal = 0x80000000,
// #### Qt5 ManagesDescendants
// #### Qt5 remove HasInvokeExtension
HasInvokeExtension = 0x10000000 // internal HasInvokeExtension = 0x10000000 // internal
}; };
Q_DECLARE_FLAGS(State, StateFlag) Q_DECLARE_FLAGS(State, StateFlag)
@ -345,7 +348,8 @@ namespace QAccessible2
ValueInterface, ValueInterface,
TableInterface, TableInterface,
ActionInterface, ActionInterface,
ImageInterface ImageInterface,
Table2Interface
}; };
} }
@ -356,6 +360,7 @@ class QAccessibleValueInterface;
class QAccessibleTableInterface; class QAccessibleTableInterface;
class QAccessibleActionInterface; class QAccessibleActionInterface;
class QAccessibleImageInterface; class QAccessibleImageInterface;
class QAccessibleTable2Interface;
class Q_WIDGETS_EXPORT QAccessibleInterface : public QAccessible class Q_WIDGETS_EXPORT QAccessibleInterface : public QAccessible
{ {
@ -419,6 +424,9 @@ public:
inline QAccessibleImageInterface *imageInterface() inline QAccessibleImageInterface *imageInterface()
{ return reinterpret_cast<QAccessibleImageInterface *>(cast_helper(QAccessible2::ImageInterface)); } { return reinterpret_cast<QAccessibleImageInterface *>(cast_helper(QAccessible2::ImageInterface)); }
inline QAccessibleTable2Interface *table2Interface()
{ return reinterpret_cast<QAccessibleTable2Interface *>(cast_helper(QAccessible2::Table2Interface)); }
private: private:
QAccessible2Interface *cast_helper(QAccessible2::InterfaceType); QAccessible2Interface *cast_helper(QAccessible2::InterfaceType);
}; };

View File

@ -42,6 +42,7 @@
#include "qaccessible2.h" #include "qaccessible2.h"
#include "qapplication.h" #include "qapplication.h"
#include "qclipboard.h" #include "qclipboard.h"
#include "qtextboundaryfinder.h"
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
@ -132,6 +133,117 @@ QT_BEGIN_NAMESPACE
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink \link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/ */
/*!
\internal
*/
QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
int *startOffset, int *endOffset, const QString& text)
{
QTextBoundaryFinder::BoundaryType type;
switch (boundaryType) {
case QAccessible2::CharBoundary:
type = QTextBoundaryFinder::Grapheme;
break;
case QAccessible2::WordBoundary:
type = QTextBoundaryFinder::Word;
break;
case QAccessible2::SentenceBoundary:
type = QTextBoundaryFinder::Sentence;
break;
default:
// in any other case return the whole line
*startOffset = 0;
*endOffset = text.length();
return text;
}
QTextBoundaryFinder boundary(type, text);
boundary.setPosition(offset);
if (!boundary.isAtBoundary()) {
boundary.toPreviousBoundary();
}
boundary.toPreviousBoundary();
*startOffset = boundary.position();
boundary.toNextBoundary();
*endOffset = boundary.position();
return text.mid(*startOffset, *endOffset - *startOffset);
}
/*!
\internal
*/
QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
int *startOffset, int *endOffset, const QString& text)
{
QTextBoundaryFinder::BoundaryType type;
switch (boundaryType) {
case QAccessible2::CharBoundary:
type = QTextBoundaryFinder::Grapheme;
break;
case QAccessible2::WordBoundary:
type = QTextBoundaryFinder::Word;
break;
case QAccessible2::SentenceBoundary:
type = QTextBoundaryFinder::Sentence;
break;
default:
// in any other case return the whole line
*startOffset = 0;
*endOffset = text.length();
return text;
}
QTextBoundaryFinder boundary(type, text);
boundary.setPosition(offset);
boundary.toNextBoundary();
*startOffset = boundary.position();
boundary.toNextBoundary();
*endOffset = boundary.position();
return text.mid(*startOffset, *endOffset - *startOffset);
}
/*!
\internal
*/
QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType,
int *startOffset, int *endOffset, const QString& text)
{
QTextBoundaryFinder::BoundaryType type;
switch (boundaryType) {
case QAccessible2::CharBoundary:
type = QTextBoundaryFinder::Grapheme;
break;
case QAccessible2::WordBoundary:
type = QTextBoundaryFinder::Word;
break;
case QAccessible2::SentenceBoundary:
type = QTextBoundaryFinder::Sentence;
break;
default:
// in any other case return the whole line
*startOffset = 0;
*endOffset = text.length();
return text;
}
QTextBoundaryFinder boundary(type, text);
boundary.setPosition(offset);
if (!boundary.isAtBoundary()) {
boundary.toPreviousBoundary();
}
*startOffset = boundary.position();
boundary.toNextBoundary();
*endOffset = boundary.position();
return text.mid(*startOffset, *endOffset - *startOffset);
}
QAccessibleSimpleEditableTextInterface::QAccessibleSimpleEditableTextInterface( QAccessibleSimpleEditableTextInterface::QAccessibleSimpleEditableTextInterface(
QAccessibleInterface *accessibleInterface) QAccessibleInterface *accessibleInterface)
: iface(accessibleInterface) : iface(accessibleInterface)

View File

@ -52,6 +52,8 @@ QT_MODULE(Gui)
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
class QModelIndex;
namespace QAccessible2 namespace QAccessible2
{ {
enum CoordinateType enum CoordinateType
@ -68,6 +70,24 @@ namespace QAccessible2
LineBoundary, LineBoundary,
NoBoundary NoBoundary
}; };
enum TableModelChangeType {
TableModelChangeInsert,
TableModelChangeDelete,
TableModelChangeUpdate
};
struct TableModelChange {
int firstColumn;
int firstRow;
int lastColumn;
int lastRow;
TableModelChangeType type;
TableModelChange()
: firstColumn(0), firstRow(0), lastColumn(0), lastRow(0), type(TableModelChangeUpdate)
{}
};
} }
class Q_WIDGETS_EXPORT QAccessible2Interface class Q_WIDGETS_EXPORT QAccessible2Interface
@ -83,6 +103,7 @@ inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return 0; }
inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; } inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; }
inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; } inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; }
inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; } inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; }
inline QAccessible2Interface *qAccessibleTable2CastHelper() { return 0; }
#define Q_ACCESSIBLE_OBJECT \ #define Q_ACCESSIBLE_OBJECT \
public: \ public: \
@ -101,6 +122,8 @@ inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; }
return qAccessibleActionCastHelper(); \ return qAccessibleActionCastHelper(); \
case QAccessible2::ImageInterface: \ case QAccessible2::ImageInterface: \
return qAccessibleImageCastHelper(); \ return qAccessibleImageCastHelper(); \
case QAccessible2::Table2Interface: \
return qAccessibleTable2CastHelper(); \
} \ } \
return 0; \ return 0; \
} \ } \
@ -214,6 +237,95 @@ public:
int *columnSpan, bool *isSelected) = 0; int *columnSpan, bool *isSelected) = 0;
}; };
class Q_WIDGETS_EXPORT QAccessibleTable2CellInterface: public QAccessibleInterface
{
public:
// Returns the number of columns occupied by this cell accessible.
virtual int columnExtent() const = 0;
// Returns the column headers as an array of cell accessibles.
virtual QList<QAccessibleInterface*> columnHeaderCells() const = 0;
// Translates this cell accessible into the corresponding column index.
virtual int columnIndex() const = 0;
// Returns the number of rows occupied by this cell accessible.
virtual int rowExtent() const = 0;
// Returns the row headers as an array of cell accessibles.
virtual QList<QAccessibleInterface*> rowHeaderCells() const = 0;
// Translates this cell accessible into the corresponding row index.
virtual int rowIndex() const = 0;
// Returns a boolean value indicating whether this cell is selected.
virtual bool isSelected() const = 0;
// Gets the row and column indexes and extents of this cell accessible and whether or not it is selected.
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 QAccessibleTable2Interface* table() const = 0;
// #### Qt5 this should not be here but part of the state
virtual bool isExpandable() const = 0;
};
class Q_WIDGETS_EXPORT QAccessibleTable2Interface: public QAccessible2Interface
{
public:
inline QAccessible2Interface *qAccessibleTable2CastHelper() { return this; }
// Returns the cell at the specified row and column in the table.
virtual QAccessibleTable2CellInterface *cellAt (int row, int column) const = 0;
// Returns the caption for the table.
virtual QAccessibleInterface *caption() const = 0;
// Returns the description text of the specified column in the table.
virtual QString columnDescription(int column) const = 0;
// Returns the total number of columns in table.
virtual int columnCount() const = 0;
// Returns the total number of rows in table.
virtual int rowCount() const = 0;
// Returns the total number of selected cells.
virtual int selectedCellCount() const = 0;
// Returns the total number of selected columns.
virtual int selectedColumnCount() const = 0;
// Returns the total number of selected rows.
virtual int selectedRowCount() const = 0;
// Returns the description text of the specified row in the table.
virtual QString rowDescription(int row) const = 0;
// Returns a list of accessibles currently selected.
virtual QList<QAccessibleTable2CellInterface*> selectedCells() const = 0;
// Returns a list of column indexes currently selected (0 based).
virtual QList<int> selectedColumns() const = 0;
// Returns a list of row indexes currently selected (0 based).
virtual QList<int> selectedRows() const = 0;
// Returns the summary description of the table.
virtual QAccessibleInterface *summary() const = 0;
// Returns a boolean value indicating whether the specified column is completely selected.
virtual bool isColumnSelected(int column) const = 0;
// Returns a boolean value indicating whether the specified row is completely selected.
virtual bool isRowSelected(int row) const = 0;
// Selects a row and unselects all previously selected rows.
virtual bool selectRow(int row) = 0;
// Selects a column and unselects all previously selected columns.
virtual bool selectColumn(int column) = 0;
// Unselects one row, leaving other selected rows selected (if any).
virtual bool unselectRow(int row) = 0;
// Unselects one column, leaving other selected columns selected (if any).
virtual bool unselectColumn(int column) = 0;
// Returns the type and extents describing how a table changed.
virtual QAccessible2::TableModelChange modelChange() const = 0;
protected:
// These functions are called when the model changes.
virtual void modelReset() = 0;
virtual void rowsInserted(const QModelIndex &parent, int first, int last) = 0;
virtual void rowsRemoved(const QModelIndex &parent, int first, int last) = 0;
virtual void columnsInserted(const QModelIndex &parent, int first, int last) = 0;
virtual void columnsRemoved(const QModelIndex &parent, int first, int last) = 0;
virtual void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row) = 0;
virtual void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column) = 0;
friend class QAbstractItemView;
friend class QAbstractItemViewPrivate;
};
class Q_WIDGETS_EXPORT QAccessibleActionInterface : public QAccessible2Interface class Q_WIDGETS_EXPORT QAccessibleActionInterface : public QAccessible2Interface
{ {
public: public:

View File

@ -2427,7 +2427,7 @@ void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
} }
// There is no equivalent Mac notification for ObjectShow/Hide, so we call HIObjectSetAccessibilityIgnored // There is no equivalent Mac notification for ObjectShow/Hide, so we call HIObjectSetAccessibilityIgnored
// and isItIntersting which will mark the HIObject accociated with the element as ignored if the // and isItInteresting which will mark the HIObject accociated with the element as ignored if the
// QAccessible::Invisible state bit is set. // QAccessible::Invisible state bit is set.
QAInterface interface = accessibleHierarchyManager()->lookup(element); QAInterface interface = accessibleHierarchyManager()->lookup(element);
if (interface.isValid()) { if (interface.isValid()) {

View File

@ -103,6 +103,17 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
if (!iface) if (!iface)
return; return;
// updates for List/Table/Tree should send child
if (who) {
QAccessibleInterface *child;
iface->navigate(QAccessible::Child, who, &child);
if (child) {
delete iface;
iface = child;
who = 0;
}
}
for (int i = 0; i < bridges()->count(); ++i) for (int i = 0; i < bridges()->count(); ++i)
bridges()->at(i)->notifyAccessibilityUpdate(reason, iface, who); bridges()->at(i)->notifyAccessibilityUpdate(reason, iface, who);
delete iface; delete iface;

View File

@ -704,12 +704,15 @@ int QAccessibleWidget::navigate(RelationFlag relation, int entry,
int sibCount = pIface->childCount(); int sibCount = pIface->childCount();
QAccessibleInterface *candidate = 0; QAccessibleInterface *candidate = 0;
for (int i = 0; i < sibCount && entry; ++i) { for (int i = 0; i < sibCount && entry; ++i) {
pIface->navigate(Child, i+1, &candidate); const int childId = pIface->navigate(Child, i+1, &candidate);
Q_ASSERT(candidate); Q_ASSERT(childId >= 0);
if (candidate->relationTo(0, this, 0) & Label) if (childId > 0)
candidate = pIface;
if (candidate->relationTo(childId, this, 0) & Label)
--entry; --entry;
if (!entry) if (!entry)
break; break;
if (candidate != pIface)
delete candidate; delete candidate;
candidate = 0; candidate = 0;
} }

View File

@ -1171,24 +1171,26 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
// Update focus scope item ptr in new scope. // Update focus scope item ptr in new scope.
QGraphicsItem *newFocusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem; QGraphicsItem *newFocusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem;
if (newFocusScopeItem && newParent) { if (newFocusScopeItem && newParent) {
if (subFocusItem) { QGraphicsItem *p = newParent;
// Find the subFocusItem's topmost focus scope.
QGraphicsItem *ancestorScope = 0;
QGraphicsItem *p = subFocusItem->d_ptr->parent;
while (p) { while (p) {
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
ancestorScope = p; if (subFocusItem && subFocusItem != q_ptr) {
if (p->d_ptr->flags & QGraphicsItem::ItemIsPanel) // Find the subFocusItem's topmost focus scope within the new parent's focusscope
QGraphicsItem *ancestorScope = 0;
QGraphicsItem *p2 = subFocusItem->d_ptr->parent;
while (p2 && p2 != p) {
if (p2->d_ptr->flags & QGraphicsItem::ItemIsFocusScope)
ancestorScope = p2;
if (p2->d_ptr->flags & QGraphicsItem::ItemIsPanel)
break; break;
p = p->d_ptr->parent; if (p2 == q_ptr)
break;
p2 = p2->d_ptr->parent;
} }
if (ancestorScope) if (ancestorScope)
newFocusScopeItem = ancestorScope; newFocusScopeItem = ancestorScope;
} }
QGraphicsItem *p = newParent;
while (p) {
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
p->d_ptr->focusScopeItem = newFocusScopeItem; p->d_ptr->focusScopeItem = newFocusScopeItem;
newFocusScopeItem->d_ptr->focusScopeItemChange(true); newFocusScopeItem->d_ptr->focusScopeItemChange(true);
// Ensure the new item is no longer the subFocusItem. The // Ensure the new item is no longer the subFocusItem. The

View File

@ -98,9 +98,9 @@ public:
inline QStyle *style() const { return m_style; } inline QStyle *style() const { return m_style; }
inline QWidget *widget() const { return m_widget; } inline QWidget *widget() const { return m_widget; }
inline bool operator==(const QLayoutStyleInfo &other) inline bool operator==(const QLayoutStyleInfo &other) const
{ return m_style == other.m_style && m_widget == other.m_widget; } { return m_style == other.m_style && m_widget == other.m_widget; }
inline bool operator!=(const QLayoutStyleInfo &other) inline bool operator!=(const QLayoutStyleInfo &other) const
{ return !(*this == other); } { return !(*this == other); }
inline void setDefaultSpacing(Qt::Orientation o, qreal spacing){ inline void setDefaultSpacing(Qt::Orientation o, qreal spacing){

View File

@ -60,6 +60,7 @@
#include <private/qabstractitemmodel_p.h> #include <private/qabstractitemmodel_p.h>
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
#include <qaccessible.h> #include <qaccessible.h>
#include <qaccessible2.h>
#endif #endif
#include <private/qsoftkeymanager_p.h> #include <private/qsoftkeymanager_p.h>
#ifndef QT_NO_GESTURE #ifndef QT_NO_GESTURE
@ -682,6 +683,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)), disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(_q_rowsRemoved(QModelIndex,int,int))); this, SLOT(_q_rowsRemoved(QModelIndex,int,int)));
disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(_q_rowsInserted(QModelIndex,int,int)));
disconnect(d->model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), disconnect(d->model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int))); this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));
disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)), disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
@ -712,6 +715,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
this, SLOT(_q_headerDataChanged())); this, SLOT(_q_headerDataChanged()));
connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)), connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(rowsInserted(QModelIndex,int,int))); this, SLOT(rowsInserted(QModelIndex,int,int)));
connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(_q_rowsInserted(QModelIndex,int,int)));
connect(d->model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), connect(d->model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
connect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)), connect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
@ -1095,6 +1100,14 @@ void QAbstractItemView::reset()
setRootIndex(QModelIndex()); setRootIndex(QModelIndex());
if (d->selectionModel) if (d->selectionModel)
d->selectionModel->reset(); d->selectionModel->reset();
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset();
QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged);
}
#endif
#endif
} }
/*! /*!
@ -2849,7 +2862,7 @@ void QAbstractItemView::editorDestroyed(QObject *editor)
*/ */
void QAbstractItemView::setHorizontalStepsPerItem(int steps) void QAbstractItemView::setHorizontalStepsPerItem(int steps)
{ {
Q_UNUSED(steps); Q_UNUSED(steps)
// do nothing // do nothing
} }
@ -2878,7 +2891,7 @@ int QAbstractItemView::horizontalStepsPerItem() const
*/ */
void QAbstractItemView::setVerticalStepsPerItem(int steps) void QAbstractItemView::setVerticalStepsPerItem(int steps)
{ {
Q_UNUSED(steps); Q_UNUSED(steps)
// do nothing // do nothing
} }
@ -3311,12 +3324,24 @@ void QAbstractItemView::rowsAboutToBeRemoved(const QModelIndex &parent, int star
rows are those under the given \a parent from \a start to \a end rows are those under the given \a parent from \a start to \a end
inclusive. inclusive.
*/ */
void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &, int, int) void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int start, int end)
{ {
Q_UNUSED(index)
Q_UNUSED(start)
Q_UNUSED(end)
Q_Q(QAbstractItemView); Q_Q(QAbstractItemView);
if (q->isVisible()) if (q->isVisible())
q->updateEditorGeometries(); q->updateEditorGeometries();
q->setState(QAbstractItemView::NoState); q->setState(QAbstractItemView::NoState);
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsRemoved(index, start, end);
QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
}
#endif
#endif
} }
/*! /*!
@ -3379,28 +3404,73 @@ void QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &par
rows are those under the given \a parent from \a start to \a end rows are those under the given \a parent from \a start to \a end
inclusive. inclusive.
*/ */
void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &, int, int) void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int start, int end)
{ {
Q_UNUSED(index)
Q_UNUSED(start)
Q_UNUSED(end)
Q_Q(QAbstractItemView); Q_Q(QAbstractItemView);
if (q->isVisible()) if (q->isVisible())
q->updateEditorGeometries(); q->updateEditorGeometries();
q->setState(QAbstractItemView::NoState); q->setState(QAbstractItemView::NoState);
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsRemoved(index, start, end);
QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
}
#endif
#endif
} }
/*! /*!
\internal \internal
This slot is called when rows have been inserted. This slot is called when rows have been inserted.
*/ */
void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &, int, int) void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int start, int end)
{ {
Q_UNUSED(index)
Q_UNUSED(start)
Q_UNUSED(end)
Q_Q(QAbstractItemView);
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsInserted(index, start, end);
QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
}
#endif
#endif
}
/*!
\internal
This slot is called when columns have been inserted.
*/
void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int start, int end)
{
Q_UNUSED(index)
Q_UNUSED(start)
Q_UNUSED(end)
Q_Q(QAbstractItemView); Q_Q(QAbstractItemView);
if (q->isVisible()) if (q->isVisible())
q->updateEditorGeometries(); q->updateEditorGeometries();
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsInserted(index, start, end);
QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
}
#endif
#endif
} }
/*! /*!
\internal \internal
*/ */
@ -3417,7 +3487,16 @@ void QAbstractItemViewPrivate::_q_modelDestroyed()
*/ */
void QAbstractItemViewPrivate::_q_layoutChanged() void QAbstractItemViewPrivate::_q_layoutChanged()
{ {
Q_Q(QAbstractItemView);
doDelayedItemsLayout(); doDelayedItemsLayout();
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->modelReset();
QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
}
#endif
#endif
} }
/*! /*!
@ -3742,7 +3821,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemView::selectionCommand(const QM
QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::multiSelectionCommand( QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::multiSelectionCommand(
const QModelIndex &index, const QEvent *event) const const QModelIndex &index, const QEvent *event) const
{ {
Q_UNUSED(index); Q_UNUSED(index)
if (event) { if (event) {
switch (event->type()) { switch (event->type()) {

View File

@ -355,6 +355,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_columnsRemoved(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_columnsRemoved(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_columnsInserted(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_columnsInserted(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_rowsInserted(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex&, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed()) Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged()) Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged())

View File

@ -108,6 +108,7 @@ public:
void init(); void init();
virtual void _q_rowsRemoved(const QModelIndex &parent, int start, int end); virtual void _q_rowsRemoved(const QModelIndex &parent, int start, int end);
virtual void _q_rowsInserted(const QModelIndex &parent, int start, int end);
virtual void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end); virtual void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
virtual void _q_columnsRemoved(const QModelIndex &parent, int start, int end); virtual void _q_columnsRemoved(const QModelIndex &parent, int start, int end);
virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end); virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end);

View File

@ -3169,7 +3169,11 @@ void QListView::currentChanged(const QModelIndex &current, const QModelIndex &pr
if (QAccessible::isActive()) { if (QAccessible::isActive()) {
if (current.isValid()) { if (current.isValid()) {
int entry = visualIndex(current) + 1; int entry = visualIndex(current) + 1;
#ifdef Q_WS_X11
QAccessible::updateAccessibility(this, entry, QAccessible::Focus);
#else
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus); QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
#endif
} }
} }
#endif #endif
@ -3188,12 +3192,20 @@ void QListView::selectionChanged(const QItemSelection &selected,
QModelIndex sel = selected.indexes().value(0); QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) { if (sel.isValid()) {
int entry = visualIndex(sel) + 1; int entry = visualIndex(sel) + 1;
#ifdef Q_WS_X11
QAccessible::updateAccessibility(this, entry, QAccessible::Selection);
#else
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection); QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection);
#endif
} }
QModelIndex desel = deselected.indexes().value(0); QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) { if (desel.isValid()) {
int entry = visualIndex(desel) + 1; int entry = visualIndex(desel) + 1;
#ifdef Q_WS_X11
QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove);
#else
QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove); QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove);
#endif
} }
} }
#endif #endif

View File

@ -3164,10 +3164,16 @@ void QTableView::currentChanged(const QModelIndex &current, const QModelIndex &p
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) { if (QAccessible::isActive()) {
if (current.isValid()) { if (current.isValid()) {
#ifdef Q_WS_X11
Q_D(QTableView);
int entry = d->accessibleTable2Index(current);
QAccessible::updateAccessibility(this, entry, QAccessible::Focus);
#else
int entry = visualIndex(current) + 1; int entry = visualIndex(current) + 1;
if (horizontalHeader()) if (horizontalHeader())
++entry; ++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus); QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
#endif
} }
} }
#endif #endif
@ -3180,22 +3186,33 @@ void QTableView::currentChanged(const QModelIndex &current, const QModelIndex &p
void QTableView::selectionChanged(const QItemSelection &selected, void QTableView::selectionChanged(const QItemSelection &selected,
const QItemSelection &deselected) const QItemSelection &deselected)
{ {
Q_D(QTableView);
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) { if (QAccessible::isActive()) {
// ### does not work properly for selection ranges. // ### does not work properly for selection ranges.
QModelIndex sel = selected.indexes().value(0); QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) { if (sel.isValid()) {
#ifdef Q_WS_X11
int entry = d->accessibleTable2Index(sel);
QAccessible::updateAccessibility(this, entry, QAccessible::Selection);
#else
int entry = visualIndex(sel); int entry = visualIndex(sel);
if (horizontalHeader()) if (horizontalHeader())
++entry; ++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection); QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection);
#endif
} }
QModelIndex desel = deselected.indexes().value(0); QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) { if (desel.isValid()) {
#ifdef Q_WS_X11
int entry = d->accessibleTable2Index(sel);
QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove);
#else
int entry = visualIndex(sel); int entry = visualIndex(sel);
if (horizontalHeader()) if (horizontalHeader())
++entry; ++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove); QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove);
#endif
} }
} }
#endif #endif

View File

@ -167,6 +167,11 @@ public:
return horizontalHeader->logicalIndex(visualCol); return horizontalHeader->logicalIndex(visualCol);
} }
inline int accessibleTable2Index(const QModelIndex &index) const {
return (index.row() + (horizontalHeader ? 1 : 0)) * (index.model()->columnCount() + (verticalHeader ? 1 : 0))
+ index.column() + (verticalHeader ? 1 : 0) + 1;
}
int sectionSpanEndLogical(const QHeaderView *header, int logical, int span) const; int sectionSpanEndLogical(const QHeaderView *header, int logical, int span) const;
int sectionSpanSize(const QHeaderView *header, int logical, int span) const; int sectionSpanSize(const QHeaderView *header, int logical, int span) const;
bool spanContainsSection(const QHeaderView *header, int logical, int spanLogical, int span) const; bool spanContainsSection(const QHeaderView *header, int logical, int spanLogical, int span) const;

View File

@ -54,6 +54,7 @@
#include <qdebug.h> #include <qdebug.h>
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
#include <qaccessible.h> #include <qaccessible.h>
#include <qaccessible2.h>
#endif #endif
#include <private/qtreeview_p.h> #include <private/qtreeview_p.h>
@ -2883,20 +2884,36 @@ void QTreeViewPrivate::expand(int item, bool emitSignal)
void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem &viewItem) void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem &viewItem)
{ {
Q_Q(QTreeView);
viewItems.insert(pos, count, viewItem); viewItems.insert(pos, count, viewItem);
QTreeViewItem *items = viewItems.data(); QTreeViewItem *items = viewItems.data();
for (int i = pos + count; i < viewItems.count(); i++) for (int i = pos + count; i < viewItems.count(); i++)
if (items[i].parentItem >= pos) if (items[i].parentItem >= pos)
items[i].parentItem += count; items[i].parentItem += count;
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
}
#endif
#endif
} }
void QTreeViewPrivate::removeViewItems(int pos, int count) void QTreeViewPrivate::removeViewItems(int pos, int count)
{ {
Q_Q(QTreeView);
viewItems.remove(pos, count); viewItems.remove(pos, count);
QTreeViewItem *items = viewItems.data(); QTreeViewItem *items = viewItems.data();
for (int i = pos; i < viewItems.count(); i++) for (int i = pos; i < viewItems.count(); i++)
if (items[i].parentItem >= pos) if (items[i].parentItem >= pos)
items[i].parentItem -= count; items[i].parentItem -= count;
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
}
#endif
#endif
} }
#if 0 #if 0
@ -3687,14 +3704,6 @@ void QTreeViewPrivate::_q_sortIndicatorChanged(int column, Qt::SortOrder order)
*/ */
void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &previous) void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
{ {
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
int entry = visualIndex(current) + 1;
if (header())
++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
}
#endif
QAbstractItemView::currentChanged(current, previous); QAbstractItemView::currentChanged(current, previous);
if (allColumnsShowFocus()) { if (allColumnsShowFocus()) {
@ -3711,6 +3720,19 @@ void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &pr
viewport()->update(currentRect); viewport()->update(currentRect);
} }
} }
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive() && current.isValid()) {
#ifdef Q_WS_X11
int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column() + 1;
QAccessible::updateAccessibility(this, entry, QAccessible::Focus);
#else
int entry = visualIndex(current) + 1;
if (header())
++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
#endif
}
#endif
} }
/*! /*!
@ -3719,26 +3741,38 @@ void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &pr
void QTreeView::selectionChanged(const QItemSelection &selected, void QTreeView::selectionChanged(const QItemSelection &selected,
const QItemSelection &deselected) const QItemSelection &deselected)
{ {
QAbstractItemView::selectionChanged(selected, deselected);
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) { if (QAccessible::isActive()) {
// ### does not work properly for selection ranges. // ### does not work properly for selection ranges.
QModelIndex sel = selected.indexes().value(0); QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) { if (sel.isValid()) {
#ifdef Q_WS_X11
int entry = (visualIndex(sel) + (header()?1:0))*sel.model()->columnCount()+sel.column() + 1;
Q_ASSERT(entry > 0);
QAccessible::updateAccessibility(this, entry, QAccessible::Selection);
#else
int entry = visualIndex(sel) + 1; int entry = visualIndex(sel) + 1;
if (header()) if (header())
++entry; ++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection); QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection);
#endif
} }
QModelIndex desel = deselected.indexes().value(0); QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) { if (desel.isValid()) {
#ifdef Q_WS_X11
int entry = (visualIndex(desel) + (header()?1:0))*desel.model()->columnCount()+desel.column() + 1;
Q_ASSERT(entry > 0);
QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove);
#else
int entry = visualIndex(desel) + 1; int entry = visualIndex(desel) + 1;
if (header()) if (header())
++entry; ++entry;
QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove); QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove);
#endif
} }
} }
#endif #endif
QAbstractItemView::selectionChanged(selected, deselected);
} }
int QTreeView::visualIndex(const QModelIndex &index) const int QTreeView::visualIndex(const QModelIndex &index) const

View File

@ -219,6 +219,9 @@ protected:
private: private:
friend class QAccessibleItemView; friend class QAccessibleItemView;
friend class QAccessibleTable2;
friend class QAccessibleTree;
friend class QAccessibleTable2Cell;
int visualIndex(const QModelIndex &index) const; int visualIndex(const QModelIndex &index) const;
Q_DECLARE_PRIVATE(QTreeView) Q_DECLARE_PRIVATE(QTreeView)

View File

@ -78,7 +78,7 @@ struct QTreeViewItem
Q_DECLARE_TYPEINFO(QTreeViewItem, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(QTreeViewItem, Q_MOVABLE_TYPE);
class QTreeViewPrivate : public QAbstractItemViewPrivate class Q_GUI_EXPORT QTreeViewPrivate : public QAbstractItemViewPrivate
{ {
Q_DECLARE_PUBLIC(QTreeView) Q_DECLARE_PUBLIC(QTreeView)
public: public:
@ -223,6 +223,10 @@ public:
inline void invalidateHeightCache(int item) const inline void invalidateHeightCache(int item) const
{ viewItems[item].height = 0; } { viewItems[item].height = 0; }
inline int accessibleTable2Index(const QModelIndex &index) const {
return (viewIndex(index) + (header ? 1 : 0)) * model->columnCount()+index.column() + 1;
}
// used for spanning rows // used for spanning rows
QVector<QPersistentModelIndex> spanningIndexes; QVector<QPersistentModelIndex> spanningIndexes;

View File

@ -62,7 +62,7 @@ public:
inline QWidgetItemData(int r, QVariant v) : role(r), value(v) {} inline QWidgetItemData(int r, QVariant v) : role(r), value(v) {}
int role; int role;
QVariant value; QVariant value;
inline bool operator==(const QWidgetItemData &other) { return role == other.role && value == other.value; } inline bool operator==(const QWidgetItemData &other) const { return role == other.role && value == other.value; }
}; };
#ifndef QT_NO_DATASTREAM #ifndef QT_NO_DATASTREAM

View File

@ -6375,6 +6375,10 @@ void QWidget::setFocus(Qt::FocusReason reason)
// The negation of the condition in setFocus_sys // The negation of the condition in setFocus_sys
if (!(testAttribute(Qt::WA_WState_Created) && window()->windowType() != Qt::Popup && internalWinId())) if (!(testAttribute(Qt::WA_WState_Created) && window()->windowType() != Qt::Popup && internalWinId()))
//setFocusWidget will already post a focus event for us (that the AT client receives) on Windows //setFocusWidget will already post a focus event for us (that the AT client receives) on Windows
# endif
# ifdef Q_OS_UNIX
// menus update the focus manually and this would create bogus events
if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem")))
# endif # endif
QAccessible::updateAccessibility(f, 0, QAccessible::Focus); QAccessible::updateAccessibility(f, 0, QAccessible::Focus);
#endif #endif

View File

@ -141,7 +141,7 @@ struct MacTimerInfo {
QObject *obj; QObject *obj;
bool pending; bool pending;
CFRunLoopTimerRef runLoopTimer; CFRunLoopTimerRef runLoopTimer;
bool operator==(const MacTimerInfo &other) bool operator==(const MacTimerInfo &other) const
{ {
return (id == other.id); return (id == other.id);
} }

View File

@ -80,6 +80,9 @@
#if defined(Q_WS_S60) #if defined(Q_WS_S60)
#include "private/qt_s60_p.h" #include "private/qt_s60_p.h"
#endif #endif
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -1018,6 +1021,9 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn
} }
q->update(); q->update();
} }
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged);
#endif
} }
void QComboBoxPrivate::_q_rowsInserted(const QModelIndex &parent, int start, int end) void QComboBoxPrivate::_q_rowsInserted(const QModelIndex &parent, int start, int end)
@ -1271,6 +1277,9 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
Q_Q(QComboBox); Q_Q(QComboBox);
emit q->currentIndexChanged(index.row()); emit q->currentIndexChanged(index.row());
emit q->currentIndexChanged(itemText(index)); emit q->currentIndexChanged(itemText(index));
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged);
#endif
} }
QString QComboBoxPrivate::itemText(const QModelIndex &index) const QString QComboBoxPrivate::itemText(const QModelIndex &index) const
@ -2635,6 +2644,9 @@ void QComboBox::clear()
{ {
Q_D(QComboBox); Q_D(QComboBox);
d->model->removeRows(0, d->model->rowCount(d->root), d->root); d->model->removeRows(0, d->model->rowCount(d->root), d->root);
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
#endif
} }
/*! /*!
@ -2651,6 +2663,9 @@ void QComboBox::clearEditText()
Q_D(QComboBox); Q_D(QComboBox);
if (d->lineEdit) if (d->lineEdit)
d->lineEdit->clear(); d->lineEdit->clear();
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
#endif
} }
/*! /*!
@ -2661,6 +2676,9 @@ void QComboBox::setEditText(const QString &text)
Q_D(QComboBox); Q_D(QComboBox);
if (d->lineEdit) if (d->lineEdit)
d->lineEdit->setText(text); d->lineEdit->setText(text);
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
#endif
} }
/*! /*!

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