debugger: derive breakpoint model from QAbstract*, not QTable*

Preparation for proper mulptiple breakpoint display
This commit is contained in:
hjk
2011-05-11 16:24:04 +02:00
parent 6bcb4dbd5e
commit f5601d7b1b
2 changed files with 19 additions and 5 deletions

View File

@@ -453,7 +453,7 @@ Qt::ItemFlags BreakHandler::flags(const QModelIndex &index) const
// //case 0: // //case 0:
// // return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled; // // return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled;
// default: // default:
return QAbstractTableModel::flags(index); return QAbstractItemModel::flags(index);
// } // }
} }
@@ -469,6 +469,18 @@ int BreakHandler::threadSpecFromDisplay(const QString &str)
return ok ? result : -1; return ok ? result : -1;
} }
QModelIndex BreakHandler::index(int row, int col, const QModelIndex &parent) const
{
Q_UNUSED(parent);
return createIndex(row, col, 0);
}
QModelIndex BreakHandler::parent(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return QModelIndex();
}
QVariant BreakHandler::data(const QModelIndex &mi, int role) const QVariant BreakHandler::data(const QModelIndex &mi, int role) const
{ {
static const QString empty = QString(QLatin1Char('-')); static const QString empty = QString(QLatin1Char('-'));
@@ -742,9 +754,9 @@ DebuggerEngine *BreakHandler::engine(BreakpointId id) const
void BreakHandler::setEngine(BreakpointId id, DebuggerEngine *value) void BreakHandler::setEngine(BreakpointId id, DebuggerEngine *value)
{ {
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
BREAK_ASSERT(it != m_storage.end(), qDebug() << id; return); BREAK_ASSERT(it != m_storage.end(), qDebug() << "SET ENGINE" << id; return);
QTC_ASSERT(it->state == BreakpointNew, qDebug() << id); QTC_ASSERT(it->state == BreakpointNew, qDebug() << "STATE: " << it->state <<id);
QTC_ASSERT(!it->engine, qDebug() << id; return); QTC_ASSERT(!it->engine, qDebug() << "NO ENGINE" << id; return);
it->engine = value; it->engine = value;
it->state = BreakpointInsertRequested; it->state = BreakpointInsertRequested;
it->response = BreakpointResponse(); it->response = BreakpointResponse();

View File

@@ -54,7 +54,7 @@ namespace Internal {
class BreakpointMarker; class BreakpointMarker;
class BreakHandler : public QAbstractTableModel class BreakHandler : public QAbstractItemModel
{ {
Q_OBJECT Q_OBJECT
@@ -167,6 +167,8 @@ private:
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const; Qt::ItemFlags flags(const QModelIndex &index) const;
QModelIndex index(int row, int col, const QModelIndex &parent) const;
QModelIndex parent(const QModelIndex &parent) const;
bool isEngineRunning(BreakpointId id) const; bool isEngineRunning(BreakpointId id) const;
void setState(BreakpointId id, BreakpointState state); void setState(BreakpointId id, BreakpointState state);