-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathqtNodeEdit.h
77 lines (63 loc) · 2.23 KB
/
qtNodeEdit.h
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef QTNODEEDIT_H
#define QTNODEEDIT_H
#include <QWidget>
#include <QTableWidgetItem>
#include <QStyledItemDelegate>
#include "qtVault.h"
namespace Ui {
class qtNodeEdit;
}
class plSDLMgr;
class plResManager;
class plStateDataRecord;
class NodeTypeDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
NodeTypeDelegate(QObject* parent = 0);
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const Q_DECL_OVERRIDE;
void setEditorData(QWidget* editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex &index) const Q_DECL_OVERRIDE;
void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const Q_DECL_OVERRIDE;
};
class FolderTypeDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
FolderTypeDelegate(QObject* parent = 0);
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const Q_DECL_OVERRIDE;
void setEditorData(QWidget* editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex &index) const Q_DECL_OVERRIDE;
void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const Q_DECL_OVERRIDE;
};
class qtNodeEdit : public QWidget {
Q_OBJECT
public:
qtNodeEdit(QWidget *parent = 0);
~qtNodeEdit();
void setNode(qtVaultNode* pn);
void setMgrs(plSDLMgr* sdl, plResManager* res);
qtVaultNode* getNode();
void update(bool sdlEdit = false);
signals:
void isDirty(bool);
protected:
void changeEvent(QEvent *e);
private:
Ui::qtNodeEdit *ui;
qtVaultNode* node;
plSDLMgr* sdlmgr;
plResManager* resmgr;
bool titleEdited;
bool textEdited;
QString newTitle;
NodeTypeDelegate* typeBox;
FolderTypeDelegate* folderBox;
private slots:
void dataRowChanged(QTableWidgetItem* item);
void editNodeTitle(QString title);
void editNodeText();
void loadNodeImage();
void saveNodeImage();
void editSDL(plStateDataRecord* sdl);
void tabActivated(int tab);
};
#endif // QTNODEEDIT_H