diff options
author | Eike Ziller <eike.ziller@digia.com> | 2012-09-26 10:01:04 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2012-09-26 10:01:04 +0200 |
commit | a55d47544a104bbe8270bd6b5a72a1215018059c (patch) | |
tree | a922470562cd187d1b986a8db0df776e37cdc248 /src/plugins/debugger/registerhandler.cpp | |
parent | 996122b7e9c05c5baca56809d8cd2cf1b58a9f39 (diff) | |
parent | 471f44aae3ca09d445ae4f424b2242b371580a3e (diff) | |
download | qt-creator-a55d47544a104bbe8270bd6b5a72a1215018059c.tar.gz |
Merge remote-tracking branch 'origin/2.6'
Conflicts:
qtcreator.qbp
src/plugins/qtsupport/baseqtversion.cpp
src/tools/tools.pro
Change-Id: I43c391328ae747b3dc566f9db2384fedc1a6d0a5
Diffstat (limited to 'src/plugins/debugger/registerhandler.cpp')
-rw-r--r-- | src/plugins/debugger/registerhandler.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/plugins/debugger/registerhandler.cpp b/src/plugins/debugger/registerhandler.cpp index 57d0a1f9b7..8ab9fca46b 100644 --- a/src/plugins/debugger/registerhandler.cpp +++ b/src/plugins/debugger/registerhandler.cpp @@ -294,6 +294,12 @@ static int bitWidthFromType(int type, int subType) return 0; } +static const int TopLevelId = -1; +static bool isTopLevelItem(const QModelIndex &index) +{ + return quintptr(index.internalId()) == quintptr(TopLevelId); +} + Register::Register(const QByteArray &name_) : name(name_), changed(true) { @@ -322,7 +328,7 @@ int RegisterHandler::rowCount(const QModelIndex &idx) const return 0; if (!idx.isValid()) return m_registers.size(); // Top level. - if (idx.internalId() >= 0) + if (!isTopLevelItem(idx)) return 0; // Sub-Items don't have children. if (idx.row() >= m_registers.size()) return 0; @@ -335,7 +341,7 @@ int RegisterHandler::columnCount(const QModelIndex &idx) const return 0; if (!idx.isValid()) return 2; - if (idx.internalId() >= 0) + if (!isTopLevelItem(idx)) return 0; // Sub-Items don't have children. return 2; } @@ -345,8 +351,8 @@ QModelIndex RegisterHandler::index(int row, int col, const QModelIndex &parent) if (row < 0 || col < 0 || col >= 2) return QModelIndex(); if (!parent.isValid()) // Top level. - return createIndex(row, col, -1); - if (parent.internalId() >= 0) // Sub-Item has no children. + return createIndex(row, col, TopLevelId); + if (!isTopLevelItem(parent)) // Sub-Item has no children. return QModelIndex(); if (parent.column() > 0) return QModelIndex(); @@ -357,8 +363,8 @@ QModelIndex RegisterHandler::parent(const QModelIndex &idx) const { if (!idx.isValid()) return QModelIndex(); - if (idx.internalId() >= 0) - return createIndex(idx.internalId(), 0, -1); + if (!isTopLevelItem(idx)) + return createIndex(idx.internalId(), 0, TopLevelId); return QModelIndex(); } |