QtTest: add toString(QModelIndex)
Add toString(QModelIndex) to make debugging itemmodels/views autotests easier. [ChangeLog][QtTest] Added QTest::toString(const QModelIndex &idx) Change-Id: I20ad6b1fb145c00a3239131a3274fdbefc3b3ffd Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
94daa69699
commit
7ef0b575b3
@ -51,6 +51,7 @@
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtCore/qcborcommon.h>
|
||||
#include <QtCore/qdatetime.h>
|
||||
#include <QtCore/qabstractitemmodel.h>
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
#include <QtCore/qurl.h>
|
||||
@ -128,6 +129,13 @@ template<> inline char *toString(const QChar &c)
|
||||
return qstrdup(qPrintable(QString::fromLatin1("QChar: '%1' (0x%2)").arg(c).arg(QString::number(static_cast<int>(c.unicode()), 16))));
|
||||
}
|
||||
|
||||
template<> inline char *toString(const QModelIndex &idx)
|
||||
{
|
||||
char msg[128];
|
||||
qsnprintf(msg, sizeof(msg), "QModelIndex(%d,%d,%p,%p)", idx.row(), idx.column(), idx.internalPointer(), idx.model());
|
||||
return qstrdup(msg);
|
||||
}
|
||||
|
||||
template<> inline char *toString(const QPoint &p)
|
||||
{
|
||||
char msg[128] = {'\0'};
|
||||
|
Loading…
Reference in New Issue
Block a user