Commit 40050b80 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Pass in a vector of attributes to show in ProcessAttributesModel

Rather than using the processes instance which may not have all the
attributes now that the CGroup model is here.
parent 518e85e4
......@@ -323,7 +323,7 @@ ProcessAttributeModel *CGroupDataModel::attributesModel()
{
//lazy load
if (!d->m_attributeModel) {
d->m_attributeModel = new KSysGuard::ProcessAttributeModel(d->m_processes, this);
d->m_attributeModel = new KSysGuard::ProcessAttributeModel(d->m_availableAttributes.values().toVector(), this);
}
return d->m_attributeModel;
}
......
......@@ -31,11 +31,11 @@ public:
QVector<ProcessAttribute *> m_attributes;
};
ProcessAttributeModel::ProcessAttributeModel(ExtendedProcesses *processes, QObject *parent)
ProcessAttributeModel::ProcessAttributeModel(const QVector<ProcessAttribute *> & attributes, QObject *parent)
: QAbstractListModel(parent)
, d(new Private)
{
d->m_attributes = processes->attributes();
d->m_attributes = attributes;
}
ProcessAttributeModel::~ProcessAttributeModel()
......
......@@ -26,6 +26,7 @@ namespace KSysGuard
{
class ExtendedProcesses;
class ProcessAttribute;
/**
* Presents a list of available attributes that can be
......@@ -44,7 +45,7 @@ public:
};
Q_ENUM(Role);
ProcessAttributeModel(ExtendedProcesses *processes, QObject *parent = nullptr);
ProcessAttributeModel(const QVector<ProcessAttribute *> &attributes, QObject *parent = nullptr);
~ProcessAttributeModel() override;
int rowCount(const QModelIndex &parent) const override;
......
......@@ -284,7 +284,7 @@ ProcessAttributeModel *ProcessDataModel::attributesModel()
{
// lazy load
if (!d->m_attributeModel) {
d->m_attributeModel = new KSysGuard::ProcessAttributeModel(d->m_processes, this);
d->m_attributeModel = new KSysGuard::ProcessAttributeModel(d->m_availableAttributes.values().toVector(), this);
}
return d->m_attributeModel;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment