moved to shstk
This commit is contained in:
76
utils/piintrospector/containers_view.h
Normal file
76
utils/piintrospector/containers_view.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#ifndef CONTAINERS_VIEW_H
|
||||
#define CONTAINERS_VIEW_H
|
||||
|
||||
#include "ui_containers_view.h"
|
||||
#include <QDebug>
|
||||
#include <QWidget>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QStyledItemDelegate>
|
||||
#include "piqt.h"
|
||||
#include "piintrospection_containers_p.h"
|
||||
|
||||
class ContainersModel: public QAbstractItemModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ContainersModel();
|
||||
|
||||
void update(const PIVector<PIIntrospectionContainers::TypeInfo> & t);
|
||||
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;
|
||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
||||
|
||||
protected:
|
||||
PIVector<PIIntrospectionContainers::TypeInfo> cur_data;
|
||||
PIMap<uint, PIIntrospectionContainers::TypeInfo> prev_data;
|
||||
PIVector<llong> all, prev_all;
|
||||
Qt::SortOrder ls_order;
|
||||
int ls_column;
|
||||
bool mode_changes;
|
||||
|
||||
public slots:
|
||||
void setChangesMode(bool yes);
|
||||
|
||||
};
|
||||
|
||||
|
||||
class ContainersDelegate: public QStyledItemDelegate {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ContainersDelegate(QAbstractItemModel * m) {model = m;}
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem & option, const QModelIndex &index) const;
|
||||
QAbstractItemModel * model;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ContainersView: public QWidget, private Ui::ContainersView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ContainersView(QWidget * parent = 0);
|
||||
~ContainersView();
|
||||
void showContainers(const PIVector<PIIntrospectionContainers::TypeInfo> & t);
|
||||
void clear();
|
||||
protected:
|
||||
void changeEvent(QEvent * e);
|
||||
|
||||
ContainersModel * model;
|
||||
|
||||
private slots:
|
||||
void sessionSave(QByteArray * data) {*data = treeContainers->header()->saveState();}
|
||||
void sessionLoad(QByteArray * data) {treeContainers->header()->restoreState(*data);}
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // CONTAINERS_VIEW_H
|
||||
Reference in New Issue
Block a user