tree changes
This commit is contained in:
81
piqt/utils/piintrospector/threads_view.h
Normal file
81
piqt/utils/piintrospector/threads_view.h
Normal file
@@ -0,0 +1,81 @@
|
||||
#ifndef THREADS_VIEW_H
|
||||
#define THREADS_VIEW_H
|
||||
|
||||
#include "ui_threads_view.h"
|
||||
#include <QDebug>
|
||||
#include <QWidget>
|
||||
#include <QHash>
|
||||
#include <QTreeView>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QStyledItemDelegate>
|
||||
#include "piqt.h"
|
||||
#include "pisystemmonitor.h"
|
||||
#include "piintrospection_threads_p.h"
|
||||
|
||||
|
||||
class ThreadsModel: public QAbstractItemModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ThreadsModel();
|
||||
|
||||
void update(const PIVector<PIIntrospectionThreads::ThreadInfo> & t);
|
||||
void setStat(const PIVector<PISystemMonitor::ThreadStats> & s);
|
||||
void clear();
|
||||
|
||||
int rowCount(const QModelIndex & parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex & parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex & child) const {return QModelIndex();}
|
||||
QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
|
||||
bool hasChildren(const QModelIndex & parent = QModelIndex()) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
QVariant data(const QModelIndex & index, int role) const;
|
||||
Qt::ItemFlags flags(const QModelIndex & index) const;
|
||||
|
||||
protected:
|
||||
PIVector<PIIntrospectionThreads::ThreadInfo> threads;
|
||||
PIVector<PISystemMonitor::ThreadStats> stat;
|
||||
QHash<int, QString> state_names;
|
||||
QHash<int, QColor> state_colors;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
class ContainersDelegate: public QStyledItemDelegate {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ContainersDelegate(QAbstractItemModel * m) {model = m;}
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem & option, const QModelIndex &index) const override;
|
||||
QAbstractItemModel * model;
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
class ThreadsView: public QWidget, private Ui::ThreadsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ThreadsView(QWidget * parent = 0);
|
||||
~ThreadsView();
|
||||
|
||||
void setStat(const PIVector<PISystemMonitor::ThreadStats> & stat);
|
||||
void showThreads(const PIVector<PIIntrospectionThreads::ThreadInfo> & threads);
|
||||
void clear();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent * e);
|
||||
|
||||
ThreadsModel * model;
|
||||
|
||||
private slots:
|
||||
void sessionSave(QByteArray * data) {*data = treeThreads->header()->saveState();}
|
||||
void sessionLoad(QByteArray * data) {treeThreads->header()->restoreState(*data);}
|
||||
void updateHidden();
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // CONTAINERS_VIEW_H
|
||||
Reference in New Issue
Block a user