summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-08-04 12:38:11 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-08-04 12:38:11 (GMT)
commit9022eebfc6acf2e3c4eb054afe6fd5359493ff9a (patch)
treeac2f3414c1dbf8ebbbccb55f2c44e709225db850
parent2eb50141ed4431861512be36d9a578aa7608186e (diff)
parent920ce5ed71bc456e429b887801a8d8bea7a3db0d (diff)
downloadQt-9022eebfc6acf2e3c4eb054afe6fd5359493ff9a.zip
Qt-9022eebfc6acf2e3c4eb054afe6fd5359493ff9a.tar.gz
Qt-9022eebfc6acf2e3c4eb054afe6fd5359493ff9a.tar.bz2
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qt-fire-team
* 'master' of git://scm.dev.nokia.troll.no/qt/qt-fire-team: (40 commits) Remove DerivedSources.pro from WebKit. Support debuggable in the makefile build system QLabel documentation: add warning about sanitizing input Mark all Symbian debug binaries debuggable by default Detect linked fonts by name (insead of via CLinkedTypeface* Api) Revert "fix QFileInfo::isSymLink() for NTFS mount points" Fix typo for ifdef QT_NO_ACCESSIBILITY Call QAccessible::updateAccessibility when a widget is deleted Revert binary search in QTextEngine::findItem Remove a duplicate include line Save previous font engine for right bearing adjustment Symbian^3 workaround: Avoid usage of linked fonts. Make it possible to update a related table after an external update Fix compilation under OSX 10.7 or using llvm-gcc. Add test case name and drop parentheses for -datatags option. Adding QTDIR validation in tst_symbols autotest Disabled benchmarks referring to private headers. Add license header to printdatatags autotests Compile on symbian^3 Compile on Symbian^3. ...
-rw-r--r--doc/src/development/qtestlib.qdoc3
-rw-r--r--mkspecs/common/symbian/symbian-makefile.conf5
-rw-r--r--mkspecs/common/symbian/symbian-mmp.conf2
-rw-r--r--src/corelib/thread/qmutex_unix.cpp4
-rw-r--r--src/dbus/dbus.pro3
-rw-r--r--src/gui/accessible/qaccessible.cpp5
-rw-r--r--src/gui/accessible/qaccessible.h78
-rw-r--r--src/gui/accessible/qaccessible2.h112
-rw-r--r--src/gui/accessible/qaccessible_unix.cpp11
-rw-r--r--src/gui/dialogs/qfontdialog.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp3
-rw-r--r--src/gui/image/qtiffhandler.cpp13
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp95
-rw-r--r--src/gui/itemviews/qabstractitemview.h1
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h1
-rw-r--r--src/gui/itemviews/qlistview.cpp12
-rw-r--r--src/gui/itemviews/qtableview.cpp17
-rw-r--r--src/gui/itemviews/qtableview_p.h5
-rw-r--r--src/gui/itemviews/qtreeview.cpp52
-rw-r--r--src/gui/itemviews/qtreeview.h3
-rw-r--r--src/gui/itemviews/qtreeview_p.h6
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h6
-rw-r--r--src/gui/kernel/qwidget.cpp4
-rw-r--r--src/gui/s60framework/qs60keycapture.cpp2
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp17
-rw-r--r--src/gui/text/qfont_s60.cpp36
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp19
-rw-r--r--src/gui/text/qtextengine.cpp18
-rw-r--r--src/gui/text/qtextlayout.cpp19
-rw-r--r--src/gui/widgets/qcombobox.cpp18
-rw-r--r--src/gui/widgets/qlabel.cpp16
-rw-r--r--src/opengl/qpixmapdata_symbiangl.cpp4
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.cpp12
-rw-r--r--src/plugins/accessible/widgets/itemviews.cpp1029
-rw-r--r--src/plugins/accessible/widgets/itemviews.h319
-rw-r--r--src/plugins/accessible/widgets/main.cpp22
-rw-r--r--src/plugins/accessible/widgets/widgets.pro22
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.cpp36
-rw-r--r--src/testlib/qtestcase.cpp68
-rw-r--r--src/testlib/qtestlog.cpp11
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp370
-rw-r--r--tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp23
-rw-r--r--tests/auto/qxmlquery/pushBaselines/allAtomics.ref2
-rw-r--r--tests/auto/selftests/expected_printdatatags.txt6
-rw-r--r--tests/auto/selftests/expected_printdatatagswithglobaltags.txt12
-rw-r--r--tests/auto/selftests/printdatatags/printdatatags.pro8
-rw-r--r--tests/auto/selftests/printdatatags/tst_printdatatags.cpp90
-rw-r--r--tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro8
-rw-r--r--tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp106
-rw-r--r--tests/auto/selftests/selftests.pro3
-rw-r--r--tests/auto/selftests/selftests.qrc2
-rw-r--r--tests/auto/selftests/tst_selftests.cpp14
-rw-r--r--tests/auto/symbols/tst_symbols.cpp8
-rw-r--r--tests/benchmarks/corelib/io/qdir/tree/tree.pro5
-rw-r--r--tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro5
-rw-r--r--tests/benchmarks/gui/gui.pro5
-rwxr-xr-xtests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro5
-rw-r--r--tests/benchmarks/network/network.pro3
-rw-r--r--tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro5
-rw-r--r--tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro5
-rw-r--r--tests/benchmarks/script/script.pro1
61 files changed, 2668 insertions, 129 deletions
diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc
index 10ae285..3b338e3 100644
--- a/doc/src/development/qtestlib.qdoc
+++ b/doc/src/development/qtestlib.qdoc
@@ -181,6 +181,9 @@
outputs the possible command line arguments and give some useful help.
\o \c -functions \BR
outputs all test functions available in the test.
+ \o \c -datatags \BR
+ outputs all data tags available in the test.
+ A global data tag is preceded by ' __global__ '.
\o \c -o \e filename \BR
write output to the specified file, rather than to standard output
\o \c -silent \BR
diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf
index a725df3..14acd69 100644
--- a/mkspecs/common/symbian/symbian-makefile.conf
+++ b/mkspecs/common/symbian/symbian-makefile.conf
@@ -34,6 +34,11 @@ QMAKE_ELF2E32_FLAGS = --dlldata \
--compressionmethod bytepair \
--unpaged
+CONFIG(debug, debug|release) {
+ QMAKE_ELF2E32_FLAGS += \
+ --debuggable
+}
+
QMAKE_PREFIX_SHLIB =
CONFIG *= no_plugin_name_prefix
QMAKE_PREFIX_STATICLIB =
diff --git a/mkspecs/common/symbian/symbian-mmp.conf b/mkspecs/common/symbian/symbian-mmp.conf
index 8ed326a..fa2a815 100644
--- a/mkspecs/common/symbian/symbian-mmp.conf
+++ b/mkspecs/common/symbian/symbian-mmp.conf
@@ -58,3 +58,5 @@ symbian-sbsv2 {
QMAKE_SBSV2_DEL_TREE = $(GNURM) -rf
}
+# Mark all debug executables debuggable.
+MMP_RULES += DEBUGGABLE_UDEBONLY
diff --git a/src/corelib/thread/qmutex_unix.cpp b/src/corelib/thread/qmutex_unix.cpp
index e692e19..2a9d23c 100644
--- a/src/corelib/thread/qmutex_unix.cpp
+++ b/src/corelib/thread/qmutex_unix.cpp
@@ -161,8 +161,8 @@ bool QMutexPrivate::wait(int timeout)
return false;
}
- ts.tv_sec = timeout / Q_INT64_C(1000) / 1000 / 1000;
- ts.tv_nsec = timeout % (Q_INT64_C(1000) * 1000 * 1000);
+ ts.tv_sec = xtimeout / Q_INT64_C(1000) / 1000 / 1000;
+ ts.tv_nsec = xtimeout % (Q_INT64_C(1000) * 1000 * 1000);
}
}
return true;
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index d21b380..37e5925 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -61,8 +61,7 @@ HEADERS += $$PUB_HEADERS \
qdbuspendingcall_p.h \
qdbus_symbols_p.h \
qdbusservicewatcher.h \
- qdbusunixfiledescriptor.h \
- qdbusvirtualobject.h
+ qdbusunixfiledescriptor.h
SOURCES += qdbusconnection.cpp \
qdbusconnectioninterface.cpp \
qdbuserror.cpp \
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 337bb99..10e5785 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -1048,6 +1048,11 @@ const QAccessibleInterface *other, int otherChild) const
*/
/*!
+ \fn QAccessibleTable2Interface *QAccessibleInterface::table2Interface()
+ \internal
+*/
+
+/*!
\fn QAccessibleActionInterface *QAccessibleInterface::actionInterface()
\internal
*/
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index fc03e1c..24a6744 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -84,40 +84,40 @@ public:
MenuCommand = 0x0018,
// Values from IAccessible2
- ActionChanged = 0x0101,
- ActiveDescendantChanged,
- AttributeChanged,
- DocumentContentChanged,
- DocumentLoadComplete,
- DocumentLoadStopped,
- DocumentReload,
- HyperlinkEndIndexChanged,
- HyperlinkNumberOfAnchorsChanged,
- HyperlinkSelectedLinkChanged,
- HypertextLinkActivated,
- HypertextLinkSelected,
- HyperlinkStartIndexChanged,
- HypertextChanged,
- HypertextNLinksChanged,
- ObjectAttributeChanged,
- PageChanged,
- SectionChanged,
- TableCaptionChanged,
- TableColumnDescriptionChanged,
- TableColumnHeaderChanged,
- TableModelChanged,
- TableRowDescriptionChanged,
- TableRowHeaderChanged,
- TableSummaryChanged,
- TextAttributeChanged,
- TextCaretMoved,
- // TextChanged, deprecated, use TextUpdated
- TextColumnChanged = TextCaretMoved + 2,
- TextInserted,
- TextRemoved,
- TextUpdated,
- TextSelectionChanged,
- VisibleDataChanged,
+ ActionChanged = 0x0101,
+ ActiveDescendantChanged = 0x0102,
+ AttributeChanged = 0x0103,
+ DocumentContentChanged = 0x0104,
+ DocumentLoadComplete = 0x0105,
+ DocumentLoadStopped = 0x0106,
+ DocumentReload = 0x0107,
+ HyperlinkEndIndexChanged = 0x0108,
+ HyperlinkNumberOfAnchorsChanged = 0x0109,
+ HyperlinkSelectedLinkChanged = 0x010A,
+ HypertextLinkActivated = 0x010B,
+ HypertextLinkSelected = 0x010C,
+ HyperlinkStartIndexChanged = 0x010D,
+ HypertextChanged = 0x010E,
+ HypertextNLinksChanged = 0x010F,
+ ObjectAttributeChanged = 0x0110,
+ PageChanged = 0x0111,
+ SectionChanged = 0x0112,
+ TableCaptionChanged = 0x0113,
+ TableColumnDescriptionChanged = 0x0114,
+ TableColumnHeaderChanged = 0x0115,
+ TableModelChanged = 0x0116,
+ TableRowDescriptionChanged = 0x0117,
+ TableRowHeaderChanged = 0x0118,
+ TableSummaryChanged = 0x0119,
+ TextAttributeChanged = 0x011A,
+ TextCaretMoved = 0x011B,
+ // TextChanged = 0x011C, is deprecated in IA2, use TextUpdated
+ TextColumnChanged = 0x011D,
+ TextInserted = 0x011E,
+ TextRemoved = 0x011F,
+ TextUpdated = 0x0120,
+ TextSelectionChanged = 0x0121,
+ VisibleDataChanged = 0x0122,
ObjectCreated = 0x8000,
ObjectDestroyed = 0x8001,
@@ -151,6 +151,7 @@ public:
ReadOnly = 0x00000040,
HotTracked = 0x00000080,
DefaultButton = 0x00000100,
+ // #### Qt5 Expandable
Expanded = 0x00000200,
Collapsed = 0x00000400,
Busy = 0x00000800,
@@ -178,6 +179,8 @@ public:
HasPopup = 0x40000000,
Modal = 0x80000000,
+ // #### Qt5 ManagesDescendants
+ // #### Qt5 remove HasInvokeExtension
HasInvokeExtension = 0x10000000 // internal
};
Q_DECLARE_FLAGS(State, StateFlag)
@@ -348,7 +351,8 @@ namespace QAccessible2
ValueInterface,
TableInterface,
ActionInterface,
- ImageInterface
+ ImageInterface,
+ Table2Interface
};
}
@@ -359,6 +363,7 @@ class QAccessibleValueInterface;
class QAccessibleTableInterface;
class QAccessibleActionInterface;
class QAccessibleImageInterface;
+class QAccessibleTable2Interface;
class Q_GUI_EXPORT QAccessibleInterface : public QAccessible
{
@@ -422,6 +427,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);
};
diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h
index 5cb0323..106b69e 100644
--- a/src/gui/accessible/qaccessible2.h
+++ b/src/gui/accessible/qaccessible2.h
@@ -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_GUI_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_GUI_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_GUI_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_GUI_EXPORT QAccessibleActionInterface : public QAccessible2Interface
{
public:
diff --git a/src/gui/accessible/qaccessible_unix.cpp b/src/gui/accessible/qaccessible_unix.cpp
index a6b7ec3..19fbe78 100644
--- a/src/gui/accessible/qaccessible_unix.cpp
+++ b/src/gui/accessible/qaccessible_unix.cpp
@@ -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;
diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp
index 6a646ff..34b6317 100644
--- a/src/gui/dialogs/qfontdialog.cpp
+++ b/src/gui/dialogs/qfontdialog.cpp
@@ -160,7 +160,7 @@ QFontDialog::QFontDialog(QWidget *parent)
\since 4.5
Constructs a standard font dialog with the given \a parent and specified
- \a initial color.
+ \a initial font.
*/
QFontDialog::QFontDialog(const QFont &initial, QWidget *parent)
: QDialog(*new QFontDialogPrivate, parent, DefaultWindowFlags)
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 655725b..1551944 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -1639,7 +1639,8 @@ QGraphicsScene::~QGraphicsScene()
Q_D(QGraphicsScene);
// Remove this scene from qApp's global scene list.
- qApp->d_func()->scene_list.removeAll(this);
+ if (!QApplicationPrivate::is_app_closing)
+ qApp->d_func()->scene_list.removeAll(this);
clear();
diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp
index c753b83..4dc9775 100644
--- a/src/gui/image/qtiffhandler.cpp
+++ b/src/gui/image/qtiffhandler.cpp
@@ -236,14 +236,14 @@ bool QTiffHandler::read(QImage *image)
}
} else {
// create the color table
- uint16 *redTable = static_cast<uint16 *>(qMalloc(tableSize * sizeof(uint16)));
- uint16 *greenTable = static_cast<uint16 *>(qMalloc(tableSize * sizeof(uint16)));
- uint16 *blueTable = static_cast<uint16 *>(qMalloc(tableSize * sizeof(uint16)));
- if (!redTable || !greenTable || !blueTable) {
+ uint16 *redTable = 0;
+ uint16 *greenTable = 0;
+ uint16 *blueTable = 0;
+ if (!TIFFGetField(tiff, TIFFTAG_COLORMAP, &redTable, &greenTable, &blueTable)) {
TIFFClose(tiff);
return false;
}
- if (!TIFFGetField(tiff, TIFFTAG_COLORMAP, &redTable, &greenTable, &blueTable)) {
+ if (!redTable || !greenTable || !blueTable) {
TIFFClose(tiff);
return false;
}
@@ -500,6 +500,9 @@ bool QTiffHandler::write(const QImage &image)
uint16 *greenTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
uint16 *blueTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
if (!redTable || !greenTable || !blueTable) {
+ qFree(redTable);
+ qFree(greenTable);
+ qFree(blueTable);
TIFFClose(tiff);
return false;
}
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index f53705b..ded4d63 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -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>
@@ -645,6 +646,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)),
@@ -675,6 +678,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)),
@@ -1058,6 +1063,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
}
/*!
@@ -2805,7 +2818,7 @@ void QAbstractItemView::editorDestroyed(QObject *editor)
*/
void QAbstractItemView::setHorizontalStepsPerItem(int steps)
{
- Q_UNUSED(steps);
+ Q_UNUSED(steps)
// do nothing
}
@@ -2834,7 +2847,7 @@ int QAbstractItemView::horizontalStepsPerItem() const
*/
void QAbstractItemView::setVerticalStepsPerItem(int steps)
{
- Q_UNUSED(steps);
+ Q_UNUSED(steps)
// do nothing
}
@@ -3267,12 +3280,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
}
/*!
@@ -3335,27 +3360,72 @@ 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);
- if (q->isVisible())
- q->updateEditorGeometries();
+#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
@@ -3373,7 +3443,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
}
/*!
@@ -3698,7 +3777,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()) {
diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h
index cb7b78d..1d0c36e 100644
--- a/src/gui/itemviews/qabstractitemview.h
+++ b/src/gui/itemviews/qabstractitemview.h
@@ -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())
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 3ba7227..04babde 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -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);
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index a234fde..a0955d2 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -3168,7 +3168,11 @@ void QListView::currentChanged(const QModelIndex &current, 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
@@ -3187,12 +3191,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
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index 617409f..6f532eb 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -3164,10 +3164,16 @@ void QTableView::currentChanged(const QModelIndex &current, 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 &current, 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
diff --git a/src/gui/itemviews/qtableview_p.h b/src/gui/itemviews/qtableview_p.h
index f973acf..dce0ed0 100644
--- a/src/gui/itemviews/qtableview_p.h
+++ b/src/gui/itemviews/qtableview_p.h
@@ -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;
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 6a992db..9228ac8 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -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 &current, const QModelIndex &previous)
{
-#ifndef QT_NO_ACCESSIBILITY
- if (QAccessible::isActive()) {
- int entry = visualIndex(current) + 1;
- if (header())
- ++entry;
- QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
- }
-#endif
QAbstractItemView::currentChanged(current, previous);
if (allColumnsShowFocus()) {
@@ -3711,6 +3720,19 @@ void QTreeView::currentChanged(const QModelIndex &current, 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 &current, 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
diff --git a/src/gui/itemviews/qtreeview.h b/src/gui/itemviews/qtreeview.h
index 26c7315..b77da4e 100644
--- a/src/gui/itemviews/qtreeview.h
+++ b/src/gui/itemviews/qtreeview.h
@@ -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)
diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h
index b6d8458..a9dc452 100644
--- a/src/gui/itemviews/qtreeview_p.h
+++ b/src/gui/itemviews/qtreeview_p.h
@@ -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;
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index f5a93d9..8c194cc 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -347,7 +347,7 @@ QT_END_NAMESPACE
QWidget *qwidget = QApplication::widgetAt(globalPoint);
*currentDragTarget() = qwidget;
if (!qwidget)
- return [super draggingEntered:sender];
+ return NSDragOperationNone;
if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false)
return NSDragOperationNone;
@@ -413,7 +413,7 @@ QT_END_NAMESPACE
QWidget *qwidget = QApplication::widgetAt(globalPoint);
if (!qwidget)
- return [super draggingEntered:sender];
+ return NSDragOperationNone;
// First, check if the widget under the mouse has changed since the
// last drag move events. If so, we need to change target, and dispatch
@@ -500,7 +500,7 @@ QT_END_NAMESPACE
QWidget *qwidget = *currentDragTarget();
if (!qwidget)
- return [super draggingExited:sender];
+ return;
if (dropData) {
QDragLeaveEvent de;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index a2109b4..ad8fbb7 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -1670,6 +1670,10 @@ QWidget::~QWidget()
if (!d->children.isEmpty())
d->deleteChildren();
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::updateAccessibility(this, 0, QAccessible::ObjectDestroyed);
+#endif
+
QApplication::removePostedEvents(this);
QT_TRY {
diff --git a/src/gui/s60framework/qs60keycapture.cpp b/src/gui/s60framework/qs60keycapture.cpp
index 415c3e1..1beefd4 100644
--- a/src/gui/s60framework/qs60keycapture.cpp
+++ b/src/gui/s60framework/qs60keycapture.cpp
@@ -42,7 +42,7 @@
#include <remconinterfaceselector.h>
#include <remconcoreapitarget.h>
#include <coemain.h>
-#include "qkeymapper_p.h"
+#include <private/qkeymapper_p.h>
#include "qs60keycapture_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index da484ba..b894eb4 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -76,6 +76,10 @@ static const int windowsRightBorder = 15; // right border on windows
# define CMDLGS_PRESSED 3
# define CMDLGS_DISABLED 4
#endif
+#ifndef PP_TRANSPARENTBAR
+# define PP_TRANSPARENTBAR 11
+# define PP_TRANSPARENTBARVERT 12
+#endif
// Runtime resolved theme engine function calls
@@ -1059,6 +1063,19 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
}
break;
#ifndef QT_NO_PROGRESSBAR
+ case CE_ProgressBarGroove:
+ {
+ Qt::Orientation orient = Qt::Horizontal;
+ if (const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option))
+ orient = pb2->orientation;
+ partId = (orient == Qt::Horizontal) ? PP_TRANSPARENTBAR : PP_TRANSPARENTBARVERT;
+ name = QLatin1String("PROGRESS");
+ stateId = 1;
+
+ XPThemeData theme(widget, painter, name, partId, stateId, rect);
+ d->drawBackground(theme);
+ }
+ break;
case CE_ProgressBarContents:
if (const QStyleOptionProgressBar *bar
= qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp
index 0fc8a97..76133fa 100644
--- a/src/gui/text/qfont_s60.cpp
+++ b/src/gui/text/qfont_s60.cpp
@@ -49,8 +49,6 @@ QT_BEGIN_NAMESPACE
#ifdef QT_NO_FREETYPE
Q_GLOBAL_STATIC(QMutex, lastResortFamilyMutex);
-#endif // QT_NO_FREETYPE
-
extern QStringList qt_symbian_fontFamiliesOnFontServer(); // qfontdatabase_s60.cpp
Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, {
// We are only interested in the initial font families. No Application fonts.
@@ -58,6 +56,25 @@ Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, {
x->append(qt_symbian_fontFamiliesOnFontServer());
});
+extern bool qt_symbian_isLinkedFont(const TDesC &typefaceName); // qfontdatabase_s60.cpp
+
+static QString classicalSymbianSystemFont()
+{
+ static QString font;
+ if (font.isEmpty()) {
+ static const char* const classicSymbianSystemFonts[] = { "Nokia Sans S60", "Series 60 Sans" };
+ for (int i = 0; i < sizeof classicSymbianSystemFonts / sizeof classicSymbianSystemFonts[0]; ++i) {
+ const QString classicFont = QLatin1String(classicSymbianSystemFonts[i]);
+ if (fontFamiliesOnFontServer()->contains(classicFont)) {
+ font = classicFont;
+ break;
+ }
+ }
+ }
+ return font;
+}
+#endif // QT_NO_FREETYPE
+
QString QFont::lastResortFont() const
{
// Symbian's font Api does not distinguish between font and family.
@@ -85,6 +102,10 @@ QString QFont::lastResortFamily() const
S60->screenDevice()->ReleaseFont(font);
lock.relock();
+
+ // We must not return a Symbian Linked Font. See QTBUG-20007
+ if (qt_symbian_isLinkedFont(spec.iTypeface.iName) && !classicalSymbianSystemFont().isEmpty())
+ family = classicalSymbianSystemFont();
}
return family;
#else // QT_NO_FREETYPE
@@ -117,14 +138,9 @@ QString QFont::defaultFamily() const
{
#ifdef QT_NO_FREETYPE
switch(d->request.styleHint) {
- case QFont::SansSerif: {
- static const char* const preferredSansSerif[] = {"Nokia Sans S60", "Series 60 Sans"};
- for (int i = 0; i < sizeof preferredSansSerif / sizeof preferredSansSerif[0]; ++i) {
- const QString sansSerif = QLatin1String(preferredSansSerif[i]);
- if (fontFamiliesOnFontServer()->contains(sansSerif))
- return sansSerif;
- }
- }
+ case QFont::SansSerif:
+ if (!classicalSymbianSystemFont().isEmpty())
+ return classicalSymbianSystemFont();
// No break. Intentional fall through.
default:
return lastResortFamily();
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index 2f4d055..cf96733 100644
--- a/src/gui/text/qfontdatabase_s60.cpp
+++ b/src/gui/text/qfontdatabase_s60.cpp
@@ -58,8 +58,22 @@
#endif // SYMBIAN_ENABLE_SPLIT_HEADERS
#endif // QT_NO_FREETYPE
+#ifndef SYMBIAN_VERSION_9_4
+#define SYMBIAN_LINKEDFONTS_SUPPORTED
+#endif // !SYMBIAN_VERSION_9_4
+
QT_BEGIN_NAMESPACE
+bool qt_symbian_isLinkedFont(const TDesC &typefaceName) // Also used in qfont_s60.cpp
+{
+ bool isLinkedFont = false;
+#ifdef SYMBIAN_LINKEDFONTS_SUPPORTED
+ const QString name((const QChar*)typefaceName.Ptr(), typefaceName.Length());
+ isLinkedFont = name.endsWith(QLatin1String("LF")) && name == name.toUpper();
+#endif // SYMBIAN_LINKEDFONTS_SUPPORTED
+ return isLinkedFont;
+}
+
QStringList qt_symbian_fontFamiliesOnFontServer() // Also used in qfont_s60.cpp
{
QStringList result;
@@ -477,7 +491,10 @@ static bool registerScreenDeviceFont(int screenDeviceFontIndex,
const QSymbianFontDatabaseExtrasImplementation *dbExtras)
{
TTypefaceSupport typefaceSupport;
- S60->screenDevice()->TypefaceSupport(typefaceSupport, screenDeviceFontIndex);
+ S60->screenDevice()->TypefaceSupport(typefaceSupport, screenDeviceFontIndex);
+
+ if (qt_symbian_isLinkedFont(typefaceSupport.iTypeface.iName))
+ return false;
QString familyName((const QChar*)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length());
if (qt_symbian_fontNameHasAppFontMarker(familyName)) {
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 41ea56a..093b43d 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1632,19 +1632,13 @@ bool QTextEngine::isRightToLeft() const
int QTextEngine::findItem(int strPos) const
{
itemize();
- int left = 0;
- int right = layoutData->items.size()-1;
- while(left <= right) {
- int middle = ((right-left)/2)+left;
- if (strPos > layoutData->items[middle].position)
- left = middle+1;
- else if(strPos < layoutData->items[middle].position)
- right = middle-1;
- else {
- return middle;
- }
+
+ int item;
+ for (item = layoutData->items.size()-1; item > 0; --item) {
+ if (layoutData->items[item].position <= strPos)
+ break;
}
- return right;
+ return item;
}
QFixed QTextEngine::width(int from, int len) const
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 05b1d08..515915a 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1591,6 +1591,7 @@ namespace {
QFixed minimumRightBearing;
QFontEngine *fontEngine;
+ QFontEngine *previousFontEngine;
const unsigned short *logClusters;
bool manualWrap;
@@ -1611,12 +1612,19 @@ namespace {
return glyphs.glyphs[logClusters[currentPosition - 1]];
}
- inline void saveCurrentGlyph()
+ inline void resetPreviousGlyph()
{
previousGlyph = 0;
+ previousFontEngine = 0;
+ }
+
+ inline void saveCurrentGlyph()
+ {
+ resetPreviousGlyph();
if (currentPosition > 0 &&
logClusters[currentPosition - 1] < glyphs.numGlyphs) {
previousGlyph = currentGlyph(); // needed to calculate right bearing later
+ previousFontEngine = fontEngine;
}
}
@@ -1636,8 +1644,11 @@ namespace {
inline void adjustPreviousRightBearing()
{
- if (previousGlyph > 0)
- adjustRightBearing(previousGlyph);
+ if (previousGlyph > 0 && previousFontEngine) {
+ qreal rb;
+ previousFontEngine->getGlyphBearings(previousGlyph, 0, &rb);
+ rightBearing = qMin(QFixed(), QFixed::fromReal(rb));
+ }
}
inline void resetRightBearing()
@@ -1728,7 +1739,7 @@ void QTextLine::layout_helper(int maxGlyphs)
lbh.currentPosition = line.from;
int end = 0;
lbh.logClusters = eng->layoutData->logClustersPtr;
- lbh.previousGlyph = 0;
+ lbh.resetPreviousGlyph();
while (newItem < eng->layoutData->items.size()) {
lbh.resetRightBearing();
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 621cae9..41394e3 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -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
}
/*!
diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp
index 26dd0e1..ab88f38 100644
--- a/src/gui/widgets/qlabel.cpp
+++ b/src/gui/widgets/qlabel.cpp
@@ -55,6 +55,10 @@
#include "private/qstylesheetstyle_p.h"
#include <qmath.h>
+#ifndef QT_NO_ACCESSIBILITY
+#include <qaccessible.h>
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -88,6 +92,13 @@ QT_BEGIN_NAMESPACE
by clear().
\endtable
+ \warning When passing a QString to the constructor or calling setText(),
+ make sure to sanitize your input, as QLabel tries to guess whether it
+ displays the text as plain text or as rich text. You may want to call
+ setTextFormat() explicitly, e.g. in case you expect the text to be in
+ plain format but cannot control the text source (for instance when
+ displaying data loaded from the Web).
+
When the content is changed using any of these functions, any
previous content is cleared.
@@ -370,6 +381,11 @@ void QLabel::setText(const QString &text)
#endif
d->updateLabel();
+
+#ifndef QT_NO_ACCESSIBILITY
+ if (accessibleName().isEmpty())
+ QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+#endif
}
QString QLabel::text() const
diff --git a/src/opengl/qpixmapdata_symbiangl.cpp b/src/opengl/qpixmapdata_symbiangl.cpp
index 78e5ee7..a7e33e2 100644
--- a/src/opengl/qpixmapdata_symbiangl.cpp
+++ b/src/opengl/qpixmapdata_symbiangl.cpp
@@ -142,6 +142,7 @@ QGLPixmapData::QGLPixmapData(PixelType type)
QGLPixmapData::~QGLPixmapData()
{
+#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
if (m_sgImage) {
if (m_texture.id) {
QGLSgImageTextureCleanup::cleanupForContext(m_ctx)->remove(m_texture.id);
@@ -152,6 +153,7 @@ QGLPixmapData::~QGLPixmapData()
delete m_sgImage;
m_sgImage = 0;
}
+#endif
delete m_engine;
}
@@ -668,6 +670,7 @@ static inline bool knownGoodFormat(QImage::Format format)
}
}
+#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
static inline int symbianPixeFormatBitsPerPixel(TUidPixelFormat pixelFormat)
{
switch (pixelFormat) {
@@ -719,6 +722,7 @@ static inline int symbianPixeFormatBitsPerPixel(TUidPixelFormat pixelFormat)
return 32;
};
}
+#endif
void QGLPixmapData::fromNativeType(void* pixmap, NativeType type)
{
diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp
index 8843d3e..563d3b9 100644
--- a/src/plugins/accessible/widgets/complexwidgets.cpp
+++ b/src/plugins/accessible/widgets/complexwidgets.cpp
@@ -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;
}
diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp
new file mode 100644
index 0000000..4618f87
--- /dev/null
+++ b/src/plugins/accessible/widgets/itemviews.cpp
@@ -0,0 +1,1029 @@
+/****************************************************************************
+**
+** 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 "itemviews.h"
+
+#include <qheaderview.h>
+#include <qtableview.h>
+#include <qlistview.h>
+#include <qtreeview.h>
+#include <private/qtreewidget_p.h>
+#include <qaccessible2.h>
+#include <QDebug>
+
+#ifndef QT_NO_ACCESSIBILITY
+
+QT_BEGIN_NAMESPACE
+
+QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
+
+#ifndef QT_NO_ITEMVIEWS
+/*
+Implementation of the IAccessible2 table2 interface. Much simpler than
+the other table interfaces since there is only the main table and cells:
+
+TABLE/LIST/TREE
+ |- HEADER CELL
+ |- CELL
+ |- CELL
+ ...
+*/
+
+int QAccessibleTable2::logicalIndex(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return -1;
+ int vHeader = verticalHeader() ? 1 : 0;
+ int hHeader = horizontalHeader() ? 1 : 0;
+ // row * number columns + column + 1 for one based counting
+ return (index.row() + hHeader)*(index.model()->columnCount() + vHeader) + (index.column() + vHeader) + 1;
+}
+
+QAccessibleInterface *QAccessibleTable2::childFromLogical(int logicalIndex) const
+{
+ logicalIndex--; // one based counting ftw
+ int vHeader = verticalHeader() ? 1 : 0;
+ int hHeader = horizontalHeader() ? 1 : 0;
+
+ int columns = view->model()->columnCount() + vHeader;
+
+ int row = logicalIndex / columns;
+ int column = logicalIndex % columns;
+
+ if (vHeader) {
+ if (column == 0) {
+ if (row == 0) {
+ return new QAccessibleTable2CornerButton(view);
+ }
+ return new QAccessibleTable2HeaderCell(view, row-1, Qt::Vertical);
+ }
+ --column;
+ }
+ if (hHeader) {
+ if (row == 0) {
+ return new QAccessibleTable2HeaderCell(view, column, Qt::Horizontal);
+ }
+ --row;
+ }
+ return new QAccessibleTable2Cell(view, view->model()->index(row, column), cellRole());
+}
+
+QAccessibleTable2::QAccessibleTable2(QWidget *w)
+ : QAccessibleObjectEx(w)
+{
+ view = qobject_cast<QAbstractItemView *>(w);
+ Q_ASSERT(view);
+
+ if (qobject_cast<const QTableView*>(view)) {
+ m_role = QAccessible::Table;
+ } else if (qobject_cast<const QTreeView*>(view)) {
+ m_role = QAccessible::Tree;
+ } else if (qobject_cast<const QListView*>(view)) {
+ m_role = QAccessible::List;
+ } else {
+ // is this our best guess?
+ m_role = QAccessible::Table;
+ }
+}
+
+QAccessibleTable2::~QAccessibleTable2()
+{
+}
+
+QHeaderView *QAccessibleTable2::horizontalHeader() const
+{
+ QHeaderView *header = 0;
+ if (false) {
+#ifndef QT_NO_TABLEVIEW
+ } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
+ header = tv->horizontalHeader();
+#endif
+#ifndef QT_NO_TREEVIEW
+ } else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) {
+ header = tv->header();
+#endif
+ }
+ return header;
+}
+
+QHeaderView *QAccessibleTable2::verticalHeader() const
+{
+ QHeaderView *header = 0;
+ if (false) {
+#ifndef QT_NO_TABLEVIEW
+ } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
+ header = tv->verticalHeader();
+#endif
+ }
+ return header;
+}
+
+void QAccessibleTable2::modelReset()
+{}
+
+void QAccessibleTable2::rowsInserted(const QModelIndex &, int first, int last)
+{
+ lastChange.firstRow = first;
+ lastChange.lastRow = last;
+ lastChange.firstColumn = 0;
+ lastChange.lastColumn = 0;
+ lastChange.type = QAccessible2::TableModelChangeInsert;
+}
+
+void QAccessibleTable2::rowsRemoved(const QModelIndex &, int first, int last)
+{
+ lastChange.firstRow = first;
+ lastChange.lastRow = last;
+ lastChange.firstColumn = 0;
+ lastChange.lastColumn = 0;
+ lastChange.type = QAccessible2::TableModelChangeDelete;
+}
+
+void QAccessibleTable2::columnsInserted(const QModelIndex &, int first, int last)
+{
+ lastChange.firstRow = 0;
+ lastChange.lastRow = 0;
+ lastChange.firstColumn = first;
+ lastChange.lastColumn = last;
+ lastChange.type = QAccessible2::TableModelChangeInsert;
+}
+
+void QAccessibleTable2::columnsRemoved(const QModelIndex &, int first, int last)
+{
+ lastChange.firstRow = 0;
+ lastChange.lastRow = 0;
+ lastChange.firstColumn = first;
+ lastChange.lastColumn = last;
+ lastChange.type = QAccessible2::TableModelChangeDelete;
+}
+
+void QAccessibleTable2::rowsMoved( const QModelIndex &, int, int, const QModelIndex &, int)
+{
+ lastChange.firstRow = 0;
+ lastChange.lastRow = 0;
+ lastChange.firstColumn = 0;
+ lastChange.lastColumn = 0;
+ lastChange.type = QAccessible2::TableModelChangeUpdate;
+}
+
+void QAccessibleTable2::columnsMoved( const QModelIndex &, int, int, const QModelIndex &, int)
+{
+ lastChange.firstRow = 0;
+ lastChange.lastRow = 0;
+ lastChange.firstColumn = 0;
+ lastChange.lastColumn = 0;
+ lastChange.type = QAccessible2::TableModelChangeUpdate;
+}
+
+QAccessibleTable2Cell *QAccessibleTable2::cell(const QModelIndex &index) const
+{
+ if (index.isValid())
+ return new QAccessibleTable2Cell(view, index, cellRole());
+ return 0;
+}
+
+QAccessibleTable2CellInterface *QAccessibleTable2::cellAt(int row, int column) const
+{
+ Q_ASSERT(role(0) != QAccessible::Tree);
+ QModelIndex index = view->model()->index(row, column);
+ //Q_ASSERT(index.isValid());
+ if (!index.isValid()) {
+ qWarning() << "QAccessibleTable2::cellAt: invalid index: " << index << " for " << view;
+ return 0;
+ }
+ return cell(index);
+}
+
+QAccessibleInterface *QAccessibleTable2::caption() const
+{
+ return 0;
+}
+
+QString QAccessibleTable2::columnDescription(int column) const
+{
+ return view->model()->headerData(column, Qt::Horizontal).toString();
+}
+
+int QAccessibleTable2::columnCount() const
+{
+ return view->model()->columnCount();
+}
+
+int QAccessibleTable2::rowCount() const
+{
+ return view->model()->rowCount();
+}
+
+int QAccessibleTable2::selectedCellCount() const
+{
+ return view->selectionModel()->selectedIndexes().count();
+}
+
+int QAccessibleTable2::selectedColumnCount() const
+{
+ return view->selectionModel()->selectedColumns().count();
+}
+
+int QAccessibleTable2::selectedRowCount() const
+{
+ return view->selectionModel()->selectedRows().count();
+}
+
+QString QAccessibleTable2::rowDescription(int row) const
+{
+ return view->model()->headerData(row, Qt::Vertical).toString();
+}
+
+QList<QAccessibleTable2CellInterface*> QAccessibleTable2::selectedCells() const
+{
+ QList<QAccessibleTable2CellInterface*> cells;
+ Q_FOREACH (const QModelIndex &index, view->selectionModel()->selectedIndexes()) {
+ cells.append(cell(index));
+ }
+ return cells;
+}
+
+QList<int> QAccessibleTable2::selectedColumns() const
+{
+ QList<int> columns;
+ Q_FOREACH (const QModelIndex &index, view->selectionModel()->selectedColumns()) {
+ columns.append(index.column());
+ }
+ return columns;
+}
+
+QList<int> QAccessibleTable2::selectedRows() const
+{
+ QList<int> rows;
+ Q_FOREACH (const QModelIndex &index, view->selectionModel()->selectedRows()) {
+ rows.append(index.row());
+ }
+ return rows;
+}
+
+QAccessibleInterface *QAccessibleTable2::summary() const
+{
+ return 0;
+}
+
+bool QAccessibleTable2::isColumnSelected(int column) const
+{
+ return view->selectionModel()->isColumnSelected(column, QModelIndex());
+}
+
+bool QAccessibleTable2::isRowSelected(int row) const
+{
+ return view->selectionModel()->isRowSelected(row, QModelIndex());
+}
+
+bool QAccessibleTable2::selectRow(int row)
+{
+ QModelIndex index = view->model()->index(row, 0);
+ if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection)
+ return false;
+ view->selectionModel()->select(index, QItemSelectionModel::Select);
+ return true;
+}
+
+bool QAccessibleTable2::selectColumn(int column)
+{
+ QModelIndex index = view->model()->index(0, column);
+ if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection)
+ return false;
+ view->selectionModel()->select(index, QItemSelectionModel::Select);
+ return true;
+}
+
+bool QAccessibleTable2::unselectRow(int row)
+{
+ QModelIndex index = view->model()->index(row, 0);
+ if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection)
+ return false;
+ view->selectionModel()->select(index, QItemSelectionModel::Deselect);
+ return true;
+}
+
+bool QAccessibleTable2::unselectColumn(int column)
+{
+ QModelIndex index = view->model()->index(0, column);
+ if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection)
+ return false;
+ view->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
+ return true;
+}
+
+QAccessible2::TableModelChange QAccessibleTable2::modelChange() const
+{
+ QAccessible2::TableModelChange change;
+ // FIXME
+ return change;
+}
+
+QAccessible::Role QAccessibleTable2::role(int child) const
+{
+ Q_ASSERT(child >= 0);
+ if (child > 0)
+ return QAccessible::Cell;
+ return m_role;
+}
+
+QAccessible::State QAccessibleTable2::state(int child) const
+{
+ Q_ASSERT(child == 0);
+ return QAccessible::Normal | HasInvokeExtension;
+}
+
+int QAccessibleTable2::childAt(int x, int y) const
+{
+ QPoint viewportOffset = view->viewport()->mapTo(view, QPoint(0,0));
+ QPoint indexPosition = view->mapFromGlobal(QPoint(x, y) - viewportOffset);
+ // FIXME: if indexPosition < 0 in one coordinate, return header
+
+ QModelIndex index = view->indexAt(indexPosition);
+ if (index.isValid()) {
+ return logicalIndex(index);
+ }
+ return -1;
+}
+
+int QAccessibleTable2::childCount() const
+{
+ int vHeader = verticalHeader() ? 1 : 0;
+ int hHeader = horizontalHeader() ? 1 : 0;
+ return (view->model()->rowCount()+hHeader) * (view->model()->columnCount()+vHeader);
+}
+
+int QAccessibleTable2::indexOfChild(const QAccessibleInterface *iface) const
+{
+ Q_ASSERT(iface->role(0) != QAccessible::TreeItem); // should be handled by tree class
+ if (iface->role(0) == QAccessible::Cell || iface->role(0) == QAccessible::ListItem) {
+ const QAccessibleTable2Cell* cell = static_cast<const QAccessibleTable2Cell*>(iface);
+ return logicalIndex(cell->m_index);
+ } else if (iface->role(0) == QAccessible::ColumnHeader){
+ const QAccessibleTable2HeaderCell* cell = static_cast<const QAccessibleTable2HeaderCell*>(iface);
+ return cell->index + (verticalHeader() ? 1 : 0) + 1;
+ } else if (iface->role(0) == QAccessible::RowHeader){
+ const QAccessibleTable2HeaderCell* cell = static_cast<const QAccessibleTable2HeaderCell*>(iface);
+ return (cell->index+1) * (view->model()->rowCount()+1) + 1;
+ } else if (iface->role(0) == QAccessible::Pane) {
+ return 1; // corner button
+ } else {
+ qWarning() << "WARNING QAccessibleTable2::indexOfChild Fix my children..."
+ << iface->role(0) << iface->text(QAccessible::Name, 0);
+ }
+ // FIXME: we are in denial of our children. this should stop.
+ return -1;
+}
+
+QString QAccessibleTable2::text(Text t, int child) const
+{
+ Q_ASSERT(child == 0);
+ if (t == QAccessible::Description)
+ return view->accessibleDescription();
+ return view->accessibleName();
+}
+
+QRect QAccessibleTable2::rect(int child) const
+{
+ Q_ASSERT(!child);
+ if (!view->isVisible())
+ return QRect();
+ QPoint pos = view->mapToGlobal(QPoint(0, 0));
+ return QRect(pos.x(), pos.y(), view->width(), view->height());
+}
+
+int QAccessibleTable2::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
+{
+ *iface = 0;
+ switch (relation) {
+ case Ancestor: {
+ if (index == 1 && view->parent()) {
+ *iface = QAccessible::queryAccessibleInterface(view->parent());
+ if (*iface)
+ return 0;
+ }
+ break;
+ }
+ case QAccessible::Child: {
+ Q_ASSERT(index > 0);
+ *iface = childFromLogical(index);
+ if (*iface) {
+ return 0;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ return -1;
+}
+
+QAccessible::Relation QAccessibleTable2::relationTo(int, const QAccessibleInterface *, int) const
+{
+ return QAccessible::Unrelated;
+}
+
+#ifndef QT_NO_ACTION
+int QAccessibleTable2::userActionCount(int) const
+{
+ return 0;
+}
+QString QAccessibleTable2::actionText(int, Text, int) const
+{
+ return QString();
+}
+bool QAccessibleTable2::doAction(int, int, const QVariantList &)
+{
+ return false;
+}
+#endif
+
+
+// TREE VIEW
+
+QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
+{
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ QModelIndex modelIndex = treeView->d_func()->viewItems.at(row).index;
+
+ if (modelIndex.isValid() && column > 0) {
+ modelIndex = view->model()->index(modelIndex.row(), column, modelIndex.parent());
+ }
+ return modelIndex;
+}
+
+int QAccessibleTree::childAt(int x, int y) const
+{
+ QPoint viewportOffset = view->viewport()->mapTo(view, QPoint(0,0));
+ QPoint indexPosition = view->mapFromGlobal(QPoint(x, y) - viewportOffset);
+
+ QModelIndex index = view->indexAt(indexPosition);
+ if (!index.isValid())
+ return -1;
+
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ int row = treeView->d_func()->viewIndex(index) + (horizontalHeader() ? 1 : 0);
+ int column = index.column();
+
+ int i = row * view->model()->columnCount() + column + 1;
+ Q_ASSERT(i > view->model()->columnCount());
+ return i;
+}
+
+int QAccessibleTree::childCount() const
+{
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ Q_ASSERT(treeView);
+ if (!view->model())
+ return 0;
+
+ int hHeader = horizontalHeader() ? 1 : 0;
+ return (treeView->d_func()->viewItems.count() + hHeader)* view->model()->columnCount();
+}
+
+int QAccessibleTree::rowCount() const
+{
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ Q_ASSERT(treeView);
+ return treeView->d_func()->viewItems.count();
+}
+
+int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
+{
+ if (iface->role(0) == QAccessible::TreeItem) {
+ const QAccessibleTable2Cell* cell = static_cast<const QAccessibleTable2Cell*>(iface);
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ Q_ASSERT(treeView);
+ int row = treeView->d_func()->viewIndex(cell->m_index) + (horizontalHeader() ? 1 : 0);
+ int column = cell->m_index.column();
+
+ int index = row * view->model()->columnCount() + column + 1;
+ //qDebug() << "QAccessibleTree::indexOfChild r " << row << " c " << column << "index " << index;
+ Q_ASSERT(index > treeView->model()->columnCount());
+ return index;
+ } else if (iface->role(0) == QAccessible::ColumnHeader){
+ const QAccessibleTable2HeaderCell* cell = static_cast<const QAccessibleTable2HeaderCell*>(iface);
+ //qDebug() << "QAccessibleTree::indexOfChild header " << cell->index << "is: " << cell->index + 1;
+ return cell->index + 1;
+ } else {
+ qWarning() << "WARNING QAccessibleTable2::indexOfChild invalid child"
+ << iface->role(0) << iface->text(QAccessible::Name, 0);
+ }
+ // FIXME: add scrollbars and don't just ignore them
+ return -1;
+}
+
+int QAccessibleTree::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
+{
+ switch (relation) {
+ case QAccessible::Child: {
+ Q_ASSERT(index > 0);
+ --index;
+ int hHeader = horizontalHeader() ? 1 : 0;
+
+ if (hHeader) {
+ if (index < view->model()->columnCount()) {
+ *iface = new QAccessibleTable2HeaderCell(view, index, Qt::Horizontal);
+ return 0;
+ } else {
+ index -= view->model()->columnCount();
+ }
+ }
+
+ int row = index / view->model()->columnCount();
+ int column = index % view->model()->columnCount();
+ QModelIndex modelIndex = indexFromLogical(row, column);
+ if (modelIndex.isValid()) {
+ *iface = cell(modelIndex);
+ return 0;
+ }
+ return -1;
+ }
+ default:
+ break;
+ }
+ return QAccessibleTable2::navigate(relation, index, iface);
+}
+
+QAccessible::Relation QAccessibleTree::relationTo(int, const QAccessibleInterface *, int) const
+{
+ return QAccessible::Unrelated;
+}
+
+QAccessibleTable2CellInterface *QAccessibleTree::cellAt(int row, int column) const
+{
+ QModelIndex index = indexFromLogical(row, column);
+ if (!index.isValid()) {
+ qWarning() << "Requested invalid tree cell: " << row << column;
+ return 0;
+ }
+ return new QAccessibleTable2Cell(view, index, cellRole());
+}
+
+QString QAccessibleTree::rowDescription(int) const
+{
+ return QString(); // no headers for rows in trees
+}
+
+bool QAccessibleTree::isRowSelected(int row) const
+{
+ QModelIndex index = indexFromLogical(row);
+ return view->selectionModel()->isRowSelected(index.row(), index.parent());
+}
+
+bool QAccessibleTree::selectRow(int row)
+{
+ QModelIndex index = indexFromLogical(row);
+ if (!index.isValid() || view->selectionMode() & QAbstractItemView::NoSelection)
+ return false;
+ view->selectionModel()->select(index, QItemSelectionModel::Select);
+ return true;
+}
+
+// TABLE CELL
+
+QAccessibleTable2Cell::QAccessibleTable2Cell(QAbstractItemView *view_, const QModelIndex &index_, QAccessible::Role role_)
+ : /* QAccessibleSimpleEditableTextInterface(this), */ view(view_), m_index(index_), m_role(role_)
+{
+ Q_ASSERT(index_.isValid());
+}
+
+int QAccessibleTable2Cell::columnExtent() const { return 1; }
+int QAccessibleTable2Cell::rowExtent() const { return 1; }
+
+QList<QAccessibleInterface*> QAccessibleTable2Cell::rowHeaderCells() const
+{
+ QList<QAccessibleInterface*> headerCell;
+ if (verticalHeader()) {
+ headerCell.append(new QAccessibleTable2HeaderCell(view, m_index.row(), Qt::Vertical));
+ }
+ return headerCell;
+}
+
+QList<QAccessibleInterface*> QAccessibleTable2Cell::columnHeaderCells() const
+{
+ QList<QAccessibleInterface*> headerCell;
+ if (horizontalHeader()) {
+ headerCell.append(new QAccessibleTable2HeaderCell(view, m_index.column(), Qt::Horizontal));
+ }
+ return headerCell;
+}
+
+QHeaderView *QAccessibleTable2Cell::horizontalHeader() const
+{
+ QHeaderView *header = 0;
+
+ if (false) {
+#ifndef QT_NO_TABLEVIEW
+ } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
+ header = tv->horizontalHeader();
+#endif
+#ifndef QT_NO_TREEVIEW
+ } else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) {
+ header = tv->header();
+#endif
+ }
+
+ return header;
+}
+
+QHeaderView *QAccessibleTable2Cell::verticalHeader() const
+{
+ QHeaderView *header = 0;
+#ifndef QT_NO_TABLEVIEW
+ if (const QTableView *tv = qobject_cast<const QTableView*>(view))
+ header = tv->verticalHeader();
+#endif
+ return header;
+}
+
+int QAccessibleTable2Cell::columnIndex() const
+{
+ return m_index.column();
+}
+
+int QAccessibleTable2Cell::rowIndex() const
+{
+ if (role(0) == QAccessible::TreeItem) {
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ Q_ASSERT(treeView);
+ int row = treeView->d_func()->viewIndex(m_index);
+ return row;
+ }
+ return m_index.row();
+}
+
+bool QAccessibleTable2Cell::isSelected() const
+{
+ return view->selectionModel()->isSelected(m_index);
+}
+
+void QAccessibleTable2Cell::rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const
+{
+ *row = m_index.row();
+ *column = m_index.column();
+ *rowExtents = 1;
+ *columnExtents = 1;
+ *selected = isSelected();
+}
+
+QAccessibleTable2Interface* QAccessibleTable2Cell::table() const
+{
+ return QAccessible::queryAccessibleInterface(view)->table2Interface();
+}
+
+QAccessible::Role QAccessibleTable2Cell::role(int child) const
+{
+ Q_ASSERT(child == 0);
+ return m_role;
+}
+
+QAccessible::State QAccessibleTable2Cell::state(int child) const
+{
+ Q_ASSERT(child == 0);
+ State st = Normal;
+
+ QRect globalRect = view->rect();
+ globalRect.translate(view->mapToGlobal(QPoint(0,0)));
+ if (!globalRect.intersects(rect(0)))
+ st |= Invisible;
+
+ if (view->selectionModel()->isSelected(m_index))
+ st |= Selected;
+ if (view->selectionModel()->currentIndex() == m_index)
+ st |= Focused;
+ if (m_index.model()->data(m_index, Qt::CheckStateRole).toInt() == Qt::Checked)
+ st |= Checked;
+
+ Qt::ItemFlags flags = m_index.flags();
+ if (flags & Qt::ItemIsSelectable) {
+ st |= Selectable;
+ st |= Focusable;
+ if (view->selectionMode() == QAbstractItemView::MultiSelection)
+ st |= MultiSelectable;
+ if (view->selectionMode() == QAbstractItemView::ExtendedSelection)
+ st |= ExtSelectable;
+ }
+ if (m_role == QAccessible::TreeItem) {
+ const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
+ if (treeView->isExpanded(m_index))
+ st |= Expanded;
+ }
+ return st;
+}
+
+bool QAccessibleTable2Cell::isExpandable() const
+{
+ return view->model()->hasChildren(m_index);
+}
+
+QRect QAccessibleTable2Cell::rect(int child) const
+{
+ Q_ASSERT(child == 0);
+
+ QRect r;
+ r = view->visualRect(m_index);
+
+ if (!r.isNull())
+ r.translate(view->viewport()->mapTo(view, QPoint(0,0)));
+ r.translate(view->mapToGlobal(QPoint(0, 0)));
+ return r;
+}
+
+QString QAccessibleTable2Cell::text(Text t, int child) const
+{
+ Q_ASSERT(child == 0);
+ QAbstractItemModel *model = view->model();
+ QString value;
+ switch (t) {
+ case QAccessible::Value:
+ case QAccessible::Name:
+ value = model->data(m_index, Qt::AccessibleTextRole).toString();
+ if (value.isEmpty())
+ value = model->data(m_index, Qt::DisplayRole).toString();
+ break;
+ case QAccessible::Description:
+ value = model->data(m_index, Qt::AccessibleDescriptionRole).toString();
+ break;
+ default:
+ break;
+ }
+ return value;
+}
+
+void QAccessibleTable2Cell::setText(Text /*t*/, int child, const QString &text)
+{
+ Q_ASSERT(child == 0);
+ if (!m_index.flags() & Qt::ItemIsEditable)
+ return;
+ view->model()->setData(m_index, text);
+}
+
+bool QAccessibleTable2Cell::isValid() const
+{
+ if (!m_index.isValid()) {
+ qDebug() << "Interface is not valid";
+ }
+
+ return m_index.isValid();
+}
+
+int QAccessibleTable2Cell::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
+{
+ if (relation == Ancestor && index == 1) {
+ if (m_role == QAccessible::TreeItem) {
+ *iface = new QAccessibleTree(view);
+ } else {
+ *iface = new QAccessibleTable2(view);
+ }
+ return 0;
+ }
+
+ *iface = 0;
+ if (!view)
+ return -1;
+
+ switch (relation) {
+
+ case Child: {
+ return -1;
+ }
+ case Sibling:
+ if (index > 0) {
+ QAccessibleInterface *parent = queryAccessibleInterface(view);
+ int ret = parent->navigate(QAccessible::Child, index, iface);
+ delete parent;
+ if (*iface)
+ return ret;
+ }
+ return -1;
+
+// From table1 implementation:
+// case Up:
+// case Down:
+// case Left:
+// case Right: {
+// // This is in the "not so nice" category. In order to find out which item
+// // is geometrically around, we have to set the current index, navigate
+// // and restore the index as well as the old selection
+// view->setUpdatesEnabled(false);
+// const QModelIndex oldIdx = view->currentIndex();
+// QList<QModelIndex> kids = children();
+// const QModelIndex currentIndex = index ? kids.at(index - 1) : QModelIndex(row);
+// const QItemSelection oldSelection = view->selectionModel()->selection();
+// view->setCurrentIndex(currentIndex);
+// const QModelIndex idx = view->moveCursor(toCursorAction(relation), Qt::NoModifier);
+// view->setCurrentIndex(oldIdx);
+// view->selectionModel()->select(oldSelection, QItemSelectionModel::ClearAndSelect);
+// view->setUpdatesEnabled(true);
+// if (!idx.isValid())
+// return -1;
+
+// if (idx.parent() != row.parent() || idx.row() != row.row())
+// *iface = cell(idx);
+// return index ? kids.indexOf(idx) + 1 : 0; }
+ default:
+ break;
+ }
+
+ return -1;
+}
+
+QAccessible::Relation QAccessibleTable2Cell::relationTo(int child, const QAccessibleInterface *other, int otherChild) const
+{
+ Q_ASSERT(child == 0);
+ Q_ASSERT(otherChild == 0);
+ // we only check for parent-child relationships in trees
+ if (m_role == QAccessible::TreeItem && other->role(0) == QAccessible::TreeItem) {
+ QModelIndex otherIndex = static_cast<const QAccessibleTable2Cell*>(other)->m_index;
+ // is the other our parent?
+ if (otherIndex.parent() == m_index)
+ return QAccessible::Ancestor;
+ // are we the other's child?
+ if (m_index.parent() == otherIndex)
+ return QAccessible::Child;
+ }
+ return QAccessible::Unrelated;
+}
+
+#ifndef QT_NO_ACTION
+int QAccessibleTable2Cell::userActionCount(int) const
+{
+ return 0;
+}
+
+QString QAccessibleTable2Cell::actionText(int, Text, int) const
+{
+ return QString();
+}
+
+bool QAccessibleTable2Cell::doAction(int, int, const QVariantList &)
+{
+ return false;
+}
+
+QAccessibleTable2HeaderCell::QAccessibleTable2HeaderCell(QAbstractItemView *view_, int index_, Qt::Orientation orientation_)
+ : view(view_), index(index_), orientation(orientation_)
+{
+ Q_ASSERT(index_ >= 0);
+}
+
+QAccessible::Role QAccessibleTable2HeaderCell::role(int child) const
+{
+ Q_ASSERT(child == 0);
+ if (orientation == Qt::Horizontal)
+ return QAccessible::ColumnHeader;
+ return QAccessible::RowHeader;
+}
+
+QAccessible::State QAccessibleTable2HeaderCell::state(int child) const
+{
+ Q_ASSERT(child == 0);
+ return QAccessible::Normal;
+}
+
+QRect QAccessibleTable2HeaderCell::rect(int child) const
+{
+ Q_ASSERT(child == 0);
+
+ QHeaderView *header = 0;
+ if (false) {
+#ifndef QT_NO_TABLEVIEW
+ } else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
+ if (orientation == Qt::Horizontal) {
+ header = tv->horizontalHeader();
+ } else {
+ header = tv->verticalHeader();
+ }
+#endif
+#ifndef QT_NO_TREEVIEW
+ } else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) {
+ header = tv->header();
+#endif
+ }
+ QPoint zero = header->mapToGlobal(QPoint(0, 0));
+ int sectionSize = header->sectionSize(index);
+ int sectionPos = header->sectionPosition(index);
+ return orientation == Qt::Horizontal
+ ? QRect(zero.x() + sectionPos, zero.y(), sectionSize, header->height())
+ : QRect(zero.x(), zero.y() + sectionPos, header->width(), sectionSize);
+}
+
+QString QAccessibleTable2HeaderCell::text(Text t, int child) const
+{
+ Q_ASSERT(child == 0);
+ QAbstractItemModel *model = view->model();
+ QString value;
+ switch (t) {
+ case QAccessible::Value:
+ case QAccessible::Name:
+ value = model->headerData(index, orientation, Qt::AccessibleTextRole).toString();
+ if (value.isEmpty())
+ value = model->headerData(index, orientation, Qt::DisplayRole).toString();
+ break;
+ case QAccessible::Description:
+ value = model->headerData(index, orientation, Qt::AccessibleDescriptionRole).toString();
+ break;
+ default:
+ break;
+ }
+ return value;
+}
+
+void QAccessibleTable2HeaderCell::setText(Text, int, const QString &)
+{
+ return;
+}
+
+bool QAccessibleTable2HeaderCell::isValid() const
+{
+ return true;
+}
+
+int QAccessibleTable2HeaderCell::navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
+{
+ if (relation == QAccessible::Ancestor && index == 1) {
+ if (false) {
+#ifndef QT_NO_TREEVIEW
+ } else if (qobject_cast<const QTreeView*>(view)) {
+ *iface = new QAccessibleTree(view);
+ return 0;
+#endif
+ } else {
+ *iface = new QAccessibleTable2(view);
+ return 0;
+ }
+ }
+ *iface = 0;
+ return -1;
+}
+
+QAccessible::Relation QAccessibleTable2HeaderCell::relationTo(int, const QAccessibleInterface *, int) const
+{
+ return QAccessible::Unrelated;
+}
+
+#ifndef QT_NO_ACTION
+int QAccessibleTable2HeaderCell::userActionCount(int) const
+{
+ return 0;
+}
+
+QString QAccessibleTable2HeaderCell::actionText(int, Text, int) const
+{
+ return QString();
+}
+
+bool QAccessibleTable2HeaderCell::doAction(int, int, const QVariantList &)
+{
+ return false;
+}
+#endif
+
+
+
+#endif
+
+#endif // QT_NO_ITEMVIEWS
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/accessible/widgets/itemviews.h b/src/plugins/accessible/widgets/itemviews.h
new file mode 100644
index 0000000..c8492e3
--- /dev/null
+++ b/src/plugins/accessible/widgets/itemviews.h
@@ -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 <QtGui/qabstractitemview.h>
+#include <QtGui/qheaderview.h>
+#include <QtGui/qaccessible.h>
+#include <QtGui/qaccessible2.h>
+#include <QtGui/qaccessiblewidget.h>
+
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_ACCESSIBILITY
+
+#ifndef QT_NO_ITEMVIEWS
+
+class QAccessibleTable2Cell;
+class QAccessibleTable2HeaderCell;
+
+class QAccessibleTable2: public QAccessibleTable2Interface, public QAccessibleObjectEx
+{
+ Q_ACCESSIBLE_OBJECT
+public:
+ explicit QAccessibleTable2(QWidget *w);
+
+ virtual ~QAccessibleTable2();
+
+ QObject *object() const { return view; }
+ Role role(int child) const;
+ State state(int child) const;
+ QString text(Text t, int child) const;
+ QRect rect(int child) const;
+
+ int childAt(int x, int y) const;
+ int childCount() const;
+ int indexOfChild(const QAccessibleInterface *) const;
+
+ int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
+ Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
+
+#ifndef QT_NO_ACTION
+ int userActionCount(int child) const;
+ QString actionText(int action, Text t, int child) const;
+ bool doAction(int action, int child, const QVariantList &params);
+#endif
+ QVariant invokeMethodEx(Method, int, const QVariantList &) { return QVariant(); }
+
+ // table2 interface
+ virtual QAccessibleTable2CellInterface *cellAt(int row, int column) const;
+ virtual QAccessibleInterface *caption() const;
+ virtual QAccessibleInterface *summary() const;
+ virtual QString columnDescription(int column) const;
+ virtual QString rowDescription(int row) const;
+ virtual int columnCount() const;
+ virtual int rowCount() const;
+ virtual QAccessible2::TableModelChange modelChange() const;
+
+ // selection
+ virtual int selectedCellCount() const;
+ virtual int selectedColumnCount() const;
+ virtual int selectedRowCount() const;
+ virtual QList<QAccessibleTable2CellInterface*> selectedCells() const;
+ virtual QList<int> selectedColumns() const;
+ virtual QList<int> selectedRows() const;
+ virtual bool isColumnSelected(int column) const;
+ virtual bool isRowSelected(int row) const;
+ virtual bool selectRow(int row);
+ virtual bool selectColumn(int column);
+ virtual bool unselectRow(int row);
+ virtual bool unselectColumn(int column);
+
+protected:
+ virtual void modelReset();
+ virtual void rowsInserted(const QModelIndex &parent, int first, int last);
+ virtual void rowsRemoved(const QModelIndex &parent, int first, int last);
+ virtual void columnsInserted(const QModelIndex &parent, int first, int last);
+ virtual void columnsRemoved(const QModelIndex &parent, int first, int last);
+ virtual void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row);
+ virtual void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column);
+
+protected:
+ QAbstractItemView* view;
+ QAccessible2::TableModelChange lastChange;
+ inline QAccessibleTable2Cell *cell(const QModelIndex &index) const;
+ inline QAccessible::Role cellRole() const {
+ switch (m_role) {
+ case QAccessible::List:
+ return QAccessible::ListItem;
+ case QAccessible::Table:
+ return QAccessible::Cell;
+ case QAccessible::Tree:
+ return QAccessible::TreeItem;
+ default:
+ Q_ASSERT(0);
+ }
+ return QAccessible::NoRole;
+ }
+
+ QHeaderView *horizontalHeader() const;
+ QHeaderView *verticalHeader() const;
+private:
+ // the child index for a model index
+ inline int logicalIndex(const QModelIndex &index) const;
+ // the model index from the child index
+ QAccessibleInterface *childFromLogical(int logicalIndex) const;
+ QAccessible::Role m_role;
+};
+
+class QAccessibleTree :public QAccessibleTable2
+{
+public:
+ explicit QAccessibleTree(QWidget *w)
+ : QAccessibleTable2(w)
+ {}
+
+ virtual ~QAccessibleTree() {}
+
+ int childAt(int x, int y) const;
+ int childCount() const;
+ int indexOfChild(const QAccessibleInterface *) const;
+
+ int rowCount() const;
+
+ int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
+ Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
+
+ // table2 interface
+ QAccessibleTable2CellInterface *cellAt(int row, int column) const;
+ QString rowDescription(int row) const;
+ bool isRowSelected(int row) const;
+ bool selectRow(int row);
+
+private:
+ QModelIndex indexFromLogical(int row, int column = 0) const;
+};
+
+class QAccessibleTable2Cell: public QAccessibleTable2CellInterface /*), public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface*/
+{
+public:
+ QAccessibleTable2Cell(QAbstractItemView *view, const QModelIndex &m_index, QAccessible::Role role);
+
+ QObject *object() const { return 0; }
+ Role role(int child) const;
+ State state(int child) const;
+ QRect rect(int child) const;
+ bool isValid() const;
+
+ int childAt(int, int) const { return 0; }
+ int childCount() const { return 0; }
+ int indexOfChild(const QAccessibleInterface *) const { return -1; }
+
+ QString text(Text t, int child) const;
+ void setText(Text t, int child, const QString &text);
+
+ int navigate(RelationFlag relation, int m_index, QAccessibleInterface **iface) const;
+ Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
+
+ bool isExpandable() const;
+
+#ifndef QT_NO_ACTION
+ int userActionCount(int child) const;
+ QString actionText(int action, Text t, int child) const;
+ bool doAction(int action, int child, const QVariantList &params);
+#endif
+
+ // cell interface
+ virtual int columnExtent() const;
+ virtual QList<QAccessibleInterface*> columnHeaderCells() const;
+ virtual int columnIndex() const;
+ virtual int rowExtent() const;
+ virtual QList<QAccessibleInterface*> rowHeaderCells() const;
+ virtual int rowIndex() const;
+ virtual bool isSelected() const;
+ virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const;
+ virtual QAccessibleTable2Interface* table() const;
+
+private:
+ QHeaderView *verticalHeader() const;
+ QHeaderView *horizontalHeader() const;
+ QAbstractItemView *view;
+ QModelIndex m_index;
+ QAccessible::Role m_role;
+
+friend class QAccessibleTable2;
+friend class QAccessibleTree;
+};
+
+
+class QAccessibleTable2HeaderCell: public QAccessibleInterface /*), public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface*/
+{
+public:
+ // For header cells, pass the header view in addition
+ QAccessibleTable2HeaderCell(QAbstractItemView *view, int index, Qt::Orientation orientation);
+
+ QObject *object() const { return 0; }
+ Role role(int child) const;
+ State state(int child) const;
+ QRect rect(int child) const;
+ bool isValid() const;
+
+ int childAt(int, int) const { return 0; }
+ int childCount() const { return 0; }
+ int indexOfChild(const QAccessibleInterface *) const { return -1; }
+
+ QString text(Text t, int child) const;
+ void setText(Text t, int child, const QString &text);
+
+ int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
+ Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
+
+#ifndef QT_NO_ACTION
+ int userActionCount(int child) const;
+ QString actionText(int action, Text t, int child) const;
+ bool doAction(int action, int child, const QVariantList &params);
+#endif
+
+private:
+ QAbstractItemView *view;
+ int index;
+ Qt::Orientation orientation;
+
+friend class QAccessibleTable2;
+friend class QAccessibleTree;
+};
+
+// This is the corner button on the top left of a table.
+// It can be used to select all cells or it is not active at all.
+// For now it is ignored.
+class QAccessibleTable2CornerButton: public QAccessibleInterface
+{
+public:
+ QAccessibleTable2CornerButton(QAbstractItemView *view_)
+ :view(view_)
+ {}
+
+ QObject *object() const { return 0; }
+ Role role(int child) const { Q_ASSERT(child == 0); return QAccessible::Pane; }
+ State state(int child) const { Q_ASSERT(child == 0); return QAccessible::Normal; }
+ QRect rect(int child) const { Q_ASSERT(child == 0); return QRect(); }
+ bool isValid() const { return true; }
+
+ int childAt(int, int) const { return 0; }
+ int childCount() const { return 0; }
+ int indexOfChild(const QAccessibleInterface *) const { return -1; }
+
+ QString text(Text, int) const { return QString(); }
+ void setText(Text, int, const QString &) {}
+
+ int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const
+ {
+ if (relation == QAccessible::Ancestor && index == 1) {
+ *iface = QAccessible::queryAccessibleInterface(view);
+ return 0;
+ }
+ return -1;
+ }
+ Relation relationTo(int, const QAccessibleInterface *, int) const
+ {
+ return QAccessible::Unrelated;
+ }
+
+#ifndef QT_NO_ACTION
+ int userActionCount(int) const { return 0; }
+ QString actionText(int, Text, int) const { return QString(); }
+ bool doAction(int, int, const QVariantList &) { return false; }
+#endif
+private:
+ QAbstractItemView *view;
+};
+
+
+#endif
+
+#endif // QT_NO_ACCESSIBILITY
+
+QT_END_NAMESPACE
+
+#endif // ACCESSIBLE_ITEMVIEWS_H
diff --git a/src/plugins/accessible/widgets/main.cpp b/src/plugins/accessible/widgets/main.cpp
index aa5459c..cd17a6e 100644
--- a/src/plugins/accessible/widgets/main.cpp
+++ b/src/plugins/accessible/widgets/main.cpp
@@ -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);
diff --git a/src/plugins/accessible/widgets/widgets.pro b/src/plugins/accessible/widgets/widgets.pro
index 79110cb..9632f41 100644
--- a/src/plugins/accessible/widgets/widgets.pro
+++ b/src/plugins/accessible/widgets/widgets.pro
@@ -7,14 +7,18 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/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
+
+
diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp
index f6c4018..5b0406f 100644
--- a/src/sql/models/qsqlrelationaltablemodel.cpp
+++ b/src/sql/models/qsqlrelationaltablemodel.cpp
@@ -119,6 +119,8 @@ QT_BEGIN_NAMESPACE
returns false.
*/
+class QRelatedTableModel;
+
struct QRelation
{
public:
@@ -135,7 +137,7 @@ struct QRelation
bool isValid();
QSqlRelation rel;
- QSqlTableModel *model;
+ QRelatedTableModel *model;
QHash<QString, QVariant> dictionary;//maps keys to display values
private:
@@ -143,6 +145,15 @@ struct QRelation
bool m_dictInitialized;
};
+class QRelatedTableModel : public QSqlTableModel
+{
+public:
+ QRelatedTableModel(QRelation *rel, QObject *parent = 0, QSqlDatabase db = QSqlDatabase());
+ bool select();
+private:
+ bool firstSelect;
+ QRelation *relation;
+};
/*
A QRelation must be initialized before it is considered valid.
Note: population of the model and dictionary are kept separate
@@ -162,7 +173,7 @@ void QRelation::populateModel()
Q_ASSERT(m_parent != NULL);
if (!model) {
- model = new QSqlTableModel(m_parent, m_parent->database());
+ model = new QRelatedTableModel(this, m_parent, m_parent->database());
model->setTable(rel.tableName());
model->select();
}
@@ -219,6 +230,27 @@ bool QRelation::isValid()
return (rel.isValid() && m_parent != NULL);
}
+
+
+QRelatedTableModel::QRelatedTableModel(QRelation *rel, QObject *parent, QSqlDatabase db) :
+ QSqlTableModel(parent, db), firstSelect(true), relation(rel)
+{
+}
+
+bool QRelatedTableModel::select()
+{
+ if (firstSelect) {
+ firstSelect = false;
+ return QSqlTableModel::select();
+ }
+ relation->clearDictionary();
+ bool res = QSqlTableModel::select();
+ if (res)
+ relation->populateDictionary();
+ return res;
+}
+
+
class QSqlRelationalTableModelPrivate: public QSqlTableModelPrivate
{
Q_DECLARE_PUBLIC(QSqlRelationalTableModel)
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 023df89..d2ea988 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1015,6 +1015,7 @@ static bool isValidSlot(const QMetaMethod &sl)
}
Q_TESTLIB_EXPORT bool printAvailableFunctions = false;
+Q_TESTLIB_EXPORT bool printAvailableTags = false;
Q_TESTLIB_EXPORT QStringList testFunctions;
Q_TESTLIB_EXPORT QStringList testTags;
@@ -1027,6 +1028,65 @@ static void qPrintTestSlots()
}
}
+static void qPrintDataTags()
+{
+ // Get global data tags:
+ QTestTable::globalTestTable();
+ invokeMethod(QTest::currentTestObject, "initTestCase_data()");
+ const QTestTable *gTable = QTestTable::globalTestTable();
+
+ const QMetaObject *currTestMetaObj = QTest::currentTestObject->metaObject();
+
+ // Process test functions:
+ for (int i = 0; i < currTestMetaObj->methodCount(); ++i) {
+ QMetaMethod tf = currTestMetaObj->method(i);
+ if (isValidSlot(tf)) {
+ // Retrieve local tags:
+ QStringList localTags;
+ QTestTable table;
+ char member[512];
+ char *slot = qstrdup(tf.signature());
+ slot[strlen(slot) - 2] = '\0';
+ QTest::qt_snprintf(member, 512, "%s_data()", slot);
+ invokeMethod(QTest::currentTestObject, member);
+ for (int j = 0; j < table.dataCount(); ++j)
+ localTags << QLatin1String(table.testData(j)->dataTag());
+
+ // Print all tag combinations:
+ if (gTable->dataCount() == 0) {
+ if (localTags.count() == 0) {
+ // No tags at all, so just print the test function:
+ printf("%s %s\n", currTestMetaObj->className(), slot);
+ } else {
+ // Only local tags, so print each of them:
+ for (int k = 0; k < localTags.size(); ++k)
+ printf(
+ "%s %s %s\n",
+ currTestMetaObj->className(), slot, localTags.at(k).toLatin1().data());
+ }
+ } else {
+ for (int j = 0; j < gTable->dataCount(); ++j) {
+ if (localTags.count() == 0) {
+ // Only global tags, so print the current one:
+ printf(
+ "%s %s __global__ %s\n",
+ currTestMetaObj->className(), slot, gTable->testData(j)->dataTag());
+ } else {
+ // Local and global tags, so print each of the local ones and
+ // the current global one:
+ for (int k = 0; k < localTags.size(); ++k)
+ printf(
+ "%s %s %s __global__ %s\n", currTestMetaObj->className(), slot,
+ localTags.at(k).toLatin1().data(), gTable->testData(j)->dataTag());
+ }
+ }
+ }
+
+ delete[] slot;
+ }
+ }
+}
+
static int qToInt(char *str)
{
char *pEnd;
@@ -1043,6 +1103,8 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
const char *testOptions =
" options:\n"
" -functions : Returns a list of current testfunctions\n"
+ " -datatags : Returns a list of current data tags.\n"
+ " A global data tag is preceded by ' __global__ '.\n"
" -xunitxml : Outputs results as XML XUnit document\n"
" -xml : Outputs results as XML document\n"
" -lightxml : Outputs results as stream of XML tags\n"
@@ -1094,6 +1156,12 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
qPrintTestSlots();
exit(0);
}
+ } else if (strcmp(argv[i], "-datatags") == 0) {
+ QTest::printAvailableTags = true;
+ if (!qml) {
+ qPrintDataTags();
+ exit(0);
+ }
} else if(strcmp(argv[i], "-xunitxml") == 0){
QTestLog::setLogMode(QTestLog::XunitXML);
} else if (strcmp(argv[i], "-xml") == 0) {
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 8a2d559..03fafe0 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -191,6 +191,8 @@ void initLogger()
}
}
+extern Q_TESTLIB_EXPORT bool printAvailableTags;
+
}
QTestLog::QTestLog()
@@ -203,6 +205,9 @@ QTestLog::~QTestLog()
void QTestLog::enterTestFunction(const char* function)
{
+ if (QTest::printAvailableTags)
+ return;
+
QTEST_ASSERT(QTest::testLogger);
QTEST_ASSERT(function);
@@ -222,6 +227,9 @@ int QTestLog::unhandledIgnoreMessages()
void QTestLog::leaveTestFunction()
{
+ if (QTest::printAvailableTags)
+ return;
+
QTEST_ASSERT(QTest::testLogger);
QTest::IgnoreResultList::clearList(QTest::ignoreResultList);
@@ -244,6 +252,9 @@ void QTestLog::printUnhandledIgnoreMessages()
void QTestLog::addPass(const char *msg)
{
+ if (QTest::printAvailableTags)
+ return;
+
QTEST_ASSERT(QTest::testLogger);
QTEST_ASSERT(msg);
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index d764187..d452820 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -190,7 +190,8 @@ static int verifyHierarchy(QAccessibleInterface *iface)
if (middleChild) {
entry = if2->navigate(QAccessible::Sibling, middle, &if3);
EXPECT(entry == 0 && if3->object() == middleChild->object());
- delete if3;
+ if (entry == 0)
+ delete if3;
EXPECT(iface->indexOfChild(middleChild) == middle);
}
@@ -270,6 +271,9 @@ private slots:
void scrollAreaTest();
void tableWidgetTest();
void tableViewTest();
+ void table2ListTest();
+ void table2TreeTest();
+ void table2TableTest();
void calendarWidgetTest();
void dockWidgetTest();
void pushButtonTest();
@@ -304,6 +308,10 @@ QString eventName(const int ev)
case 0x0012: return "ScrollingStart";
case 0x0013: return "ScrollingEnd";
case 0x0018: return "MenuCommand";
+
+ case 0x0116: return "TableModelChanged";
+ case 0x011B: return "TextCaretMoved";
+
case 0x8000: return "ObjectCreated";
case 0x8001: return "ObjectDestroyed";
case 0x8002: return "ObjectShow";
@@ -1752,18 +1760,21 @@ void tst_QAccessibility::applicationTest()
void tst_QAccessibility::mainWindowTest()
{
- QMainWindow mw;
- mw.resize(300, 200);
- mw.show(); // triggers layout
+ QMainWindow *mw = new QMainWindow;
+ mw->resize(300, 200);
+ mw->show(); // triggers layout
QLatin1String name = QLatin1String("I am the main window");
- mw.setWindowTitle(name);
- QTest::qWaitForWindowShown(&mw);
+ mw->setWindowTitle(name);
+ QTest::qWaitForWindowShown(mw);
+ QVERIFY_EVENT(mw, 0, QAccessible::ObjectShow);
- QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&mw);
+ QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(mw);
QCOMPARE(interface->text(QAccessible::Name, 0), name);
QCOMPARE(interface->role(0), QAccessible::Window);
delete interface;
+ delete mw;
+ QTestAccessibility::clearEvents();
}
class CounterButton : public QPushButton {
@@ -2749,6 +2760,9 @@ void tst_QAccessibility::textBrowserTest()
void tst_QAccessibility::listViewTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
{
QListView listView;
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&listView);
@@ -2814,6 +2828,7 @@ void tst_QAccessibility::listViewTest()
}
QTestAccessibility::clearEvents();
+#endif
}
@@ -3068,9 +3083,11 @@ void tst_QAccessibility::lineEditTest()
le3->deselect();
le3->setCursorPosition(3);
QCOMPARE(textIface->cursorPosition(), 3);
+ QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le3, 0, QAccessible::TextCaretMoved)));
QCOMPARE(textIface->selectionCount(), 0);
- int start, end;
+ QTestAccessibility::clearEvents();
+ int start, end;
QCOMPARE(textIface->text(0, 8), QString::fromLatin1("I always"));
QCOMPARE(textIface->textAtOffset(0, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1("I"));
QCOMPARE(start, 0);
@@ -3113,6 +3130,7 @@ void tst_QAccessibility::lineEditTest()
delete iface;
delete toplevel;
+ QTestAccessibility::clearEvents();
}
void tst_QAccessibility::workspaceTest()
@@ -3523,6 +3541,9 @@ void tst_QAccessibility::scrollAreaTest()
void tst_QAccessibility::tableWidgetTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
{
QWidget *topLevel = new QWidget;
QTableWidget *w = new QTableWidget(8,4,topLevel);
@@ -3562,6 +3583,7 @@ void tst_QAccessibility::tableWidgetTest()
delete topLevel;
}
QTestAccessibility::clearEvents();
+#endif
}
class QtTestTableModel: public QAbstractTableModel
@@ -3644,6 +3666,9 @@ public:
void tst_QAccessibility::tableViewTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
{
QtTestTableModel *model = new QtTestTableModel(3, 4);
QTableView *w = new QTableView();
@@ -3723,6 +3748,331 @@ void tst_QAccessibility::tableViewTest()
delete model;
}
QTestAccessibility::clearEvents();
+#endif
+}
+
+void tst_QAccessibility::table2ListTest()
+{
+#if !defined(Q_WS_X11)
+ QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll);
+#else
+ QListWidget *listView = new QListWidget;
+ listView->addItem("Oslo");
+ listView->addItem("Berlin");
+ listView->addItem("Brisbane");
+ listView->resize(400,400);
+ listView->show();
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(listView);
+ QTest::qWait(100);
+#endif
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(listView);
+ QCOMPARE(verifyHierarchy(iface), 0);
+
+ QCOMPARE((int)iface->role(0), (int)QAccessible::List);
+ QCOMPARE(iface->childCount(), 3);
+
+ QAccessibleInterface *child1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 1, &child1), 0);
+ QVERIFY(child1);
+ QCOMPARE(iface->indexOfChild(child1), 1);
+ QCOMPARE(child1->text(QAccessible::Name, 0), QString("Oslo"));
+ QCOMPARE(child1->role(0), QAccessible::ListItem);
+ delete child1;
+
+ QAccessibleInterface *child2 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 2, &child2), 0);
+ QVERIFY(child2);
+ QCOMPARE(iface->indexOfChild(child2), 2);
+ QCOMPARE(child2->text(QAccessible::Name, 0), QString("Berlin"));
+ delete child2;
+
+ QAccessibleInterface *child3 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 3, &child3), 0);
+ QVERIFY(child3);
+ QCOMPARE(iface->indexOfChild(child3), 3);
+ QCOMPARE(child3->text(QAccessible::Name, 0), QString("Brisbane"));
+ delete child3;
+ QTestAccessibility::clearEvents();
+
+ // Check for events
+ QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(1)).center());
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 2, QAccessible::Selection)));
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 2, QAccessible::Focus)));
+ QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(2)).center());
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 3, QAccessible::Selection)));
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 3, QAccessible::Focus)));
+
+ listView->addItem("Munich");
+ QCOMPARE(iface->childCount(), 4);
+
+ // table 2
+ QAccessibleTable2Interface *table2 = iface->table2Interface();
+ QVERIFY(table2);
+ QCOMPARE(table2->columnCount(), 1);
+ QCOMPARE(table2->rowCount(), 4);
+ QAccessibleTable2CellInterface *cell1;
+ QVERIFY(cell1 = table2->cellAt(0,0));
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Oslo"));
+ QAccessibleTable2CellInterface *cell4;
+ QVERIFY(cell4 = table2->cellAt(3,0));
+ QCOMPARE(cell4->text(QAccessible::Name, 0), QString("Munich"));
+ QCOMPARE(cell4->role(0), QAccessible::ListItem);
+ QCOMPARE(cell4->rowIndex(), 3);
+ QCOMPARE(cell4->columnIndex(), 0);
+ QVERIFY(!cell4->isExpandable());
+
+ delete cell4;
+ delete cell1;
+ delete iface;
+ delete listView;
+ QTestAccessibility::clearEvents();
+#endif
+}
+
+void tst_QAccessibility::table2TreeTest()
+{
+#if !defined(Q_WS_X11)
+ QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll);
+#else
+ QTreeWidget *treeView = new QTreeWidget;
+ treeView->setColumnCount(2);
+ QTreeWidgetItem *header = new QTreeWidgetItem;
+ header->setText(0, "Artist");
+ header->setText(1, "Work");
+ treeView->setHeaderItem(header);
+
+ QTreeWidgetItem *root1 = new QTreeWidgetItem;
+ root1->setText(0, "Spain");
+ treeView->addTopLevelItem(root1);
+
+ QTreeWidgetItem *item1 = new QTreeWidgetItem;
+ item1->setText(0, "Picasso");
+ item1->setText(1, "Guernica");
+ root1->addChild(item1);
+
+ QTreeWidgetItem *item2 = new QTreeWidgetItem;
+ item2->setText(0, "Tapies");
+ item2->setText(1, "Ambrosia");
+ root1->addChild(item2);
+
+ QTreeWidgetItem *root2 = new QTreeWidgetItem;
+ root2->setText(0, "Austria");
+ treeView->addTopLevelItem(root2);
+
+ QTreeWidgetItem *item3 = new QTreeWidgetItem;
+ item3->setText(0, "Klimt");
+ item3->setText(1, "The Kiss");
+ root2->addChild(item3);
+
+ treeView->resize(400,400);
+ treeView->show();
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(treeView);
+ QTest::qWait(100);
+#endif
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(treeView);
+ QEXPECT_FAIL("", "Implement Sibling navigation for table2 cells.", Continue);
+ QCOMPARE(verifyHierarchy(iface), 0);
+
+ QCOMPARE((int)iface->role(0), (int)QAccessible::Tree);
+ // header and 2 rows (the others are not expanded, thus not visible)
+ QCOMPARE(iface->childCount(), 6);
+
+ QAccessibleInterface *header1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 1, &header1), 0);
+ QVERIFY(header1);
+ QCOMPARE(iface->indexOfChild(header1), 1);
+ QCOMPARE(header1->text(QAccessible::Name, 0), QString("Artist"));
+ QCOMPARE(header1->role(0), QAccessible::ColumnHeader);
+ delete header1;
+
+ QAccessibleInterface *child1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 3, &child1), 0);
+ QVERIFY(child1);
+ QCOMPARE(iface->indexOfChild(child1), 3);
+ QCOMPARE(child1->text(QAccessible::Name, 0), QString("Spain"));
+ QCOMPARE(child1->role(0), QAccessible::TreeItem);
+ QVERIFY(!(child1->state(0) & QAccessible::Expanded));
+ delete child1;
+
+ QAccessibleInterface *child2 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 5, &child2), 0);
+ QVERIFY(child2);
+ QCOMPARE(iface->indexOfChild(child2), 5);
+ QCOMPARE(child2->text(QAccessible::Name, 0), QString("Austria"));
+ delete child2;
+
+ QTestAccessibility::clearEvents();
+
+ // table 2
+ QAccessibleTable2Interface *table2 = iface->table2Interface();
+ QVERIFY(table2);
+ QCOMPARE(table2->columnCount(), 2);
+ QCOMPARE(table2->rowCount(), 2);
+ QAccessibleTable2CellInterface *cell1;
+ QVERIFY(cell1 = table2->cellAt(0,0));
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Spain"));
+ QAccessibleTable2CellInterface *cell2;
+ QVERIFY(cell2 = table2->cellAt(1,0));
+ QCOMPARE(cell2->text(QAccessible::Name, 0), QString("Austria"));
+ QCOMPARE(cell2->role(0), QAccessible::TreeItem);
+ QCOMPARE(cell2->rowIndex(), 1);
+ QCOMPARE(cell2->columnIndex(), 0);
+ QVERIFY(cell2->isExpandable());
+ QCOMPARE(iface->indexOfChild(cell2), 5);
+ QVERIFY(!(cell2->state(0) & QAccessible::Expanded));
+ QCOMPARE(table2->columnDescription(1), QString("Work"));
+ delete cell2;
+ delete cell1;
+
+ treeView->expandAll();
+
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(treeView);
+ QTest::qWait(100);
+#endif
+
+ QCOMPARE(table2->columnCount(), 2);
+ QCOMPARE(table2->rowCount(), 5);
+ cell1 = table2->cellAt(1,0);
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Picasso"));
+ QCOMPARE(iface->indexOfChild(cell1), 5); // 1 based + 2 header + 2 for root item
+
+ cell2 = table2->cellAt(4,0);
+ QCOMPARE(cell2->text(QAccessible::Name, 0), QString("Klimt"));
+ QCOMPARE(cell2->role(0), QAccessible::TreeItem);
+ QCOMPARE(cell2->rowIndex(), 4);
+ QCOMPARE(cell2->columnIndex(), 0);
+ QVERIFY(!cell2->isExpandable());
+ QCOMPARE(iface->indexOfChild(cell2), 11);
+
+ QCOMPARE(table2->columnDescription(0), QString("Artist"));
+ QCOMPARE(table2->columnDescription(1), QString("Work"));
+
+ delete iface;
+ QTestAccessibility::clearEvents();
+#endif
+}
+
+
+void tst_QAccessibility::table2TableTest()
+{
+#if !defined(Q_WS_X11)
+ QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll);
+#else
+ QTableWidget *tableView = new QTableWidget(3, 3);
+ tableView->setColumnCount(3);
+ QStringList hHeader;
+ hHeader << "h1" << "h2" << "h3";
+ tableView->setHorizontalHeaderLabels(hHeader);
+
+ QStringList vHeader;
+ vHeader << "v1" << "v2" << "v3";
+ tableView->setVerticalHeaderLabels(vHeader);
+
+ for (int i = 0; i<9; ++i) {
+ QTableWidgetItem *item = new QTableWidgetItem;
+ item->setText(QString::number(i/3) + QString(".") + QString::number(i%3));
+ tableView->setItem(i/3, i%3, item);
+ }
+
+ tableView->resize(600,600);
+ tableView->show();
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(tableView);
+ QTest::qWait(100);
+#endif
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(tableView);
+ QEXPECT_FAIL("", "Implement Sibling navigation for table2 cells.", Continue);
+ QCOMPARE(verifyHierarchy(iface), 0);
+
+ QCOMPARE((int)iface->role(0), (int)QAccessible::Table);
+ // header and 2 rows (the others are not expanded, thus not visible)
+ QCOMPARE(iface->childCount(), 9+3+3+1); // cell+headers+topleft button
+
+ QAccessibleInterface *cornerButton = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 1, &cornerButton), 0);
+ QVERIFY(cornerButton);
+ QCOMPARE(iface->indexOfChild(cornerButton), 1);
+ QCOMPARE(cornerButton->role(0), QAccessible::Pane);
+ delete cornerButton;
+
+ QAccessibleInterface *child1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 3, &child1), 0);
+ QVERIFY(child1);
+ QCOMPARE(iface->indexOfChild(child1), 3);
+ QCOMPARE(child1->text(QAccessible::Name, 0), QString("h2"));
+ QCOMPARE(child1->role(0), QAccessible::ColumnHeader);
+ QVERIFY(!(child1->state(0) & QAccessible::Expanded));
+ delete child1;
+
+ QAccessibleInterface *child2 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 11, &child2), 0);
+ QVERIFY(child2);
+ QCOMPARE(iface->indexOfChild(child2), 11);
+ QCOMPARE(child2->text(QAccessible::Name, 0), QString("1.1"));
+ QAccessibleTable2CellInterface *cell2Iface = static_cast<QAccessibleTable2CellInterface*>(child2);
+ QCOMPARE(cell2Iface->rowIndex(), 1);
+ QCOMPARE(cell2Iface->columnIndex(), 1);
+ delete child2;
+
+ QAccessibleInterface *child3 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 12, &child3), 0);
+ QCOMPARE(iface->indexOfChild(child3), 12);
+ QCOMPARE(child3->text(QAccessible::Name, 0), QString("1.2"));
+ delete child3;
+
+ QTestAccessibility::clearEvents();
+
+ // table 2
+ QAccessibleTable2Interface *table2 = iface->table2Interface();
+ QVERIFY(table2);
+ QCOMPARE(table2->columnCount(), 3);
+ QCOMPARE(table2->rowCount(), 3);
+ QAccessibleTable2CellInterface *cell1;
+ QVERIFY(cell1 = table2->cellAt(0,0));
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("0.0"));
+ QCOMPARE(iface->indexOfChild(cell1), 6);
+
+ QAccessibleTable2CellInterface *cell2;
+ QVERIFY(cell2 = table2->cellAt(0,1));
+ QCOMPARE(cell2->text(QAccessible::Name, 0), QString("0.1"));
+ QCOMPARE(cell2->role(0), QAccessible::Cell);
+ QCOMPARE(cell2->rowIndex(), 0);
+ QCOMPARE(cell2->columnIndex(), 1);
+ QCOMPARE(iface->indexOfChild(cell2), 7);
+ delete cell2;
+
+ QAccessibleTable2CellInterface *cell3;
+ QVERIFY(cell3 = table2->cellAt(1,2));
+ QCOMPARE(cell3->text(QAccessible::Name, 0), QString("1.2"));
+ QCOMPARE(cell3->role(0), QAccessible::Cell);
+ QCOMPARE(cell3->rowIndex(), 1);
+ QCOMPARE(cell3->columnIndex(), 2);
+ QCOMPARE(iface->indexOfChild(cell3), 12);
+ delete cell3;
+
+ QCOMPARE(table2->columnDescription(0), QString("h1"));
+ QCOMPARE(table2->columnDescription(1), QString("h2"));
+ QCOMPARE(table2->columnDescription(2), QString("h3"));
+ QCOMPARE(table2->rowDescription(0), QString("v1"));
+ QCOMPARE(table2->rowDescription(1), QString("v2"));
+ QCOMPARE(table2->rowDescription(2), QString("v3"));
+
+ delete iface;
+
+ delete tableView;
+
+ QTestAccessibility::clearEvents();
+#endif
}
void tst_QAccessibility::calendarWidgetTest()
@@ -3980,6 +4330,9 @@ void tst_QAccessibility::comboBoxTest()
void tst_QAccessibility::treeWidgetTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
QWidget *w = new QWidget;
QTreeWidget *tree = new QTreeWidget(w);
QHBoxLayout *l = new QHBoxLayout(w);
@@ -4037,6 +4390,7 @@ void tst_QAccessibility::treeWidgetTest()
delete w;
QTestAccessibility::clearEvents();
+#endif
}
void tst_QAccessibility::labelTest()
diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
index cc4ab67..5f1a621 100644
--- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
+++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
@@ -92,6 +92,7 @@ private slots:
void escapedTableName();
void whiteSpaceInIdentifiers();
void psqlSchemaTest();
+ void selectAfterUpdate();
private:
void dropTestTables( QSqlDatabase db );
@@ -1467,5 +1468,27 @@ void tst_QSqlRelationalTableModel::psqlSchemaTest()
QVERIFY_SQL(model, select());
}
+void tst_QSqlRelationalTableModel::selectAfterUpdate()
+{
+ QFETCH_GLOBAL(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+
+ QSqlRelationalTableModel model(0, db);
+ model.setTable(reltest1);
+ model.setRelation(2, QSqlRelation(reltest2, "tid", "title"));
+ QVERIFY_SQL(model, select());
+ QVERIFY(model.relationModel(2)->rowCount() == 2);
+ {
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec("insert into " + reltest2 + " values(3, 'mrs')"));
+ model.relationModel(2)->select();
+ }
+ QVERIFY(model.relationModel(2)->rowCount() == 3);
+ QVERIFY(model.setData(model.index(0,2), 3));
+ QVERIFY(model.submitAll());
+ QCOMPARE(model.data(model.index(0,2)), QVariant("mrs"));
+}
+
QTEST_MAIN(tst_QSqlRelationalTableModel)
#include "tst_qsqlrelationaltablemodel.moc"
diff --git a/tests/auto/qxmlquery/pushBaselines/allAtomics.ref b/tests/auto/qxmlquery/pushBaselines/allAtomics.ref
index cceabfe..ddb5bc7 100644
--- a/tests/auto/qxmlquery/pushBaselines/allAtomics.ref
+++ b/tests/auto/qxmlquery/pushBaselines/allAtomics.ref
@@ -1,6 +1,6 @@
startOfSequence()
atomicValue(xs:untypedAtomic)
-atomicValue(2002-10-10T23:02:11)
+atomicValue(2002-10-10T23:02:11Z)
atomicValue(2002-10-10)
atomicValue()
atomicValue()
diff --git a/tests/auto/selftests/expected_printdatatags.txt b/tests/auto/selftests/expected_printdatatags.txt
new file mode 100644
index 0000000..ac22f23
--- /dev/null
+++ b/tests/auto/selftests/expected_printdatatags.txt
@@ -0,0 +1,6 @@
+tst_MyTestCase a data tag a1
+tst_MyTestCase a data tag a2
+tst_MyTestCase b
+tst_MyTestCase c data tag c1
+tst_MyTestCase c data tag c2
+tst_MyTestCase c data tag c3
diff --git a/tests/auto/selftests/expected_printdatatagswithglobaltags.txt b/tests/auto/selftests/expected_printdatatagswithglobaltags.txt
new file mode 100644
index 0000000..32feba4
--- /dev/null
+++ b/tests/auto/selftests/expected_printdatatagswithglobaltags.txt
@@ -0,0 +1,12 @@
+tst_MyTestCase a data tag a1 __global__ global data tag 1
+tst_MyTestCase a data tag a2 __global__ global data tag 1
+tst_MyTestCase a data tag a1 __global__ global data tag 2
+tst_MyTestCase a data tag a2 __global__ global data tag 2
+tst_MyTestCase b __global__ global data tag 1
+tst_MyTestCase b __global__ global data tag 2
+tst_MyTestCase c data tag c1 __global__ global data tag 1
+tst_MyTestCase c data tag c2 __global__ global data tag 1
+tst_MyTestCase c data tag c3 __global__ global data tag 1
+tst_MyTestCase c data tag c1 __global__ global data tag 2
+tst_MyTestCase c data tag c2 __global__ global data tag 2
+tst_MyTestCase c data tag c3 __global__ global data tag 2
diff --git a/tests/auto/selftests/printdatatags/printdatatags.pro b/tests/auto/selftests/printdatatags/printdatatags.pro
new file mode 100644
index 0000000..a134422
--- /dev/null
+++ b/tests/auto/selftests/printdatatags/printdatatags.pro
@@ -0,0 +1,8 @@
+load(qttest_p4)
+SOURCES += tst_printdatatags.cpp
+QT = core
+
+mac:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+
+TARGET = printdatatags
diff --git a/tests/auto/selftests/printdatatags/tst_printdatatags.cpp b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp
new file mode 100644
index 0000000..79f8890
--- /dev/null
+++ b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** 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 test suite 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 <QtTest/QtTest>
+
+class tst_MyTestCase: public QObject
+{
+ Q_OBJECT
+private slots:
+ void a_data() const;
+ void a() const;
+
+ void b() const;
+
+ void c_data() const;
+ void c() const;
+};
+
+void tst_MyTestCase::a_data() const
+{
+ QTest::addColumn<int>("x");
+ QTest::addColumn<int>("y");
+
+ QTest::newRow("data tag a1 ") << 1 << 2;
+ QTest::newRow("data tag a2") << 1 << 2;
+}
+
+void tst_MyTestCase::a() const
+{
+}
+
+void tst_MyTestCase::b() const
+{
+}
+
+void tst_MyTestCase::c_data() const
+{
+ QTest::addColumn<int>("x");
+
+ QTest::newRow("data tag c1") << 1;
+ QTest::newRow("data tag c2") << 1;
+ QTest::newRow("data tag c3") << 1;
+}
+
+void tst_MyTestCase::c() const
+{
+}
+
+QTEST_MAIN(tst_MyTestCase)
+
+#include "tst_printdatatags.moc"
diff --git a/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro b/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro
new file mode 100644
index 0000000..100ba1c
--- /dev/null
+++ b/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro
@@ -0,0 +1,8 @@
+load(qttest_p4)
+SOURCES += tst_printdatatagswithglobaltags.cpp
+QT = core
+
+mac:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+
+TARGET = printdatatagswithglobaltags
diff --git a/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp
new file mode 100644
index 0000000..6b0e61b
--- /dev/null
+++ b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** 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 test suite 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 <QtTest/QtTest>
+
+class tst_MyTestCase: public QObject
+{
+ Q_OBJECT
+private slots:
+ void initTestCase_data() const;
+ void initTestCase() const;
+
+ void a_data() const;
+ void a() const;
+
+ void b() const;
+
+ void c_data() const;
+ void c() const;
+};
+
+void tst_MyTestCase::initTestCase_data() const
+{
+ QTest::addColumn<int>("f");
+ QTest::addColumn<int>("g");
+
+ QTest::newRow("global data tag 1 ") << 1 << 2;
+ QTest::newRow("global data tag 2") << 1 << 2;
+}
+
+void tst_MyTestCase::initTestCase() const
+{
+}
+
+void tst_MyTestCase::a_data() const
+{
+ QTest::addColumn<int>("x");
+ QTest::addColumn<int>("y");
+
+ QTest::newRow("data tag a1 ") << 1 << 2;
+ QTest::newRow("data tag a2") << 1 << 2;
+}
+
+void tst_MyTestCase::a() const
+{
+}
+
+void tst_MyTestCase::b() const
+{
+}
+
+void tst_MyTestCase::c_data() const
+{
+ QTest::addColumn<int>("x");
+
+ QTest::newRow("data tag c1") << 1;
+ QTest::newRow("data tag c2") << 1;
+ QTest::newRow("data tag c3") << 1;
+}
+
+void tst_MyTestCase::c() const
+{
+}
+
+QTEST_MAIN(tst_MyTestCase)
+
+#include "tst_printdatatagswithglobaltags.moc"
diff --git a/tests/auto/selftests/selftests.pro b/tests/auto/selftests/selftests.pro
index 2f1c327..74cd075 100644
--- a/tests/auto/selftests/selftests.pro
+++ b/tests/auto/selftests/selftests.pro
@@ -5,7 +5,8 @@ SUBDIRS = subtest test warnings maxwarnings cmptest globaldata skipglobal skip \
skipinit skipinitdata datetime singleskip assert waitwithoutgui differentexec \
exceptionthrow qexecstringlist datatable commandlinedata\
benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \
- benchliboptions xunit badxml longstring
+ benchliboptions xunit badxml longstring printdatatags \
+ printdatatagswithglobaltags
INSTALLS =
diff --git a/tests/auto/selftests/selftests.qrc b/tests/auto/selftests/selftests.qrc
index f82722b..5bd0e12 100644
--- a/tests/auto/selftests/selftests.qrc
+++ b/tests/auto/selftests/selftests.qrc
@@ -89,6 +89,8 @@
<file>expected_multiexec.txt</file>
<file>expected_multiexec.xml</file>
<file>expected_multiexec.xunitxml</file>
+ <file>expected_printdatatags.txt</file>
+ <file>expected_printdatatagswithglobaltags.txt</file>
<file>expected_qexecstringlist.txt</file>
<file>expected_singleskip.lightxml</file>
<file>expected_singleskip.txt</file>
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 1a95420..3686304 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -245,6 +245,8 @@ void tst_Selftests::runSubTest_data()
<< "xunit"
<< "longstring"
<< "badxml"
+ << "printdatatags"
+ << "printdatatagswithglobaltags"
;
foreach (Logger const& logger, allLoggers()) {
@@ -273,6 +275,12 @@ void tst_Selftests::runSubTest_data()
else if (subtest == "badxml") {
arguments << "-eventcounter";
}
+ else if (subtest == "printdatatags") {
+ arguments << "-datatags";
+ }
+ else if (subtest == "printdatatagswithglobaltags") {
+ arguments << "-datatags";
+ }
// These tests don't work right with loggers other than plain, usually because
// they internally supply arguments to themselves.
@@ -289,6 +297,12 @@ void tst_Selftests::runSubTest_data()
if (subtest == "waitwithoutgui") {
continue;
}
+ if (subtest == "printdatatags") {
+ continue;
+ }
+ if (subtest == "printdatatagswithglobaltags") {
+ continue;
+ }
// `crashes' will not output valid XML on platforms without a crash handler
if (subtest == "crashes") {
continue;
diff --git a/tests/auto/symbols/tst_symbols.cpp b/tests/auto/symbols/tst_symbols.cpp
index 00486d2..cf62f7b 100644
--- a/tests/auto/symbols/tst_symbols.cpp
+++ b/tests/auto/symbols/tst_symbols.cpp
@@ -55,6 +55,8 @@ class tst_Symbols: public QObject
{
Q_OBJECT
private slots:
+ void initTestCase();
+
void prefix();
void globalObjects();
};
@@ -89,6 +91,12 @@ static QString symbolToLine(const QString &symbol, const QString &lib)
return result;
}
+void tst_Symbols::initTestCase()
+{
+ QString qtDir = QString::fromLocal8Bit(qgetenv("QTDIR"));
+ QVERIFY2(!qtDir.isEmpty(), "This test needs $QTDIR");
+}
+
/* This test searches through all Qt libraries and searches for symbols
starting with "global constructors keyed to "
diff --git a/tests/benchmarks/corelib/io/qdir/tree/tree.pro b/tests/benchmarks/corelib/io/qdir/tree/tree.pro
index 773f0f7..24a667e 100644
--- a/tests/benchmarks/corelib/io/qdir/tree/tree.pro
+++ b/tests/benchmarks/corelib/io/qdir/tree/tree.pro
@@ -9,3 +9,8 @@ SOURCES += bench_qdir_tree.cpp
RESOURCES += bench_qdir_tree.qrc
QT -= gui
+
+symbian: {
+ TARGET.CAPABILITY = NetworkServices
+ INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE
+}
diff --git a/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro b/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro
index e8014d6..6e823ff 100644
--- a/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro
+++ b/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro
@@ -4,3 +4,8 @@ TARGET = tst_bench_qthreadstorage
SOURCES += tst_qthreadstorage.cpp
QT -= gui
+
+symbian: {
+ TARGET.CAPABILITY = NetworkServices
+ INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE
+}
diff --git a/tests/benchmarks/gui/gui.pro b/tests/benchmarks/gui/gui.pro
index d825458..06828f4 100644
--- a/tests/benchmarks/gui/gui.pro
+++ b/tests/benchmarks/gui/gui.pro
@@ -12,7 +12,6 @@ SUBDIRS = \
TRUSTED_BENCHMARKS += \
graphicsview/functional/GraphicsViewBenchmark \
- graphicsview/qgraphicsview \
- painting/qtracebench
+ graphicsview/qgraphicsview
-include(../trusted-benchmarks.pri) \ No newline at end of file
+include(../trusted-benchmarks.pri)
diff --git a/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro
index e621d50..b242d60 100755
--- a/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro
+++ b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro
@@ -11,3 +11,8 @@ CONFIG += release
# Input
SOURCES += main.cpp
+
+symbian: {
+ TARGET.CAPABILITY = NetworkServices
+ INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE
+}
diff --git a/tests/benchmarks/network/network.pro b/tests/benchmarks/network/network.pro
index 692a0a1..52817f9 100644
--- a/tests/benchmarks/network/network.pro
+++ b/tests/benchmarks/network/network.pro
@@ -6,8 +6,7 @@ SUBDIRS = \
socket
TRUSTED_BENCHMARKS += \
- kernel/qhostinfo \
socket/qtcpserver \
ssl/qsslsocket
-include(../trusted-benchmarks.pri) \ No newline at end of file
+include(../trusted-benchmarks.pri)
diff --git a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro
index 4bdfcb7..30b10d2 100644
--- a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro
+++ b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro
@@ -12,4 +12,7 @@ CONFIG += release
# Input
SOURCES += tst_qtcpserver.cpp
-symbian:TARGET.CAPABILITY += NetworkServices \ No newline at end of file
+symbian: {
+ TARGET.CAPABILITY = NetworkServices
+ INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE
+}
diff --git a/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro b/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro
index da34a02..85ca1e3 100644
--- a/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro
+++ b/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro
@@ -11,3 +11,8 @@ CONFIG += release
# Input
SOURCES += tst_qsslsocket.cpp
+
+symbian: {
+ TARGET.CAPABILITY = NetworkServices
+ INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE
+}
diff --git a/tests/benchmarks/script/script.pro b/tests/benchmarks/script/script.pro
index 5da05e7..3216b24 100644
--- a/tests/benchmarks/script/script.pro
+++ b/tests/benchmarks/script/script.pro
@@ -13,7 +13,6 @@ SUBDIRS = \
TRUSTED_BENCHMARKS += \
qscriptclass \
qscriptvalue \
- qscriptengine \
qscriptqobject
include(../trusted-benchmarks.pri)