-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomTreeWidget.h
More file actions
46 lines (37 loc) · 1.11 KB
/
Copy pathCustomTreeWidget.h
File metadata and controls
46 lines (37 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef CUSTOMTREEWIDGET_H
#define CUSTOMTREEWIDGET_H
#include <QWidget>
#include <QTreeView>
#include <QStandardItemModel>
#include <QContextMenuEvent>
#include "ProcessFilter.h"
// You need to define the ProcessInfo structure or include its definition
struct ProcessInfo {
QString name;
QString status;
double cpuUsage;
int pid;
int memoryUsage;
};
class CustomTreeWidget : public QWidget {
Q_OBJECT
public:
explicit CustomTreeWidget(QWidget *parent = nullptr);
void refreshData(ProcessFilter filter);
private:
QTreeView *treeView;
QStandardItemModel *model;
void setupModelAndView();
void populateModelWithProcessData();
void populateChildren(QStandardItem *parentItem, int pid);
QList<QStandardItem*> createRowItems(int pid);
protected:
void contextMenuEvent(QContextMenuEvent *event) override;
signals:
void openPropertiesDialog(const QModelIndex &index);
void openMemoryMapsDialog(const QModelIndex &index);
void propertiesSelected(int pid);
void memoryMapSelected(int pid);
void openFilesSelected(int pid);
};
#endif // CUSTOMTREEWIDGET_H