git-svn-id: svn://db.shs.com.ru/libs@562 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -29,7 +29,7 @@ ContainersModel::ContainersModel() {
|
||||
prev_all.resize(all.size(), 0L);
|
||||
}
|
||||
|
||||
|
||||
#ifdef PIP_INTROSPECTION
|
||||
void ContainersModel::update(const PIMap<uint, PIIntrospectionContainers::Type> & td, const PIMap<uint, PIString> & tn) {
|
||||
prev_typedata = typedata;
|
||||
typedata = td;
|
||||
@@ -52,9 +52,11 @@ void ContainersModel::update(const PIMap<uint, PIIntrospectionContainers::Type>
|
||||
dataChanged(index(1, 0), index(columnCount(), typeids.size_s() - 1));
|
||||
emit headerDataChanged(Qt::Horizontal, 1, columnCount());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void ContainersModel::clear() {
|
||||
#ifdef PIP_INTROSPECTION
|
||||
beginRemoveRows(QModelIndex(), 0, typeids.size_s() - 1);
|
||||
typedata.clear();
|
||||
prev_typedata.clear();
|
||||
@@ -62,9 +64,9 @@ void ContainersModel::clear() {
|
||||
typeids.clear();
|
||||
all.fill(0L);
|
||||
endRemoveRows();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int ContainersModel::rowCount(const QModelIndex & parent) const {
|
||||
return typeids.size_s();
|
||||
}
|
||||
@@ -76,7 +78,9 @@ int ContainersModel::columnCount(const QModelIndex & parent) const {
|
||||
|
||||
|
||||
QModelIndex ContainersModel::index(int row, int column, const QModelIndex & parent) const {
|
||||
#ifdef PIP_INTROSPECTION
|
||||
if (row >= typenames.size_s() || row >= typedata.size_s()) return QModelIndex();
|
||||
#endif
|
||||
return createIndex(row, column, typeids[row]);
|
||||
}
|
||||
|
||||
@@ -107,6 +111,7 @@ QVariant ContainersModel::headerData(int section, Qt::Orientation orientation, i
|
||||
|
||||
QVariant ContainersModel::data(const QModelIndex & index, int role) const {
|
||||
if (role != Qt::DisplayRole && role != Qt::UserRole) return QVariant();
|
||||
#ifdef PIP_INTROSPECTION
|
||||
uint id = uint(index.internalId());
|
||||
llong v = 0L;
|
||||
if (mode_changes) {
|
||||
@@ -138,6 +143,7 @@ QVariant ContainersModel::data(const QModelIndex & index, int role) const {
|
||||
return PI2QString(PIString::readableSize(v));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@@ -183,13 +189,13 @@ void ContainersView::changeEvent(QEvent * e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef PIP_INTROSPECTION
|
||||
void ContainersView::showContainers(const PIMap<uint, PIIntrospectionContainers::Type> & data, const PIMap<uint, PIString> & typenames) {
|
||||
model->update(data, typenames);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void ContainersView::clear() {
|
||||
model->clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user