-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock.h
More file actions
30 lines (24 loc) · 745 Bytes
/
block.h
File metadata and controls
30 lines (24 loc) · 745 Bytes
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
#ifndef BLOCK_H
#define BLOCK_H
#include <QtGui>
#include "blockinstance.h"
typedef model_linkable_t *(*create_f)(model_t *model, model_script_t *script, const QString &name, const void *userdata);
class Block : public QTreeWidgetItem
{
public:
Block(QTreeWidgetItem *parent, const QIcon &icon, const QString &name, create_f cb, const void *userdata) :
QTreeWidgetItem(parent), name(name), callback(cb), userdata(userdata)
{
setText(0, name);
setIcon(0, icon);
}
model_linkable_t *create(model_t *model, model_script_t *script)
{
return this->callback(model, script, name, userdata);
}
private:
QString name;
create_f callback;
const void *userdata;
};
#endif // BLOCK_H