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:
commit
04d0a9626c
44
.gitignore
vendored
44
.gitignore
vendored
@ -269,3 +269,47 @@ src/xml/lib/
|
||||
*.dep
|
||||
*.map
|
||||
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
|
||||
|
@ -262,7 +262,7 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) {
|
||||
$| = 1;
|
||||
|
||||
# Now run the configuration tests
|
||||
print "Configuration tests:\n";
|
||||
print "Configuration tests:\n" if (%configtests);
|
||||
|
||||
while ((my $testName, my $testParameters) = each %configtests) {
|
||||
printf " % *s: ", $maxNameLength, $testName; # right aligned, yes/no lines up
|
||||
|
@ -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
|
||||
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 = "";
|
||||
our @ignore_headers = ();
|
||||
our @ignore_for_master_contents = ();
|
||||
our @ignore_for_include_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
|
||||
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));
|
||||
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 "#ifndef QT_". uc($lib) . "_VERSION_H\n";
|
||||
print MODULE_VERSION_HEADER_FILE "#define QT_". uc($lib) . "_VERSION_H\n";
|
||||
|
38
configure
vendored
38
configure
vendored
@ -2508,23 +2508,6 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "ye
|
||||
echo
|
||||
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
|
||||
QMAKE_CONFIG="$QMAKE_CONFIG silent"
|
||||
fi
|
||||
@ -3241,6 +3224,23 @@ fi
|
||||
# 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
|
||||
# See if PKG_CONFIG is set in the mkspec:
|
||||
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
|
||||
QMakeVar add QMAKE_CFLAGS -g
|
||||
QMakeVar add QMAKE_CXXFLAGS -g
|
||||
QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info"
|
||||
QT_CONFIG="$QT_CONFIG separate_debug_info"
|
||||
fi
|
||||
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
|
||||
[ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
|
||||
[ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
|
||||
|
11
dist/changes-4.8.0
vendored
11
dist/changes-4.8.0
vendored
@ -72,6 +72,17 @@ QtGui
|
||||
like UltraLight. [QTBUG-19366]
|
||||
- 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]
|
||||
- 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
|
||||
---------
|
||||
|
4
dist/changes-5.0.0
vendored
4
dist/changes-5.0.0
vendored
@ -20,6 +20,10 @@ information about a particular change.
|
||||
- QLibrary::resolve() now returns a function pointer instead of a void
|
||||
pointer.
|
||||
|
||||
- QSslCertificate::alternateSubjectNames() is deprecated (but can be enabled
|
||||
via QT_DISABLE_DEPRECATED_BEFORE), use
|
||||
QSslCertificate::subjectAlternativeNames() instead.
|
||||
|
||||
****************************************************************************
|
||||
* General *
|
||||
****************************************************************************
|
||||
|
@ -434,6 +434,21 @@ hostNameLabel->setText(tr("Name:"));
|
||||
QString example = tr("Example");
|
||||
//! [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]
|
||||
//: This is a comment for the translator.
|
||||
//= qtn_foo_bar
|
||||
|
@ -48,8 +48,10 @@
|
||||
#include <QQuaternion>
|
||||
#include <QVector2D>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QBasicTimer;
|
||||
class QGLShaderProgram;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class GeometryEngine;
|
||||
|
||||
|
@ -46,7 +46,9 @@
|
||||
#include "ui_landscape.h"
|
||||
#include "ui_portrait.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAbstractButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
//! [0]
|
||||
class MainWindow : public QWidget
|
||||
|
@ -99,10 +99,16 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
|
||||
# Let every project have a standard GNU `check' target
|
||||
!contains(QMAKE_EXTRA_TARGETS, check) {
|
||||
# `make check' should iterate through all subdirs
|
||||
# (except those with no_default_target)
|
||||
contains(TEMPLATE, subdirs) {
|
||||
check.CONFIG = recursive
|
||||
check.recurse = $$SUBDIRS
|
||||
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
|
||||
else {
|
||||
|
@ -59,6 +59,8 @@ linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
|
||||
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
|
||||
unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions
|
||||
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:!static:contains(QT_CONFIG, qt_framework) {
|
||||
|
@ -9,6 +9,8 @@ CONFIG += qt plugin
|
||||
win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
|
||||
TARGET = $$qtLibraryTarget($$TARGET)
|
||||
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)
|
||||
|
||||
|
@ -152,6 +152,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
|
||||
asm volatile("0:\n"
|
||||
"ldrex %[result], [%[_q_value]]\n"
|
||||
"eors %[result], %[result], %[expectedValue]\n"
|
||||
"itt eq\n"
|
||||
"strexeq %[result], %[newValue], [%[_q_value]]\n"
|
||||
"teqeq %[result], #1\n"
|
||||
"beq 0b\n"
|
||||
@ -210,6 +211,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu
|
||||
asm volatile("0:\n"
|
||||
"ldrex %[result], [%[_q_value]]\n"
|
||||
"eors %[result], %[result], %[expectedValue]\n"
|
||||
"itt eq\n"
|
||||
"strexeq %[result], %[newValue], [%[_q_value]]\n"
|
||||
"teqeq %[result], #1\n"
|
||||
"beq 0b\n"
|
||||
|
@ -1288,7 +1288,11 @@ public:
|
||||
AnchorBottom
|
||||
};
|
||||
|
||||
|
||||
enum FindChildOption {
|
||||
FindDirectChildrenOnly = 0x0,
|
||||
FindChildrenRecursively = 0x1
|
||||
};
|
||||
Q_DECLARE_FLAGS(FindChildOptions, FindChildOption)
|
||||
|
||||
enum DropAction {
|
||||
CopyAction = 0x1,
|
||||
|
@ -2110,6 +2110,13 @@
|
||||
\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
|
||||
|
||||
|
@ -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
|
||||
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
|
||||
{
|
||||
@ -409,26 +421,6 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const
|
||||
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.
|
||||
*/
|
||||
|
@ -75,9 +75,7 @@ public:
|
||||
inline QFileInfo&operator=(QFileInfo &&other)
|
||||
{ qSwap(d_ptr, other.d_ptr); return *this; }
|
||||
#endif
|
||||
bool operator==(const QFileInfo &fileinfo); // 5.0 - remove me
|
||||
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)); }
|
||||
|
||||
void setFile(const QString &file);
|
||||
|
@ -1029,8 +1029,8 @@ QObjectPrivate::Connection::~Connection()
|
||||
|
||||
\brief the name of this object
|
||||
|
||||
You can find an object by name (and type) using findChild(). You can
|
||||
find a set of objects with findChildren().
|
||||
You can find an object by name (and type) using findChild().
|
||||
You can find a set of objects with findChildren().
|
||||
|
||||
\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
|
||||
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.
|
||||
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
|
||||
direct ancestor is returned. If there are several direct
|
||||
@ -1559,7 +1560,8 @@ void QObject::killTimer(int id)
|
||||
case, findChildren() should be used.
|
||||
|
||||
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
|
||||
|
||||
@ -1567,16 +1569,27 @@ void QObject::killTimer(int id)
|
||||
|
||||
\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()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\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
|
||||
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.
|
||||
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 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
|
||||
|
||||
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()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QList<T> QObject::findChildren(const QRegExp ®Exp) const
|
||||
\fn QList<T> QObject::findChildren(const QRegExp ®Exp, Qt::FindChildOptions options) const
|
||||
\overload findChildren()
|
||||
|
||||
Returns the children of this object that can be cast to type T
|
||||
@ -1651,7 +1668,7 @@ void QObject::killTimer(int id)
|
||||
\internal
|
||||
*/
|
||||
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)
|
||||
return;
|
||||
@ -1668,13 +1685,14 @@ void qt_qFindChildren_helper(const QObject *parent, const QString &name, const Q
|
||||
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
|
||||
*/
|
||||
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)
|
||||
return 0;
|
||||
@ -1686,10 +1704,12 @@ QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const
|
||||
if (mo.cast(obj) && (name.isNull() || obj->objectName() == name))
|
||||
return obj;
|
||||
}
|
||||
for (i = 0; i < children.size(); ++i) {
|
||||
obj = qt_qFindChild_helper(children.at(i), name, mo);
|
||||
if (obj)
|
||||
return obj;
|
||||
if (options & Qt::FindChildrenRecursively) {
|
||||
for (i = 0; i < children.size(); ++i) {
|
||||
obj = qt_qFindChild_helper(children.at(i), name, mo, options);
|
||||
if (obj)
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ class QObjectUserData;
|
||||
typedef QList<QObject*> QObjectList;
|
||||
|
||||
Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString &name, const QRegExp *re,
|
||||
const QMetaObject &mo, QList<void *> *list);
|
||||
Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo);
|
||||
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, Qt::FindChildOptions options);
|
||||
|
||||
class
|
||||
#if defined(__INTEL_COMPILER) && defined(Q_OS_WIN)
|
||||
@ -157,11 +157,11 @@ public:
|
||||
void killTimer(int id);
|
||||
|
||||
template<typename T>
|
||||
inline T findChild(const QString &aName = QString()) const
|
||||
{ return static_cast<T>(qt_qFindChild_helper(this, aName, reinterpret_cast<T>(0)->staticMetaObject)); }
|
||||
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, options)); }
|
||||
|
||||
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;
|
||||
union {
|
||||
@ -169,13 +169,13 @@ public:
|
||||
QList<void *> *voidList;
|
||||
} u;
|
||||
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;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_REGEXP
|
||||
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;
|
||||
union {
|
||||
@ -183,7 +183,7 @@ public:
|
||||
QList<void *> *voidList;
|
||||
} u;
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
|
@ -101,6 +101,10 @@ public:
|
||||
// default argument causes thread to block indefinately
|
||||
bool wait(unsigned long time = ULONG_MAX);
|
||||
|
||||
static void sleep(unsigned long);
|
||||
static void msleep(unsigned long);
|
||||
static void usleep(unsigned long);
|
||||
|
||||
Q_SIGNALS:
|
||||
void started();
|
||||
void finished();
|
||||
@ -112,10 +116,6 @@ protected:
|
||||
|
||||
static void setTerminationEnabled(bool enabled = true);
|
||||
|
||||
static void sleep(unsigned long);
|
||||
static void msleep(unsigned long);
|
||||
static void usleep(unsigned long);
|
||||
|
||||
protected:
|
||||
QThread(QThreadPrivate &dd, QObject *parent = 0);
|
||||
|
||||
|
@ -352,8 +352,8 @@ public:
|
||||
// ### Qt 5: not sure this is necessary anymore
|
||||
#ifdef QT_STRICT_ITERATORS
|
||||
private:
|
||||
inline bool operator==(const iterator &o) { 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)); }
|
||||
inline bool operator!=(const iterator &o) const { return operator!=(const_iterator(o)); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -52,7 +52,8 @@ PUB_HEADERS = qdbusargument.h \
|
||||
qdbusmetatype.h \
|
||||
qdbuspendingcall.h \
|
||||
qdbuspendingreply.h \
|
||||
qdbuscontext.h
|
||||
qdbuscontext.h \
|
||||
qdbusvirtualobject.h
|
||||
HEADERS += $$PUB_HEADERS \
|
||||
qdbusconnection_p.h \
|
||||
qdbusmessage_p.h \
|
||||
@ -95,4 +96,5 @@ SOURCES += qdbusconnection.cpp \
|
||||
qdbuspendingreply.cpp \
|
||||
qdbus_symbols.cpp \
|
||||
qdbusservicewatcher.cpp \
|
||||
qdbusunixfiledescriptor.cpp
|
||||
qdbusunixfiledescriptor.cpp \
|
||||
qdbusvirtualobject.cpp
|
||||
|
@ -221,6 +221,18 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP
|
||||
\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
|
||||
The mode for unregistering an object path:
|
||||
@ -801,9 +813,21 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
|
||||
// this node exists
|
||||
// consider it free if there's no object here and the user is not trying to
|
||||
// replace the object sub-tree
|
||||
if ((options & ExportChildObjects && !node->children.isEmpty()) || node->obj)
|
||||
if (node->obj)
|
||||
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
|
||||
node->obj = object;
|
||||
node->flags = options;
|
||||
@ -813,6 +837,13 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis
|
||||
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
|
||||
QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it =
|
||||
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;
|
||||
}
|
||||
|
||||
/*!
|
||||
\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
|
||||
\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) {
|
||||
if (pathComponents.count() == i)
|
||||
return node->obj;
|
||||
if ((node->flags & QDBusConnectionPrivate::VirtualObject) && (node->flags & QDBusConnection::SubPath))
|
||||
return node->obj;
|
||||
|
||||
QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it =
|
||||
qLowerBound(node->children.constBegin(), node->children.constEnd(), pathComponents.at(i));
|
||||
@ -917,6 +965,8 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
Returns a QDBusConnectionInterface object that represents the
|
||||
D-Bus server interface on this connection.
|
||||
|
@ -69,6 +69,7 @@ class QDBusError;
|
||||
class QDBusMessage;
|
||||
class QDBusPendingCall;
|
||||
class QDBusConnectionInterface;
|
||||
class QDBusVirtualObject;
|
||||
class QObject;
|
||||
|
||||
class QDBusConnectionPrivate;
|
||||
@ -104,8 +105,8 @@ public:
|
||||
// Qt 4.2 had a misspelling here
|
||||
ExportAllSignal = ExportAllSignals,
|
||||
#endif
|
||||
|
||||
ExportChildObjects = 0x1000
|
||||
// Reserved = 0xff000000
|
||||
};
|
||||
enum UnregisterMode {
|
||||
UnregisterNode,
|
||||
@ -113,6 +114,15 @@ public:
|
||||
};
|
||||
Q_DECLARE_FLAGS(RegisterOptions, RegisterOption)
|
||||
|
||||
enum VirtualObjectRegisterOption {
|
||||
SingleNode = 0x0,
|
||||
SubPath = 0x1
|
||||
// Reserved = 0xff000000
|
||||
};
|
||||
#ifndef Q_QDOC
|
||||
Q_DECLARE_FLAGS(VirtualObjectRegisterOptions, VirtualObjectRegisterOption)
|
||||
#endif
|
||||
|
||||
enum ConnectionCapability {
|
||||
UnixFileDescriptorPassing = 0x0001
|
||||
};
|
||||
@ -163,6 +173,9 @@ public:
|
||||
void unregisterObject(const QString &path, UnregisterMode mode = UnregisterNode);
|
||||
QObject *objectRegisteredAt(const QString &path) const;
|
||||
|
||||
bool registerVirtualObject(const QString &path, QDBusVirtualObject *object,
|
||||
VirtualObjectRegisterOption options = SingleNode);
|
||||
|
||||
bool registerService(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::VirtualObjectRegisterOptions)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -129,6 +129,11 @@ public:
|
||||
QByteArray matchRule;
|
||||
};
|
||||
|
||||
enum TreeNodeType {
|
||||
Object = 0x0,
|
||||
VirtualObject = 0x01000000
|
||||
};
|
||||
|
||||
struct ObjectTreeNode
|
||||
{
|
||||
typedef QVector<ObjectTreeNode> DataList;
|
||||
@ -143,8 +148,12 @@ public:
|
||||
{ return QStringRef(&name) < other; }
|
||||
|
||||
QString name;
|
||||
QObject* obj;
|
||||
union {
|
||||
QObject *obj;
|
||||
QDBusVirtualObject *treeNode;
|
||||
};
|
||||
int flags;
|
||||
|
||||
DataList children;
|
||||
};
|
||||
|
||||
@ -333,7 +342,7 @@ extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name);
|
||||
extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
|
||||
|
||||
// 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,
|
||||
const QDBusMessage &msg);
|
||||
extern QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node,
|
||||
|
@ -57,6 +57,7 @@
|
||||
#include "qdbusabstractadaptor.h"
|
||||
#include "qdbusabstractadaptor_p.h"
|
||||
#include "qdbusutil_p.h"
|
||||
#include "qdbusvirtualobject.h"
|
||||
#include "qdbusmessage_p.h"
|
||||
#include "qdbuscontext_p.h"
|
||||
#include "qdbuspendingcall_p.h"
|
||||
@ -442,7 +443,11 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root,
|
||||
|
||||
// walk the object tree
|
||||
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);
|
||||
end = (end == -1 ? length : end);
|
||||
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 (msg.member() == QLatin1String("Introspect") && msg.signature().isEmpty()) {
|
||||
//qDebug() << "QDBusConnectionPrivate::activateInternalFilters introspect" << msg.d_ptr->msg;
|
||||
QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node));
|
||||
QDBusMessage reply = msg.createReply(qDBusIntrospectObject(node, msg.path()));
|
||||
send(reply);
|
||||
return true;
|
||||
}
|
||||
@ -1375,6 +1380,15 @@ void QDBusConnectionPrivate::activateObject(ObjectTreeNode &node, const QDBusMes
|
||||
|
||||
// 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()) {
|
||||
node.flags &= ~QDBusConnection::ExportAllSignals;
|
||||
node.obj = findChildObject(&node, msg.path(), pathStartPos);
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include "qdbusmetatype_p.h"
|
||||
#include "qdbusmessage_p.h"
|
||||
#include "qdbusutil_p.h"
|
||||
#include "qdbusvirtualobject.h"
|
||||
|
||||
#ifndef QT_NO_DBUS
|
||||
|
||||
@ -108,7 +109,7 @@ static QString generateSubObjectXml(QObject *object)
|
||||
|
||||
// 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
|
||||
|
||||
@ -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 );
|
||||
}
|
||||
|
||||
|
97
src/dbus/qdbusvirtualobject.cpp
Normal file
97
src/dbus/qdbusvirtualobject.cpp
Normal 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
|
@ -4,7 +4,7 @@
|
||||
** All rights reserved.
|
||||
** 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$
|
||||
** GNU Lesser General Public License Usage
|
||||
@ -39,35 +39,43 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef OLD_QXMLSTREAM_H
|
||||
#define OLD_QXMLSTREAM_H
|
||||
#ifndef QDBUSTREENODE_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_NAMESPACE
|
||||
|
||||
QT_MODULE(Xml)
|
||||
QT_MODULE(DBus)
|
||||
|
||||
#if 0
|
||||
// make syncqt generate forwarding headers for this file too
|
||||
#pragma qt_class(QXmlStreamAttribute)
|
||||
#pragma qt_class(QXmlStreamAttributes)
|
||||
#pragma qt_class(QXmlStreamEntityDeclaration)
|
||||
#pragma qt_class(QXmlStreamEntityDeclarations)
|
||||
#pragma qt_class(QXmlStreamEntityResolver)
|
||||
#pragma qt_class(QXmlStreamNamespaceDeclaration)
|
||||
#pragma qt_class(QXmlStreamNamespaceDeclarations)
|
||||
#pragma qt_class(QXmlStreamNotationDeclaration)
|
||||
#pragma qt_class(QXmlStreamNotationDeclarations)
|
||||
#pragma qt_class(QXmlStreamReader)
|
||||
#pragma qt_class(QXmlStreamStringRef)
|
||||
#pragma qt_class(QXmlStreamWriter)
|
||||
#endif
|
||||
class QDBusMessage;
|
||||
class QDBusConnection;
|
||||
|
||||
class QDBusVirtualObjectPrivate;
|
||||
class Q_DBUS_EXPORT QDBusVirtualObject : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QDBusVirtualObject(QObject *parent = 0);
|
||||
virtual ~QDBusVirtualObject();
|
||||
|
||||
virtual QString introspect(const QString &path) const = 0;
|
||||
virtual bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) = 0;
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QDBusVirtualObject)
|
||||
Q_DISABLE_COPY(QDBusVirtualObject)
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // OLD_QXMLSTREAM_H
|
||||
#endif // QT_NO_DBUS
|
||||
#endif
|
@ -108,19 +108,11 @@ void QCursorData::update()
|
||||
|
||||
#endif //QT_NO_CURSOR
|
||||
|
||||
extern int qt_last_x;
|
||||
extern int qt_last_y;
|
||||
extern qreal qt_last_x,qt_last_y;
|
||||
|
||||
QPoint QCursor::pos()
|
||||
{
|
||||
QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
|
||||
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);
|
||||
return QPointF(qt_last_x, qt_last_y).toPoint();
|
||||
}
|
||||
|
||||
void QCursor::setPos(int x, int y)
|
||||
|
@ -91,8 +91,8 @@ bool QGuiApplicationPrivate::app_do_modal = false;
|
||||
|
||||
QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
|
||||
|
||||
int qt_last_x = 0;
|
||||
int qt_last_y = 0;
|
||||
qreal qt_last_x = 0;
|
||||
qreal qt_last_y = 0;
|
||||
|
||||
Qt::MouseButtons QGuiApplicationPrivate::buttons = Qt::NoButton;
|
||||
ulong QGuiApplicationPrivate::mousePressTime = 0;
|
||||
@ -554,7 +554,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
|
||||
QEvent::Type type;
|
||||
// move first
|
||||
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 =
|
||||
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
|
||||
@ -563,8 +563,8 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
|
||||
|
||||
QWindow *window = e->window.data();
|
||||
|
||||
QPoint localPoint = e->localPos;
|
||||
QPoint globalPoint = e->globalPos;
|
||||
QPointF localPoint = e->localPos;
|
||||
QPointF globalPoint = e->globalPos;
|
||||
|
||||
Qt::MouseButton button = Qt::NoButton;
|
||||
|
||||
@ -629,7 +629,7 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
|
||||
if (!e->window)
|
||||
return;
|
||||
|
||||
QPoint globalPoint = e->globalPos;
|
||||
QPointF globalPoint = e->globalPos;
|
||||
|
||||
qt_last_x = globalPoint.x();
|
||||
qt_last_y = globalPoint.y();
|
||||
|
@ -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();
|
||||
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 =
|
||||
new QWindowSystemInterfacePrivate::MouseEvent(tlw, timestamp, local, global, b);
|
||||
@ -162,12 +162,12 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestam
|
||||
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();
|
||||
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 =
|
||||
new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, d, o);
|
||||
|
@ -62,8 +62,8 @@ QT_MODULE(Gui)
|
||||
class Q_GUI_EXPORT QWindowSystemInterface
|
||||
{
|
||||
public:
|
||||
static void handleMouseEvent(QWindow *w, const QPoint & local, const QPoint & 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, const QPointF & local, const QPointF & 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, 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,
|
||||
ushort count = 1);
|
||||
|
||||
static void handleWheelEvent(QWindow *w, const QPoint & local, const QPoint & 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, const QPointF & local, const QPointF & 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 {
|
||||
int id; // for application use
|
||||
|
@ -135,20 +135,20 @@ public:
|
||||
|
||||
class MouseEvent : public UserEvent {
|
||||
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) { }
|
||||
QPoint localPos;
|
||||
QPoint globalPos;
|
||||
QPointF localPos;
|
||||
QPointF globalPos;
|
||||
Qt::MouseButtons buttons;
|
||||
};
|
||||
|
||||
class WheelEvent : public UserEvent {
|
||||
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) { }
|
||||
int delta;
|
||||
QPoint localPos;
|
||||
QPoint globalPos;
|
||||
QPointF localPos;
|
||||
QPointF globalPos;
|
||||
Qt::Orientation orient;
|
||||
};
|
||||
|
||||
|
@ -162,27 +162,27 @@ inline void QBezier::coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal &
|
||||
|
||||
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:
|
||||
qreal x, y;
|
||||
|
||||
qreal m_t = 1. - t;
|
||||
qreal a = x1*m_t + x2*t;
|
||||
qreal b = x2*m_t + x3*t;
|
||||
qreal c = x3*m_t + x4*t;
|
||||
a = a*m_t + b*t;
|
||||
b = b*m_t + c*t;
|
||||
qreal x = a*m_t + b*t;
|
||||
qreal a = y1*m_t + y2*t;
|
||||
qreal b = y2*m_t + y3*t;
|
||||
qreal c = y3*m_t + y4*t;
|
||||
a = a*m_t + b*t;
|
||||
b = b*m_t + c*t;
|
||||
qreal y = a*m_t + b*t;
|
||||
{
|
||||
qreal a = x1*m_t + x2*t;
|
||||
qreal b = x2*m_t + x3*t;
|
||||
qreal c = x3*m_t + x4*t;
|
||||
a = a*m_t + b*t;
|
||||
b = b*m_t + c*t;
|
||||
x = a*m_t + b*t;
|
||||
}
|
||||
{
|
||||
qreal a = y1*m_t + y2*t;
|
||||
qreal b = y2*m_t + y3*t;
|
||||
qreal c = y3*m_t + y4*t;
|
||||
a = a*m_t + b*t;
|
||||
b = b*m_t + c*t;
|
||||
y = a*m_t + b*t;
|
||||
}
|
||||
return QPointF(x, y);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline QPointF QBezier::normalVector(qreal t) const
|
||||
|
@ -1537,14 +1537,6 @@ bool QGradient::operator==(const QGradient &gradient) const
|
||||
return stops() == gradient.stops();
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
bool QGradient::operator==(const QGradient &gradient)
|
||||
{
|
||||
return const_cast<const QGradient *>(this)->operator==(gradient);
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QLinearGradient
|
||||
\ingroup painting
|
||||
|
@ -239,8 +239,6 @@ public:
|
||||
inline bool operator!=(const QGradient &other) const
|
||||
{ return !operator==(other); }
|
||||
|
||||
bool operator==(const QGradient &gradient); // ### Qt 5: remove
|
||||
|
||||
private:
|
||||
friend class QLinearGradient;
|
||||
friend class QRadialGradient;
|
||||
|
@ -275,7 +275,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
|
||||
if (!engine) {
|
||||
if (!request.family.isEmpty()) {
|
||||
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;
|
||||
def.family = fallbacks.at(i);
|
||||
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);
|
||||
if (engine) {
|
||||
initFontDef(desc, def, &engine->fontDef);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ private:
|
||||
struct GlyphCacheEntry {
|
||||
void *context;
|
||||
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;
|
||||
|
@ -224,7 +224,6 @@ QFontMetrics &QFontMetrics::operator=(const QFontMetrics &fm)
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
Returns true if \a other is equal to this object; otherwise
|
||||
returns false.
|
||||
|
||||
@ -239,21 +238,6 @@ bool QFontMetrics::operator ==(const QFontMetrics &other) const
|
||||
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)
|
||||
|
||||
@ -1118,7 +1102,6 @@ QFontMetricsF &QFontMetricsF::operator=(const QFontMetricsF &fm)
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
Returns true if the font metrics are equal to the \a other font
|
||||
metrics; otherwise returns false.
|
||||
|
||||
@ -1131,19 +1114,6 @@ bool QFontMetricsF::operator ==(const QFontMetricsF &other) const
|
||||
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)
|
||||
|
||||
|
@ -117,9 +117,7 @@ public:
|
||||
int strikeOutPos() const;
|
||||
int lineWidth() const;
|
||||
|
||||
bool operator==(const QFontMetrics &other); // 5.0 - remove me
|
||||
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); }
|
||||
|
||||
private:
|
||||
@ -183,9 +181,7 @@ public:
|
||||
qreal strikeOutPos() const;
|
||||
qreal lineWidth() const;
|
||||
|
||||
bool operator==(const QFontMetricsF &other); // 5.0 - remove me
|
||||
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); }
|
||||
|
||||
private:
|
||||
|
@ -45,6 +45,7 @@
|
||||
|
||||
#include "qglyphrun.h"
|
||||
#include "qglyphrun_p.h"
|
||||
#include <qdebug.h>
|
||||
|
||||
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
|
||||
*/
|
||||
QRectF QGlyphRun::boundingRect() const
|
||||
{
|
||||
if (!d->boundingRect.isEmpty())
|
||||
return d->boundingRect;
|
||||
|
||||
qreal minX, minY, maxX, maxY;
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if the QGlyphRun does not contain any glyphs.
|
||||
|
||||
\since 5.0
|
||||
*/
|
||||
bool QGlyphRun::isEmpty() const
|
||||
{
|
||||
return d->glyphIndexes.isEmpty();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_RAWFONT
|
||||
|
@ -91,8 +91,11 @@ public:
|
||||
void setStrikeOut(bool strikeOut);
|
||||
bool strikeOut() const;
|
||||
|
||||
void setBoundingRect(const QRectF &boundingRect);
|
||||
QRectF boundingRect() const;
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
private:
|
||||
friend class QGlyphRunPrivate;
|
||||
friend class QTextLine;
|
||||
|
@ -83,6 +83,7 @@ public:
|
||||
, glyphIndexes(other.glyphIndexes)
|
||||
, glyphPositions(other.glyphPositions)
|
||||
, rawFont(other.rawFont)
|
||||
, boundingRect(other.boundingRect)
|
||||
, overline(other.overline)
|
||||
, underline(other.underline)
|
||||
, strikeOut(other.strikeOut)
|
||||
@ -96,6 +97,7 @@ public:
|
||||
QVector<quint32> glyphIndexes;
|
||||
QVector<QPointF> glyphPositions;
|
||||
QRawFont rawFont;
|
||||
QRectF boundingRect;
|
||||
|
||||
uint overline : 1;
|
||||
uint underline : 1;
|
||||
|
@ -406,6 +406,8 @@ void QTextControlPrivate::init(Qt::TextFormat format, const QString &text, QText
|
||||
|
||||
doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable);
|
||||
q->setCursorWidth(-1);
|
||||
|
||||
QObject::connect(q, SIGNAL(updateCursorRequest(QRectF)), q, SIGNAL(updateRequest(QRectF)));
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
Q_Q(QTextControl);
|
||||
emit q->updateRequest(cursorRectPlusUnicodeDirectionMarkers(cursor));
|
||||
emit q->updateCursorRequest(cursorRectPlusUnicodeDirectionMarkers(cursor));
|
||||
}
|
||||
|
||||
void QTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelection)
|
||||
@ -562,9 +564,16 @@ void QTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelect
|
||||
differenceSelection.setPosition(cursor.position(), QTextCursor::KeepAnchor);
|
||||
emit q->updateRequest(q->selectionRect(differenceSelection));
|
||||
} else {
|
||||
if (!oldSelection.isNull())
|
||||
emit q->updateRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection));
|
||||
emit q->updateRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor));
|
||||
if (!oldSelection.hasSelection() && !cursor.hasSelection()) {
|
||||
if (!oldSelection.isNull())
|
||||
emit q->updateCursorRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection));
|
||||
emit q->updateCursorRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor));
|
||||
|
||||
} else {
|
||||
if (!oldSelection.isNull())
|
||||
emit q->updateRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection));
|
||||
emit q->updateRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2750,6 +2759,12 @@ void QTextControl::setPalette(const QPalette &pal)
|
||||
d->palette = pal;
|
||||
}
|
||||
|
||||
bool QTextControl::cursorOn() const
|
||||
{
|
||||
Q_D(const QTextControl);
|
||||
return d->cursorOn;
|
||||
}
|
||||
|
||||
QAbstractTextDocumentLayout::PaintContext QTextControl::getPaintContext() const
|
||||
{
|
||||
Q_D(const QTextControl);
|
||||
@ -2887,6 +2902,7 @@ void QTextEditMimeData::setup() const
|
||||
fragment = QTextDocumentFragment();
|
||||
}
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qtextcontrol_p.cpp"
|
||||
|
@ -215,6 +215,7 @@ Q_SIGNALS:
|
||||
void cursorPositionChanged();
|
||||
|
||||
// control signals
|
||||
void updateCursorRequest(const QRectF &rect = QRectF());
|
||||
void updateRequest(const QRectF &rect = QRectF());
|
||||
void documentSizeChanged(const QSizeF &);
|
||||
void blockCountChanged(int newBlockCount);
|
||||
@ -247,6 +248,8 @@ public:
|
||||
bool setFocusToNextOrPreviousAnchor(bool next);
|
||||
bool findNextPrevAnchor(const QTextCursor& from, bool next, QTextCursor& newAnchor);
|
||||
|
||||
bool cursorOn() const;
|
||||
|
||||
protected:
|
||||
virtual void timerEvent(QTimerEvent *e);
|
||||
|
||||
|
@ -1532,33 +1532,38 @@ void QTextEngine::itemize() const
|
||||
const ushort *e = uc + length;
|
||||
int lastScript = QUnicodeTables::Common;
|
||||
while (uc < e) {
|
||||
int script = QUnicodeTables::script(*uc);
|
||||
if (script == QUnicodeTables::Inherited)
|
||||
script = lastScript;
|
||||
analysis->flags = QScriptAnalysis::None;
|
||||
if (*uc == QChar::ObjectReplacementCharacter) {
|
||||
if (analysis->bidiLevel % 2)
|
||||
--analysis->bidiLevel;
|
||||
switch (*uc) {
|
||||
case QChar::ObjectReplacementCharacter:
|
||||
analysis->script = QUnicodeTables::Common;
|
||||
analysis->flags = QScriptAnalysis::Object;
|
||||
} else if (*uc == QChar::LineSeparator) {
|
||||
break;
|
||||
case QChar::LineSeparator:
|
||||
if (analysis->bidiLevel % 2)
|
||||
--analysis->bidiLevel;
|
||||
analysis->script = QUnicodeTables::Common;
|
||||
analysis->flags = QScriptAnalysis::LineOrParagraphSeparator;
|
||||
if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
|
||||
*const_cast<ushort*>(uc) = 0x21B5; // visual line separator
|
||||
} else if (*uc == 9) {
|
||||
break;
|
||||
case 9: // Tab
|
||||
analysis->script = QUnicodeTables::Common;
|
||||
analysis->flags = QScriptAnalysis::Tab;
|
||||
analysis->bidiLevel = control.baseLevel();
|
||||
} else if ((*uc == 32 || *uc == QChar::Nbsp)
|
||||
&& (option.flags() & QTextOption::ShowTabsAndSpaces)) {
|
||||
analysis->script = QUnicodeTables::Common;
|
||||
analysis->flags = QScriptAnalysis::Space;
|
||||
analysis->bidiLevel = control.baseLevel();
|
||||
} else {
|
||||
analysis->script = script;
|
||||
break;
|
||||
case 32: // Space
|
||||
case QChar::Nbsp:
|
||||
if (option.flags() & QTextOption::ShowTabsAndSpaces) {
|
||||
analysis->script = QUnicodeTables::Common;
|
||||
analysis->flags = QScriptAnalysis::Space;
|
||||
analysis->bidiLevel = control.baseLevel();
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
default:
|
||||
int script = QUnicodeTables::script(*uc);
|
||||
analysis->script = script == QUnicodeTables::Inherited ? lastScript : script;
|
||||
analysis->flags = QScriptAnalysis::None;
|
||||
break;
|
||||
}
|
||||
lastScript = analysis->script;
|
||||
++uc;
|
||||
@ -2432,7 +2437,7 @@ void QTextEngine::indexAdditionalFormats()
|
||||
between the text that gets truncated and the ellipsis. This is important to get
|
||||
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)
|
||||
++pos;
|
||||
@ -2441,13 +2446,14 @@ static bool nextCharJoins(const QString &string, int pos)
|
||||
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)
|
||||
--pos;
|
||||
if (pos == 0)
|
||||
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
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "qtextlayout.h"
|
||||
#include "qtextengine_p.h"
|
||||
|
||||
#include <qthread.h>
|
||||
#include <qfont.h>
|
||||
#include <qpainter.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,
|
||||
const QPointF &pos, const QTextItem::RenderFlags &flags)
|
||||
const QPointF &pos, const QTextItem::RenderFlags &flags,
|
||||
const QFixed &selectionX, const QFixed &selectionWidth)
|
||||
{
|
||||
QGlyphRun glyphRun;
|
||||
|
||||
@ -2115,6 +2118,7 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
|
||||
QRawFont font;
|
||||
QRawFontPrivate *fontD = QRawFontPrivate::get(font);
|
||||
fontD->fontEngine = fontEngine;
|
||||
fontD->thread = QThread::currentThread();
|
||||
fontD->fontEngine->ref.ref();
|
||||
|
||||
#if defined(Q_WS_WIN)
|
||||
@ -2149,13 +2153,27 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
|
||||
positionsArray);
|
||||
Q_ASSERT(glyphsArray.size() == positionsArray.size());
|
||||
|
||||
qreal fontHeight = font.ascent() + font.descent();
|
||||
qreal minY;
|
||||
qreal maxY;
|
||||
QVector<quint32> glyphs;
|
||||
QVector<QPointF> positions;
|
||||
for (int i=0; i<glyphsArray.size(); ++i) {
|
||||
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.setPositions(positions);
|
||||
|
||||
@ -2164,6 +2182,8 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
|
||||
glyphRun.setStrikeOut(flags.testFlag(QTextItem::StrikeOut));
|
||||
glyphRun.setRawFont(font);
|
||||
|
||||
glyphRun.setBoundingRect(QRectF(selectionX.toReal(), minY, selectionWidth.toReal(), height));
|
||||
|
||||
return glyphRun;
|
||||
}
|
||||
|
||||
@ -2180,7 +2200,6 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
|
||||
|
||||
\sa QTextLayout::glyphRuns()
|
||||
*/
|
||||
#if !defined(QT_NO_RAWFONT)
|
||||
QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
|
||||
{
|
||||
const QScriptLine &line = eng->lines[i];
|
||||
@ -2194,7 +2213,14 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
|
||||
if (length < 0)
|
||||
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();
|
||||
QList<QGlyphRun> glyphRuns;
|
||||
while (!iterator.atEnd()) {
|
||||
@ -2204,7 +2230,10 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
|
||||
|
||||
QPointF pos(iterator.x.toReal(), y);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2233,19 +2262,22 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
|
||||
? si.num_glyphs - 1
|
||||
: logClusters[relativeTo];
|
||||
|
||||
int itemGlyphsStart = logClusters[iterator.itemStart - si.position];
|
||||
int itemGlyphsEnd = logClusters[iterator.itemEnd - 1 - si.position];
|
||||
|
||||
QGlyphLayout glyphLayout = eng->shapedGlyphs(&si);
|
||||
|
||||
// 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
|
||||
// getGlyphPositions() is the left-most edge of the left-most glyph in an RTL run.
|
||||
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);
|
||||
pos += QPointF((glyphLayout.advances_x[i] + justification).toReal(),
|
||||
glyphLayout.advances_y[i].toReal());
|
||||
}
|
||||
} 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);
|
||||
pos += QPointF((glyphLayout.advances_x[i] + justification).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);
|
||||
|
||||
QFixed x;
|
||||
QFixed width;
|
||||
iterator.getSelectionBounds(&x, &width);
|
||||
|
||||
if (glyphLayout.numGlyphs > 0) {
|
||||
QFontEngine *mainFontEngine = font.d->engineForScript(si.analysis.script);
|
||||
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);
|
||||
glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which),
|
||||
subLayout, pos, flags));
|
||||
subLayout, pos, flags, x, width));
|
||||
for (int i = 0; i < subLayout.numGlyphs; i++) {
|
||||
pos += QPointF(subLayout.advances_x[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);
|
||||
glyphRuns.append(glyphRunWithInfo(multiFontEngine->engine(which),
|
||||
subLayout, pos, flags));
|
||||
QGlyphRun glyphRun = glyphRunWithInfo(multiFontEngine->engine(which),
|
||||
subLayout, pos, flags, x, width);
|
||||
if (!glyphRun.isEmpty())
|
||||
glyphRuns.append(glyphRun);
|
||||
} else {
|
||||
glyphRuns.append(glyphRunWithInfo(mainFontEngine, glyphLayout, pos, flags));
|
||||
QGlyphRun glyphRun = glyphRunWithInfo(mainFontEngine, glyphLayout, pos, flags, x,
|
||||
width);
|
||||
if (!glyphRun.isEmpty())
|
||||
glyphRuns.append(glyphRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1667,21 +1667,24 @@ QTextBlock::iterator &QTextBlock::iterator::operator--()
|
||||
\sa QGlyphRun, QTextBlock::layout(), QTextLayout::position(), QPainter::drawGlyphRun()
|
||||
*/
|
||||
#if !defined(QT_NO_RAWFONT)
|
||||
QList<QGlyphRun> QTextFragment::glyphRuns() const
|
||||
QList<QGlyphRun> QTextFragment::glyphRuns(int pos, int len) const
|
||||
{
|
||||
if (!p || !n)
|
||||
return QList<QGlyphRun>();
|
||||
|
||||
int pos = position();
|
||||
int len = length();
|
||||
if (len == 0)
|
||||
return QList<QGlyphRun>();
|
||||
|
||||
int blockNode = p->blockMap().findNode(pos);
|
||||
int blockNode = p->blockMap().findNode(position());
|
||||
|
||||
const QTextBlockData *blockData = p->blockMap().fragment(blockNode);
|
||||
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;
|
||||
for (int i=0; i<layout->lineCount(); ++i) {
|
||||
QTextLine textLine = layout->lineAt(i);
|
||||
|
@ -317,7 +317,7 @@ public:
|
||||
QString text() const;
|
||||
|
||||
#if !defined(QT_NO_RAWFONT)
|
||||
QList<QGlyphRun> glyphRuns() const;
|
||||
QList<QGlyphRun> glyphRuns(int from = -1, int length = -1) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -395,7 +395,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByt
|
||||
case Basic:
|
||||
if(realm.isEmpty())
|
||||
this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
|
||||
if (user.isEmpty())
|
||||
if (user.isEmpty() && password.isEmpty())
|
||||
phase = Done;
|
||||
break;
|
||||
case Ntlm:
|
||||
@ -406,7 +406,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByt
|
||||
this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm"));
|
||||
if (options.value("stale").toLower() == "true")
|
||||
phase = Start;
|
||||
if (user.isEmpty())
|
||||
if (user.isEmpty() && password.isEmpty())
|
||||
phase = Done;
|
||||
break;
|
||||
}
|
||||
|
@ -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
|
||||
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
|
||||
entry that the certificate is valid for. The entry may contain wildcards.
|
||||
|
||||
\sa QSslCertificate::alternateSubjectNames()
|
||||
\sa QSslCertificate::subjectAlternativeNames()
|
||||
|
||||
*/
|
||||
|
||||
|
@ -67,11 +67,15 @@ namespace QSsl {
|
||||
Dsa
|
||||
};
|
||||
|
||||
enum AlternateNameEntryType {
|
||||
enum AlternativeNameEntryType {
|
||||
EmailEntry,
|
||||
DnsEntry
|
||||
};
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5,0)
|
||||
typedef AlternativeNameEntryType AlternateNameEntryType;
|
||||
#endif
|
||||
|
||||
enum SslProtocol {
|
||||
SslV3,
|
||||
SslV2,
|
||||
|
@ -426,7 +426,7 @@ QList<QByteArray> QSslCertificate::issuerInfoAttributes() const
|
||||
|
||||
/*!
|
||||
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
|
||||
certificate.
|
||||
|
||||
@ -437,9 +437,9 @@ QList<QByteArray> QSslCertificate::issuerInfoAttributes() const
|
||||
|
||||
\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)
|
||||
return result;
|
||||
@ -922,7 +922,7 @@ QDebug operator<<(QDebug debug, const QSslCertificate &certificate)
|
||||
<< ',' << certificate.digest().toBase64()
|
||||
<< ',' << certificate.issuerInfo(QSslCertificate::Organization)
|
||||
<< ',' << certificate.subjectInfo(QSslCertificate::Organization)
|
||||
<< ',' << certificate.alternateSubjectNames()
|
||||
<< ',' << certificate.subjectAlternativeNames()
|
||||
#ifndef QT_NO_TEXTSTREAM
|
||||
<< ',' << certificate.effectiveDate()
|
||||
<< ',' << certificate.expiryDate()
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <QtCore/qcryptographichash.h>
|
||||
#include <QtCore/qregexp.h>
|
||||
#include <QtCore/qsharedpointer.h>
|
||||
#include <QtCore/qmap.h>
|
||||
#include <QtNetwork/qssl.h>
|
||||
|
||||
typedef struct x509_st X509; // ### check if this works
|
||||
@ -65,7 +66,6 @@ class QIODevice;
|
||||
class QSslError;
|
||||
class QSslKey;
|
||||
class QStringList;
|
||||
template <typename T, typename U> class QMultiMap;
|
||||
|
||||
class QSslCertificatePrivate;
|
||||
class Q_NETWORK_EXPORT QSslCertificate
|
||||
@ -106,7 +106,11 @@ public:
|
||||
QStringList subjectInfo(const QByteArray &attribute) const;
|
||||
QList<QByteArray> subjectInfoAttributes() 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 expiryDate() const;
|
||||
QSslKey publicKey() const;
|
||||
|
@ -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())) {
|
||||
return true;
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ public:
|
||||
bool useOpacityAttribute;
|
||||
bool usePmvMatrixAttribute;
|
||||
|
||||
bool operator==(const QGLEngineShaderProg& other) {
|
||||
bool operator==(const QGLEngineShaderProg& other) const {
|
||||
// We don't care about the program
|
||||
return ( mainVertexShader == other.mainVertexShader &&
|
||||
positionVertexShader == other.positionVertexShader &&
|
||||
|
@ -1776,16 +1776,12 @@ QString QAccessibleComboBox::text(Text t, int child) const
|
||||
|
||||
switch (t) {
|
||||
case Name:
|
||||
#ifndef Q_WS_X11 // on Linux we use relations for this, name is text (fall through to Value)
|
||||
if (child == OpenList)
|
||||
str = QComboBox::tr("Open");
|
||||
else
|
||||
str = QAccessibleWidgetEx::text(t, 0);
|
||||
break;
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
case Accelerator:
|
||||
if (child == OpenList)
|
||||
str = (QString)QKeySequence(Qt::Key_Down);
|
||||
// missing break?
|
||||
#endif
|
||||
case Value:
|
||||
if (comboBox()->isEditable())
|
||||
@ -1793,6 +1789,12 @@ QString QAccessibleComboBox::text(Text t, int child) const
|
||||
else
|
||||
str = comboBox()->currentText();
|
||||
break;
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
case Accelerator:
|
||||
if (child == OpenList)
|
||||
str = (QString)QKeySequence(Qt::Key_Down);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
1029
src/plugins/accessible/widgets/itemviews.cpp
Normal file
1029
src/plugins/accessible/widgets/itemviews.cpp
Normal file
File diff suppressed because it is too large
Load Diff
319
src/plugins/accessible/widgets/itemviews.h
Normal file
319
src/plugins/accessible/widgets/itemviews.h
Normal 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 ¶ms);
|
||||
#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 ¶ms);
|
||||
#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 ¶ms);
|
||||
#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
|
@ -44,11 +44,13 @@
|
||||
#include "simplewidgets.h"
|
||||
#include "rangecontrols.h"
|
||||
#include "complexwidgets.h"
|
||||
#include "itemviews.h"
|
||||
|
||||
#include <qaccessibleplugin.h>
|
||||
#include <qplugin.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qtoolbutton.h>
|
||||
#include <qtreeview.h>
|
||||
#include <qvariant.h>
|
||||
#include <qaccessible.h>
|
||||
|
||||
@ -56,6 +58,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class AccessibleFactory : public QAccessiblePlugin
|
||||
{
|
||||
public:
|
||||
@ -251,6 +254,22 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
|
||||
iface = new QAccessibleMenu(widget);
|
||||
#endif
|
||||
#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")) {
|
||||
iface = new QAccessibleHeader(widget);
|
||||
} else if (classname == QLatin1String("QAbstractItemView")) {
|
||||
@ -259,7 +278,8 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
|
||||
&& widget->objectName() == QLatin1String("qt_scrollarea_viewport")
|
||||
&& qobject_cast<QAbstractItemView*>(widget->parentWidget())) {
|
||||
iface = new QAccessibleItemView(widget);
|
||||
#endif
|
||||
#endif // Q_WS_X11
|
||||
#endif // QT_NO_ITEMVIEWS
|
||||
#ifndef QT_NO_TABBAR
|
||||
} else if (classname == QLatin1String("QTabBar")) {
|
||||
iface = new QAccessibleTabBar(widget);
|
||||
|
@ -73,6 +73,9 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
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)
|
||||
{
|
||||
if (widget == 0)
|
||||
@ -1139,8 +1142,8 @@ int QAccessibleTitleBar::childCount() const
|
||||
QString QAccessibleTitleBar::text(Text t, int child) const
|
||||
{
|
||||
if (!child) {
|
||||
if (t == Value) {
|
||||
return dockWidget()->windowTitle();
|
||||
if (t == Name || t == Value) {
|
||||
return qt_accStripAmp(dockWidget()->windowTitle());
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
@ -1171,17 +1174,19 @@ QAccessible::State QAccessibleTitleBar::state(int child) const
|
||||
return state;
|
||||
}
|
||||
|
||||
QRect QAccessibleTitleBar::rect (int child ) const
|
||||
QRect QAccessibleTitleBar::rect(int child) const
|
||||
{
|
||||
bool mapToGlobal = true;
|
||||
QRect rect;
|
||||
if (child == 0) {
|
||||
if (dockWidget()->isFloating()) {
|
||||
rect = dockWidget()->frameGeometry();
|
||||
QPoint globalPos = dockWidget()->mapToGlobal( dockWidget()->widget()->rect().topLeft() );
|
||||
globalPos.ry()--;
|
||||
rect.setBottom(globalPos.y());
|
||||
mapToGlobal = false;
|
||||
if (dockWidget()->widget()) {
|
||||
QPoint globalPos = dockWidget()->mapToGlobal(dockWidget()->widget()->rect().topLeft());
|
||||
globalPos.ry()--;
|
||||
rect.setBottom(globalPos.y());
|
||||
mapToGlobal = false;
|
||||
}
|
||||
} else {
|
||||
QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(dockWidget()->layout());
|
||||
rect = layout->titleArea();
|
||||
@ -1316,11 +1321,112 @@ void QAccessibleTextEdit::addSelection(int startOffset, int endOffset)
|
||||
|
||||
QString QAccessibleTextEdit::attributes(int offset, int *startOffset, int *endOffset)
|
||||
{
|
||||
// TODO - wait for a definition of attributes
|
||||
Q_UNUSED(offset);
|
||||
Q_UNUSED(startOffset);
|
||||
Q_UNUSED(endOffset);
|
||||
return QString();
|
||||
/* The list of attributes can be found at:
|
||||
http://linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2/textattributes
|
||||
*/
|
||||
|
||||
if (offset >= characterCount()) {
|
||||
*startOffset = -1;
|
||||
*endOffset = -1;
|
||||
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()
|
||||
@ -1435,9 +1541,9 @@ QString QAccessibleTextEdit::textAtOffset(int offset, BoundaryType boundaryType,
|
||||
if (offset >= characterCount())
|
||||
return QString();
|
||||
|
||||
cursor.setPosition(offset);
|
||||
switch (boundaryType) {
|
||||
case CharBoundary:
|
||||
cursor.setPosition(offset);
|
||||
*startOffset = cursor.position();
|
||||
cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
|
||||
*endOffset = cursor.position();
|
||||
|
@ -83,8 +83,6 @@ QAbstractSpinBox *QAccessibleAbstractSpinBox::abstractSpinBox() const
|
||||
/*! \reimp */
|
||||
int QAccessibleAbstractSpinBox::childCount() const
|
||||
{
|
||||
if (!abstractSpinBox()->isVisible())
|
||||
return 0;
|
||||
return ValueDown;
|
||||
}
|
||||
|
||||
@ -344,8 +342,6 @@ QDoubleSpinBox *QAccessibleDoubleSpinBox::doubleSpinBox() const
|
||||
/*! \reimp */
|
||||
int QAccessibleDoubleSpinBox::childCount() const
|
||||
{
|
||||
if (!doubleSpinBox()->isVisible())
|
||||
return 0;
|
||||
return ValueDown;
|
||||
}
|
||||
|
||||
@ -410,8 +406,6 @@ QVariant QAccessibleDoubleSpinBox::invokeMethodEx(QAccessible::Method, int, cons
|
||||
/*! \reimp */
|
||||
QString QAccessibleDoubleSpinBox::text(Text textType, int child) const
|
||||
{
|
||||
if (!doubleSpinBox()->isVisible())
|
||||
return QString();
|
||||
switch (textType) {
|
||||
case Name:
|
||||
if (child == ValueUp)
|
||||
@ -540,16 +534,12 @@ QRect QAccessibleScrollBar::rect(int child) const
|
||||
/*! \reimp */
|
||||
int QAccessibleScrollBar::childCount() const
|
||||
{
|
||||
if (!scrollBar()->isVisible())
|
||||
return 0;
|
||||
return LineDown;
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
QString QAccessibleScrollBar::text(Text t, int child) const
|
||||
{
|
||||
if (!scrollBar()->isVisible())
|
||||
return QString();
|
||||
switch (t) {
|
||||
case Value:
|
||||
if (!child || child == Position)
|
||||
@ -698,16 +688,12 @@ QRect QAccessibleSlider::rect(int child) const
|
||||
/*! \reimp */
|
||||
int QAccessibleSlider::childCount() const
|
||||
{
|
||||
if (!slider()->isVisible())
|
||||
return 0;
|
||||
return PageRight;
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
QString QAccessibleSlider::text(Text t, int child) const
|
||||
{
|
||||
if (!slider()->isVisible())
|
||||
return QString();
|
||||
switch (t) {
|
||||
case Value:
|
||||
if (!child || child == 2)
|
||||
@ -932,15 +918,11 @@ QRect QAccessibleDial::rect(int child) const
|
||||
|
||||
int QAccessibleDial::childCount() const
|
||||
{
|
||||
if (!dial()->isVisible())
|
||||
return 0;
|
||||
return SliderHandle;
|
||||
}
|
||||
|
||||
QString QAccessibleDial::text(Text textType, int child) const
|
||||
{
|
||||
if (!dial()->isVisible())
|
||||
return QString();
|
||||
if (textType == Value && child >= Self && child <= SliderHandle)
|
||||
return QString::number(dial()->value());
|
||||
if (textType == Name) {
|
||||
|
@ -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_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
|
||||
\brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets.
|
||||
@ -176,7 +183,7 @@ QString QAccessibleButton::text(Text t, int child) const
|
||||
break;
|
||||
}
|
||||
if (str.isEmpty())
|
||||
str = QAccessibleWidgetEx::text(t, child);;
|
||||
str = QAccessibleWidgetEx::text(t, child);
|
||||
return qt_accStripAmp(str);
|
||||
}
|
||||
|
||||
@ -396,7 +403,7 @@ QString QAccessibleToolButton::text(Text t, int child) const
|
||||
QString str;
|
||||
switch (t) {
|
||||
case Name:
|
||||
str = toolButton()->text();
|
||||
str = toolButton()->accessibleName();
|
||||
if (str.isEmpty())
|
||||
str = toolButton()->text();
|
||||
break;
|
||||
@ -703,7 +710,14 @@ void QAccessibleLineEdit::setText(Text t, int control, const QString &text)
|
||||
QAccessibleWidgetEx::setText(t, control, text);
|
||||
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 */
|
||||
@ -801,28 +815,41 @@ QString QAccessibleLineEdit::text(int startOffset, int endOffset)
|
||||
{
|
||||
if (startOffset > endOffset)
|
||||
return QString();
|
||||
|
||||
if (lineEdit()->echoMode() != QLineEdit::Normal)
|
||||
return QString();
|
||||
|
||||
return lineEdit()->text().mid(startOffset, endOffset - startOffset);
|
||||
}
|
||||
|
||||
QString QAccessibleLineEdit::textBeforeOffset (int /*offset*/, BoundaryType /*boundaryType*/,
|
||||
int * /*startOffset*/, int * /*endOffset*/)
|
||||
QString QAccessibleLineEdit::textBeforeOffset(int offset, BoundaryType boundaryType,
|
||||
int *startOffset, int *endOffset)
|
||||
{
|
||||
// TODO
|
||||
return QString();
|
||||
if (lineEdit()->echoMode() != QLineEdit::Normal) {
|
||||
*startOffset = *endOffset = -1;
|
||||
return QString();
|
||||
}
|
||||
return qTextBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
|
||||
}
|
||||
|
||||
QString QAccessibleLineEdit::textAfterOffset(int /*offset*/, BoundaryType /*boundaryType*/,
|
||||
int * /*startOffset*/, int * /*endOffset*/)
|
||||
QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryType,
|
||||
int *startOffset, int *endOffset)
|
||||
{
|
||||
// TODO
|
||||
return QString();
|
||||
if (lineEdit()->echoMode() != QLineEdit::Normal) {
|
||||
*startOffset = *endOffset = -1;
|
||||
return QString();
|
||||
}
|
||||
return qTextAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
|
||||
}
|
||||
|
||||
QString QAccessibleLineEdit::textAtOffset(int /*offset*/, BoundaryType /*boundaryType*/,
|
||||
int * /*startOffset*/, int * /*endOffset*/)
|
||||
QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType,
|
||||
int *startOffset, int *endOffset)
|
||||
{
|
||||
// TODO
|
||||
return QString();
|
||||
if (lineEdit()->echoMode() != QLineEdit::Normal) {
|
||||
*startOffset = *endOffset = -1;
|
||||
return QString();
|
||||
}
|
||||
return qTextAtOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text());
|
||||
}
|
||||
|
||||
void QAccessibleLineEdit::removeSelection(int selectionIndex)
|
||||
|
@ -8,14 +8,18 @@ DESTDIR = $$QT.gui.plugins/accessible
|
||||
QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)"
|
||||
|
||||
SOURCES += main.cpp \
|
||||
simplewidgets.cpp \
|
||||
rangecontrols.cpp \
|
||||
complexwidgets.cpp \
|
||||
qaccessiblewidgets.cpp \
|
||||
qaccessiblemenu.cpp
|
||||
simplewidgets.cpp \
|
||||
rangecontrols.cpp \
|
||||
complexwidgets.cpp \
|
||||
qaccessiblewidgets.cpp \
|
||||
qaccessiblemenu.cpp \
|
||||
itemviews.cpp
|
||||
|
||||
HEADERS += qaccessiblewidgets.h \
|
||||
simplewidgets.h \
|
||||
rangecontrols.h \
|
||||
complexwidgets.h \
|
||||
qaccessiblemenu.h
|
||||
simplewidgets.h \
|
||||
rangecontrols.h \
|
||||
complexwidgets.h \
|
||||
qaccessiblemenu.h \
|
||||
itemviews.h
|
||||
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "qwaylandclipboard.h"
|
||||
#include "qwaylanddisplay.h"
|
||||
#include "qwaylandinputdevice.h"
|
||||
#include "qwaylandmime.h"
|
||||
#include <QtGui/QPlatformNativeInterface>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtCore/QMimeData>
|
||||
@ -49,10 +50,11 @@
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QtDebug>
|
||||
#include <QtGui/private/qdnd_p.h>
|
||||
#include <QtCore/private/qcore_unix_p.h> // for QT_READ
|
||||
|
||||
static QWaylandClipboard *clipboard = 0;
|
||||
|
||||
class QWaylandMimeData : public QInternalMimeData
|
||||
class QWaylandClipboardMimeData : public QInternalMimeData
|
||||
{
|
||||
public:
|
||||
void clearAll();
|
||||
@ -64,28 +66,28 @@ private:
|
||||
QStringList mFormatList;
|
||||
};
|
||||
|
||||
void QWaylandMimeData::clearAll()
|
||||
void QWaylandClipboardMimeData::clearAll()
|
||||
{
|
||||
clear();
|
||||
mFormatList.clear();
|
||||
}
|
||||
|
||||
void QWaylandMimeData::setFormats(const QStringList &formatList)
|
||||
void QWaylandClipboardMimeData::setFormats(const QStringList &formatList)
|
||||
{
|
||||
mFormatList = formatList;
|
||||
}
|
||||
|
||||
bool QWaylandMimeData::hasFormat_sys(const QString &mimeType) const
|
||||
bool QWaylandClipboardMimeData::hasFormat_sys(const QString &mimeType) const
|
||||
{
|
||||
return formats().contains(mimeType);
|
||||
}
|
||||
|
||||
QStringList QWaylandMimeData::formats_sys() const
|
||||
QStringList QWaylandClipboardMimeData::formats_sys() const
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -147,7 +149,7 @@ void QWaylandSelection::send(void *data,
|
||||
Q_UNUSED(selection);
|
||||
QWaylandSelection *self = static_cast<QWaylandSelection *>(data);
|
||||
QString mimeType = QString::fromLatin1(mime_type);
|
||||
QByteArray content = self->mMimeData->data(mimeType);
|
||||
QByteArray content = QWaylandMimeHelper::getByteArray(self->mMimeData, mimeType);
|
||||
if (!content.isEmpty()) {
|
||||
QFile f;
|
||||
if (f.open(fd, QIODevice::WriteOnly))
|
||||
@ -218,7 +220,7 @@ QVariant QWaylandClipboard::retrieveData(const QString &mimeType, QVariant::Type
|
||||
char buf[256];
|
||||
int n;
|
||||
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);
|
||||
close(pipefd[0]);
|
||||
return content;
|
||||
@ -230,7 +232,7 @@ QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
|
||||
if (!mSelections.isEmpty())
|
||||
return mSelections.last()->mMimeData;
|
||||
if (!mMimeDataIn)
|
||||
mMimeDataIn = new QWaylandMimeData;
|
||||
mMimeDataIn = new QWaylandClipboardMimeData;
|
||||
mMimeDataIn->clearAll();
|
||||
if (!mOfferedMimeTypes.isEmpty() && mOffer)
|
||||
mMimeDataIn->setFormats(mOfferedMimeTypes);
|
||||
|
@ -48,7 +48,7 @@
|
||||
|
||||
class QWaylandDisplay;
|
||||
class QWaylandSelection;
|
||||
class QWaylandMimeData;
|
||||
class QWaylandClipboardMimeData;
|
||||
struct wl_selection_offer;
|
||||
|
||||
class QWaylandClipboardSignalEmitter : public QObject
|
||||
@ -90,7 +90,7 @@ private:
|
||||
static void forceRoundtrip(struct wl_display *display);
|
||||
|
||||
QWaylandDisplay *mDisplay;
|
||||
QWaylandMimeData *mMimeDataIn;
|
||||
QWaylandClipboardMimeData *mMimeDataIn;
|
||||
QList<QWaylandSelection *> mSelections;
|
||||
QStringList mOfferedMimeTypes;
|
||||
struct wl_selection_offer *mOffer;
|
||||
|
83
src/plugins/platforms/wayland/qwaylandmime.cpp
Normal file
83
src/plugins/platforms/wayland/qwaylandmime.cpp
Normal 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;
|
||||
}
|
55
src/plugins/platforms/wayland/qwaylandmime.h
Normal file
55
src/plugins/platforms/wayland/qwaylandmime.h
Normal 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
|
@ -25,7 +25,8 @@ SOURCES = main.cpp \
|
||||
qwaylandscreen.cpp \
|
||||
qwaylandshmwindow.cpp \
|
||||
qwaylandclipboard.cpp \
|
||||
qwaylanddnd.cpp
|
||||
qwaylanddnd.cpp \
|
||||
qwaylandmime.cpp
|
||||
|
||||
HEADERS = qwaylandintegration.h \
|
||||
qwaylandnativeinterface.h \
|
||||
@ -37,7 +38,8 @@ HEADERS = qwaylandintegration.h \
|
||||
qwaylandbuffer.h \
|
||||
qwaylandshmwindow.h \
|
||||
qwaylandclipboard.h \
|
||||
qwaylanddnd.h
|
||||
qwaylanddnd.h \
|
||||
qwaylandmime.h
|
||||
|
||||
INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND
|
||||
LIBS += $$QMAKE_LIBS_WAYLAND
|
||||
|
@ -53,7 +53,17 @@
|
||||
#include "qdri2context.h"
|
||||
#endif
|
||||
|
||||
#define class class_name // Yeah, in 2011 ...
|
||||
#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/qwindow_p.h>
|
||||
|
@ -123,6 +123,26 @@ QSqlError& QSqlError::operator=(const QSqlError& other)
|
||||
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.
|
||||
*/
|
||||
|
@ -66,6 +66,8 @@ public:
|
||||
int number = -1);
|
||||
QSqlError(const QSqlError& other);
|
||||
QSqlError& operator=(const QSqlError& other);
|
||||
bool operator==(const QSqlError& other);
|
||||
bool operator!=(const QSqlError& other);
|
||||
~QSqlError();
|
||||
|
||||
QString driverText() const;
|
||||
|
@ -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"
|
||||
" -iterations n : Sets the number of accumulation iterations.\n"
|
||||
" -median n : Sets the number of median iterations.\n"
|
||||
" -vb : Print out verbose benchmarking information.\n"
|
||||
"\n"
|
||||
" -help : This help\n";
|
||||
" -vb : Print out verbose benchmarking information.\n";
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
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"
|
||||
" By default, all testfunctions will be run.\n\n"
|
||||
"%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);
|
||||
} else if (strcmp(argv[i], "-functions") == 0) {
|
||||
if (qml) {
|
||||
@ -1228,6 +1237,16 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
||||
}
|
||||
} else if (argv[i][0] == '-') {
|
||||
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);
|
||||
} else if (qml) {
|
||||
// We can't check the availability of test functions until
|
||||
|
@ -76,12 +76,9 @@ namespace QTest
|
||||
#if defined(Q_WS_X11)
|
||||
qt_x11_wait_for_window_manager(window);
|
||||
QCoreApplication::processEvents();
|
||||
#elif defined(Q_WS_QWS)
|
||||
Q_UNUSED(window);
|
||||
qWait(100);
|
||||
#else
|
||||
Q_UNUSED(window);
|
||||
qWait(50);
|
||||
qWait(200);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -62,17 +62,8 @@
|
||||
#include <QtCore/QXmlStreamWriter>
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(QT_UIC3)
|
||||
#define QUILOADER_QDOM_READ
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
class QDomElement;
|
||||
#endif
|
||||
|
||||
|
||||
#define QDESIGNER_UILIB_EXTERN Q_DECL_EXPORT
|
||||
#define QDESIGNER_UILIB_IMPORT Q_DECL_IMPORT
|
||||
|
||||
@ -174,9 +165,6 @@ public:
|
||||
~DomUI();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -374,9 +362,6 @@ public:
|
||||
~DomIncludes();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -408,9 +393,6 @@ public:
|
||||
~DomInclude();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -451,9 +433,6 @@ public:
|
||||
~DomResources();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -493,9 +472,6 @@ public:
|
||||
~DomResource();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -528,9 +504,6 @@ public:
|
||||
~DomActionGroup();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -585,9 +558,6 @@ public:
|
||||
~DomAction();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -640,9 +610,6 @@ public:
|
||||
~DomActionRef();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -675,9 +642,6 @@ public:
|
||||
~DomButtonGroup();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -722,9 +686,6 @@ public:
|
||||
~DomButtonGroups();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -756,9 +717,6 @@ public:
|
||||
~DomImages();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -790,9 +748,6 @@ public:
|
||||
~DomImage();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -835,9 +790,6 @@ public:
|
||||
~DomImageData();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -878,9 +830,6 @@ public:
|
||||
~DomCustomWidgets();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -912,9 +861,6 @@ public:
|
||||
~DomHeader();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -947,9 +893,6 @@ public:
|
||||
~DomCustomWidget();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1067,9 +1010,6 @@ public:
|
||||
~DomProperties();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1101,9 +1041,6 @@ public:
|
||||
~DomPropertyData();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1136,9 +1073,6 @@ public:
|
||||
~DomSizePolicyData();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1179,9 +1113,6 @@ public:
|
||||
~DomLayoutDefault();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1222,9 +1153,6 @@ public:
|
||||
~DomLayoutFunction();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1265,9 +1193,6 @@ public:
|
||||
~DomTabStops();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1299,9 +1224,6 @@ public:
|
||||
~DomLayout();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1399,9 +1321,6 @@ public:
|
||||
~DomLayoutItem();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1484,9 +1403,6 @@ public:
|
||||
~DomRow();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1518,9 +1434,6 @@ public:
|
||||
~DomColumn();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1552,9 +1465,6 @@ public:
|
||||
~DomItem();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1607,9 +1517,6 @@ public:
|
||||
~DomWidget();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1730,9 +1637,6 @@ public:
|
||||
~DomSpacer();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1772,9 +1676,6 @@ public:
|
||||
~DomColor();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1830,9 +1731,6 @@ public:
|
||||
~DomGradientStop();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -1875,9 +1773,6 @@ public:
|
||||
~DomGradient();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2013,9 +1908,6 @@ public:
|
||||
~DomBrush();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2066,9 +1958,6 @@ public:
|
||||
~DomColorRole();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2111,9 +2000,6 @@ public:
|
||||
~DomColorGroup();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2150,9 +2036,6 @@ public:
|
||||
~DomPalette();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2203,9 +2086,6 @@ public:
|
||||
~DomFont();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2302,9 +2182,6 @@ public:
|
||||
~DomPoint();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2345,9 +2222,6 @@ public:
|
||||
~DomRect();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2402,9 +2276,6 @@ public:
|
||||
~DomLocale();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2445,9 +2316,6 @@ public:
|
||||
~DomSizePolicy();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2518,9 +2386,6 @@ public:
|
||||
~DomSize();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2561,9 +2426,6 @@ public:
|
||||
~DomDate();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2611,9 +2473,6 @@ public:
|
||||
~DomTime();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2661,9 +2520,6 @@ public:
|
||||
~DomDateTime();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2732,9 +2588,6 @@ public:
|
||||
~DomStringList();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2766,9 +2619,6 @@ public:
|
||||
~DomResourcePixmap();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2809,9 +2659,6 @@ public:
|
||||
~DomResourceIcon();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2918,9 +2765,6 @@ public:
|
||||
~DomString();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -2969,9 +2813,6 @@ public:
|
||||
~DomPointF();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3012,9 +2853,6 @@ public:
|
||||
~DomRectF();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3069,9 +2907,6 @@ public:
|
||||
~DomSizeF();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3112,9 +2947,6 @@ public:
|
||||
~DomChar();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3148,9 +2980,6 @@ public:
|
||||
~DomUrl();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3185,9 +3014,6 @@ public:
|
||||
~DomProperty();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3384,9 +3210,6 @@ public:
|
||||
~DomConnections();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3418,9 +3241,6 @@ public:
|
||||
~DomConnection();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3483,9 +3303,6 @@ public:
|
||||
~DomConnectionHints();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3517,9 +3334,6 @@ public:
|
||||
~DomConnectionHint();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3568,9 +3382,6 @@ public:
|
||||
~DomScript();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3611,9 +3422,6 @@ public:
|
||||
~DomWidgetData();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3645,9 +3453,6 @@ public:
|
||||
~DomDesignerData();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3679,9 +3484,6 @@ public:
|
||||
~DomSlots();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3718,9 +3520,6 @@ public:
|
||||
~DomPropertySpecifications();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
@ -3752,9 +3551,6 @@ public:
|
||||
~DomStringPropertySpecification();
|
||||
|
||||
void read(QXmlStreamReader &reader);
|
||||
#ifdef QUILOADER_QDOM_READ
|
||||
void read(const QDomElement &node);
|
||||
#endif
|
||||
void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const;
|
||||
inline QString text() const { return m_text; }
|
||||
inline void setText(const QString &s) { m_text = s; }
|
||||
|
@ -1,7 +1,7 @@
|
||||
QPRO_PWD = $$PWD
|
||||
TEMPLATE = lib
|
||||
TARGET = $$qtLibraryTarget(QtUiTools)
|
||||
QT = core xml
|
||||
QT = core
|
||||
|
||||
CONFIG += qt staticlib module
|
||||
MODULE = uitools
|
||||
@ -56,5 +56,4 @@ unix|win32-g++* {
|
||||
QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
|
||||
QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
|
||||
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
|
||||
QMAKE_PKGCONFIG_REQUIRES += QtXml
|
||||
}
|
||||
|
@ -1047,6 +1047,11 @@ const QAccessibleInterface *other, int otherChild) const
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QAccessibleTable2Interface *QAccessibleInterface::table2Interface()
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QAccessibleActionInterface *QAccessibleInterface::actionInterface()
|
||||
\internal
|
||||
|
@ -151,6 +151,7 @@ public:
|
||||
ReadOnly = 0x00000040,
|
||||
HotTracked = 0x00000080,
|
||||
DefaultButton = 0x00000100,
|
||||
// #### Qt5 Expandable
|
||||
Expanded = 0x00000200,
|
||||
Collapsed = 0x00000400,
|
||||
Busy = 0x00000800,
|
||||
@ -175,6 +176,8 @@ public:
|
||||
HasPopup = 0x40000000,
|
||||
Modal = 0x80000000,
|
||||
|
||||
// #### Qt5 ManagesDescendants
|
||||
// #### Qt5 remove HasInvokeExtension
|
||||
HasInvokeExtension = 0x10000000 // internal
|
||||
};
|
||||
Q_DECLARE_FLAGS(State, StateFlag)
|
||||
@ -345,7 +348,8 @@ namespace QAccessible2
|
||||
ValueInterface,
|
||||
TableInterface,
|
||||
ActionInterface,
|
||||
ImageInterface
|
||||
ImageInterface,
|
||||
Table2Interface
|
||||
};
|
||||
}
|
||||
|
||||
@ -356,6 +360,7 @@ class QAccessibleValueInterface;
|
||||
class QAccessibleTableInterface;
|
||||
class QAccessibleActionInterface;
|
||||
class QAccessibleImageInterface;
|
||||
class QAccessibleTable2Interface;
|
||||
|
||||
class Q_WIDGETS_EXPORT QAccessibleInterface : public QAccessible
|
||||
{
|
||||
@ -419,6 +424,9 @@ public:
|
||||
inline QAccessibleImageInterface *imageInterface()
|
||||
{ return reinterpret_cast<QAccessibleImageInterface *>(cast_helper(QAccessible2::ImageInterface)); }
|
||||
|
||||
inline QAccessibleTable2Interface *table2Interface()
|
||||
{ return reinterpret_cast<QAccessibleTable2Interface *>(cast_helper(QAccessible2::Table2Interface)); }
|
||||
|
||||
private:
|
||||
QAccessible2Interface *cast_helper(QAccessible2::InterfaceType);
|
||||
};
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "qaccessible2.h"
|
||||
#include "qapplication.h"
|
||||
#include "qclipboard.h"
|
||||
#include "qtextboundaryfinder.h"
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
||||
@ -132,6 +133,117 @@ QT_BEGIN_NAMESPACE
|
||||
\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(
|
||||
QAccessibleInterface *accessibleInterface)
|
||||
: iface(accessibleInterface)
|
||||
|
@ -52,6 +52,8 @@ QT_MODULE(Gui)
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
||||
class QModelIndex;
|
||||
|
||||
namespace QAccessible2
|
||||
{
|
||||
enum CoordinateType
|
||||
@ -68,6 +70,24 @@ namespace QAccessible2
|
||||
LineBoundary,
|
||||
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
|
||||
@ -83,6 +103,7 @@ inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return 0; }
|
||||
inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; }
|
||||
inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; }
|
||||
inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; }
|
||||
inline QAccessible2Interface *qAccessibleTable2CastHelper() { return 0; }
|
||||
|
||||
#define Q_ACCESSIBLE_OBJECT \
|
||||
public: \
|
||||
@ -101,6 +122,8 @@ inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; }
|
||||
return qAccessibleActionCastHelper(); \
|
||||
case QAccessible2::ImageInterface: \
|
||||
return qAccessibleImageCastHelper(); \
|
||||
case QAccessible2::Table2Interface: \
|
||||
return qAccessibleTable2CastHelper(); \
|
||||
} \
|
||||
return 0; \
|
||||
} \
|
||||
@ -214,6 +237,95 @@ public:
|
||||
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
|
||||
{
|
||||
public:
|
||||
|
@ -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
|
||||
// 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.
|
||||
QAInterface interface = accessibleHierarchyManager()->lookup(element);
|
||||
if (interface.isValid()) {
|
||||
|
@ -103,6 +103,17 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
|
||||
if (!iface)
|
||||
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)
|
||||
bridges()->at(i)->notifyAccessibilityUpdate(reason, iface, who);
|
||||
delete iface;
|
||||
|
@ -704,13 +704,16 @@ int QAccessibleWidget::navigate(RelationFlag relation, int entry,
|
||||
int sibCount = pIface->childCount();
|
||||
QAccessibleInterface *candidate = 0;
|
||||
for (int i = 0; i < sibCount && entry; ++i) {
|
||||
pIface->navigate(Child, i+1, &candidate);
|
||||
Q_ASSERT(candidate);
|
||||
if (candidate->relationTo(0, this, 0) & Label)
|
||||
const int childId = pIface->navigate(Child, i+1, &candidate);
|
||||
Q_ASSERT(childId >= 0);
|
||||
if (childId > 0)
|
||||
candidate = pIface;
|
||||
if (candidate->relationTo(childId, this, 0) & Label)
|
||||
--entry;
|
||||
if (!entry)
|
||||
break;
|
||||
delete candidate;
|
||||
if (candidate != pIface)
|
||||
delete candidate;
|
||||
candidate = 0;
|
||||
}
|
||||
if (!candidate) {
|
||||
|
@ -1171,24 +1171,26 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
|
||||
// Update focus scope item ptr in new scope.
|
||||
QGraphicsItem *newFocusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem;
|
||||
if (newFocusScopeItem && newParent) {
|
||||
if (subFocusItem) {
|
||||
// Find the subFocusItem's topmost focus scope.
|
||||
QGraphicsItem *ancestorScope = 0;
|
||||
QGraphicsItem *p = subFocusItem->d_ptr->parent;
|
||||
while (p) {
|
||||
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope)
|
||||
ancestorScope = p;
|
||||
if (p->d_ptr->flags & QGraphicsItem::ItemIsPanel)
|
||||
break;
|
||||
p = p->d_ptr->parent;
|
||||
}
|
||||
if (ancestorScope)
|
||||
newFocusScopeItem = ancestorScope;
|
||||
}
|
||||
|
||||
QGraphicsItem *p = newParent;
|
||||
while (p) {
|
||||
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
|
||||
if (subFocusItem && subFocusItem != q_ptr) {
|
||||
// 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;
|
||||
if (p2 == q_ptr)
|
||||
break;
|
||||
p2 = p2->d_ptr->parent;
|
||||
}
|
||||
if (ancestorScope)
|
||||
newFocusScopeItem = ancestorScope;
|
||||
}
|
||||
|
||||
p->d_ptr->focusScopeItem = newFocusScopeItem;
|
||||
newFocusScopeItem->d_ptr->focusScopeItemChange(true);
|
||||
// Ensure the new item is no longer the subFocusItem. The
|
||||
|
@ -98,9 +98,9 @@ public:
|
||||
inline QStyle *style() const { return m_style; }
|
||||
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; }
|
||||
inline bool operator!=(const QLayoutStyleInfo &other)
|
||||
inline bool operator!=(const QLayoutStyleInfo &other) const
|
||||
{ return !(*this == other); }
|
||||
|
||||
inline void setDefaultSpacing(Qt::Orientation o, qreal spacing){
|
||||
|
@ -60,6 +60,7 @@
|
||||
#include <private/qabstractitemmodel_p.h>
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#include <qaccessible.h>
|
||||
#include <qaccessible2.h>
|
||||
#endif
|
||||
#include <private/qsoftkeymanager_p.h>
|
||||
#ifndef QT_NO_GESTURE
|
||||
@ -682,6 +683,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
|
||||
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
|
||||
disconnect(d->model, SIGNAL(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)),
|
||||
this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));
|
||||
disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
|
||||
@ -712,6 +715,8 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
|
||||
this, SLOT(_q_headerDataChanged()));
|
||||
connect(d->model, SIGNAL(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)),
|
||||
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
|
||||
connect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
|
||||
@ -1095,6 +1100,14 @@ void QAbstractItemView::reset()
|
||||
setRootIndex(QModelIndex());
|
||||
if (d->selectionModel)
|
||||
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)
|
||||
{
|
||||
Q_UNUSED(steps);
|
||||
Q_UNUSED(steps)
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@ -2878,7 +2891,7 @@ int QAbstractItemView::horizontalStepsPerItem() const
|
||||
*/
|
||||
void QAbstractItemView::setVerticalStepsPerItem(int steps)
|
||||
{
|
||||
Q_UNUSED(steps);
|
||||
Q_UNUSED(steps)
|
||||
// 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
|
||||
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);
|
||||
if (q->isVisible())
|
||||
q->updateEditorGeometries();
|
||||
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
|
||||
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);
|
||||
if (q->isVisible())
|
||||
q->updateEditorGeometries();
|
||||
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
|
||||
|
||||
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);
|
||||
if (q->isVisible())
|
||||
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
|
||||
*/
|
||||
@ -3417,7 +3487,16 @@ void QAbstractItemViewPrivate::_q_modelDestroyed()
|
||||
*/
|
||||
void QAbstractItemViewPrivate::_q_layoutChanged()
|
||||
{
|
||||
Q_Q(QAbstractItemView);
|
||||
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(
|
||||
const QModelIndex &index, const QEvent *event) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
Q_UNUSED(index)
|
||||
|
||||
if (event) {
|
||||
switch (event->type()) {
|
||||
|
@ -355,6 +355,7 @@ private:
|
||||
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_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_modelDestroyed())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged())
|
||||
|
@ -108,6 +108,7 @@ public:
|
||||
void init();
|
||||
|
||||
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_columnsRemoved(const QModelIndex &parent, int start, int end);
|
||||
virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end);
|
||||
|
@ -3169,7 +3169,11 @@ void QListView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr
|
||||
if (QAccessible::isActive()) {
|
||||
if (current.isValid()) {
|
||||
int entry = visualIndex(current) + 1;
|
||||
#ifdef Q_WS_X11
|
||||
QAccessible::updateAccessibility(this, entry, QAccessible::Focus);
|
||||
#else
|
||||
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -3188,12 +3192,20 @@ void QListView::selectionChanged(const QItemSelection &selected,
|
||||
QModelIndex sel = selected.indexes().value(0);
|
||||
if (sel.isValid()) {
|
||||
int entry = visualIndex(sel) + 1;
|
||||
#ifdef Q_WS_X11
|
||||
QAccessible::updateAccessibility(this, entry, QAccessible::Selection);
|
||||
#else
|
||||
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection);
|
||||
#endif
|
||||
}
|
||||
QModelIndex desel = deselected.indexes().value(0);
|
||||
if (desel.isValid()) {
|
||||
int entry = visualIndex(desel) + 1;
|
||||
#ifdef Q_WS_X11
|
||||
QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove);
|
||||
#else
|
||||
QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -3164,10 +3164,16 @@ void QTableView::currentChanged(const QModelIndex ¤t, const QModelIndex &p
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (QAccessible::isActive()) {
|
||||
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;
|
||||
if (horizontalHeader())
|
||||
++entry;
|
||||
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -3180,22 +3186,33 @@ void QTableView::currentChanged(const QModelIndex ¤t, const QModelIndex &p
|
||||
void QTableView::selectionChanged(const QItemSelection &selected,
|
||||
const QItemSelection &deselected)
|
||||
{
|
||||
Q_D(QTableView);
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (QAccessible::isActive()) {
|
||||
// ### does not work properly for selection ranges.
|
||||
QModelIndex sel = selected.indexes().value(0);
|
||||
if (sel.isValid()) {
|
||||
#ifdef Q_WS_X11
|
||||
int entry = d->accessibleTable2Index(sel);
|
||||
QAccessible::updateAccessibility(this, entry, QAccessible::Selection);
|
||||
#else
|
||||
int entry = visualIndex(sel);
|
||||
if (horizontalHeader())
|
||||
++entry;
|
||||
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection);
|
||||
#endif
|
||||
}
|
||||
QModelIndex desel = deselected.indexes().value(0);
|
||||
if (desel.isValid()) {
|
||||
#ifdef Q_WS_X11
|
||||
int entry = d->accessibleTable2Index(sel);
|
||||
QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove);
|
||||
#else
|
||||
int entry = visualIndex(sel);
|
||||
if (horizontalHeader())
|
||||
++entry;
|
||||
QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -167,6 +167,11 @@ public:
|
||||
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 sectionSpanSize(const QHeaderView *header, int logical, int span) const;
|
||||
bool spanContainsSection(const QHeaderView *header, int logical, int spanLogical, int span) const;
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <qdebug.h>
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#include <qaccessible.h>
|
||||
#include <qaccessible2.h>
|
||||
#endif
|
||||
|
||||
#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)
|
||||
{
|
||||
Q_Q(QTreeView);
|
||||
viewItems.insert(pos, count, viewItem);
|
||||
QTreeViewItem *items = viewItems.data();
|
||||
for (int i = pos + count; i < viewItems.count(); i++)
|
||||
if (items[i].parentItem >= pos)
|
||||
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)
|
||||
{
|
||||
Q_Q(QTreeView);
|
||||
viewItems.remove(pos, count);
|
||||
QTreeViewItem *items = viewItems.data();
|
||||
for (int i = pos; i < viewItems.count(); i++)
|
||||
if (items[i].parentItem >= pos)
|
||||
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
|
||||
@ -3687,14 +3704,6 @@ void QTreeViewPrivate::_q_sortIndicatorChanged(int column, Qt::SortOrder order)
|
||||
*/
|
||||
void QTreeView::currentChanged(const QModelIndex ¤t, 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);
|
||||
|
||||
if (allColumnsShowFocus()) {
|
||||
@ -3711,6 +3720,19 @@ void QTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr
|
||||
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 ¤t, const QModelIndex &pr
|
||||
void QTreeView::selectionChanged(const QItemSelection &selected,
|
||||
const QItemSelection &deselected)
|
||||
{
|
||||
QAbstractItemView::selectionChanged(selected, deselected);
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
if (QAccessible::isActive()) {
|
||||
// ### does not work properly for selection ranges.
|
||||
QModelIndex sel = selected.indexes().value(0);
|
||||
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;
|
||||
if (header())
|
||||
++entry;
|
||||
QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection);
|
||||
#endif
|
||||
}
|
||||
QModelIndex desel = deselected.indexes().value(0);
|
||||
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;
|
||||
if (header())
|
||||
++entry;
|
||||
QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
QAbstractItemView::selectionChanged(selected, deselected);
|
||||
}
|
||||
|
||||
int QTreeView::visualIndex(const QModelIndex &index) const
|
||||
|
@ -219,6 +219,9 @@ protected:
|
||||
|
||||
private:
|
||||
friend class QAccessibleItemView;
|
||||
friend class QAccessibleTable2;
|
||||
friend class QAccessibleTree;
|
||||
friend class QAccessibleTable2Cell;
|
||||
int visualIndex(const QModelIndex &index) const;
|
||||
|
||||
Q_DECLARE_PRIVATE(QTreeView)
|
||||
|
@ -78,7 +78,7 @@ struct QTreeViewItem
|
||||
|
||||
Q_DECLARE_TYPEINFO(QTreeViewItem, Q_MOVABLE_TYPE);
|
||||
|
||||
class QTreeViewPrivate : public QAbstractItemViewPrivate
|
||||
class Q_GUI_EXPORT QTreeViewPrivate : public QAbstractItemViewPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QTreeView)
|
||||
public:
|
||||
@ -223,6 +223,10 @@ public:
|
||||
inline void invalidateHeightCache(int item) const
|
||||
{ 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
|
||||
QVector<QPersistentModelIndex> spanningIndexes;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
inline QWidgetItemData(int r, QVariant v) : role(r), value(v) {}
|
||||
int role;
|
||||
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
|
||||
|
@ -6375,6 +6375,10 @@ void QWidget::setFocus(Qt::FocusReason reason)
|
||||
// The negation of the condition in setFocus_sys
|
||||
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
|
||||
# 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
|
||||
QAccessible::updateAccessibility(f, 0, QAccessible::Focus);
|
||||
#endif
|
||||
|
@ -141,7 +141,7 @@ struct MacTimerInfo {
|
||||
QObject *obj;
|
||||
bool pending;
|
||||
CFRunLoopTimerRef runLoopTimer;
|
||||
bool operator==(const MacTimerInfo &other)
|
||||
bool operator==(const MacTimerInfo &other) const
|
||||
{
|
||||
return (id == other.id);
|
||||
}
|
||||
|
@ -80,6 +80,9 @@
|
||||
#if defined(Q_WS_S60)
|
||||
#include "private/qt_s60_p.h"
|
||||
#endif
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
#include "qaccessible.h"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -1018,6 +1021,9 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn
|
||||
}
|
||||
q->update();
|
||||
}
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged);
|
||||
#endif
|
||||
}
|
||||
|
||||
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);
|
||||
emit q->currentIndexChanged(index.row());
|
||||
emit q->currentIndexChanged(itemText(index));
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged);
|
||||
#endif
|
||||
}
|
||||
|
||||
QString QComboBoxPrivate::itemText(const QModelIndex &index) const
|
||||
@ -2635,6 +2644,9 @@ void QComboBox::clear()
|
||||
{
|
||||
Q_D(QComboBox);
|
||||
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);
|
||||
if (d->lineEdit)
|
||||
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);
|
||||
if (d->lineEdit)
|
||||
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
Loading…
Reference in New Issue
Block a user