MCPcopy Create free account
hub / github.com/BehaviorTree/Groot / BehaviorTreeDataModel

Method BehaviorTreeDataModel

bt_editor/models/BehaviorTreeNodeModel.cpp:18–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16const int DEFAULT_LABEL_WIDTH = 50;
17
18BehaviorTreeDataModel::BehaviorTreeDataModel(const NodeModel &model):
19 _params_widget(nullptr),
20 _uid( GetUID() ),
21 _model(model),
22 _icon_renderer(nullptr),
23 _style_caption_color( QtNodes::NodeStyle().FontColor ),
24 _style_caption_alias( model.registration_ID )
25{
26 readStyle();
27 _main_widget = new QFrame();
28 _line_edit_name = new QLineEdit(_main_widget);
29 _params_widget = new QFrame();
30
31 _main_layout = new QVBoxLayout(_main_widget);
32 _main_widget->setLayout( _main_layout );
33
34 auto capt_layout = new QHBoxLayout();
35
36 _caption_label = new QLabel();
37 _caption_logo_left = new QFrame();
38 _caption_logo_right = new QFrame();
39 _caption_logo_left->setFixedSize( QSize(0,20) );
40 _caption_logo_right->setFixedSize( QSize(0,20) );
41 _caption_label->setFixedHeight(20);
42
43 _caption_logo_left->installEventFilter(this);
44
45 QFont capt_font = _caption_label->font();
46 capt_font.setPointSize(12);
47 _caption_label->setFont(capt_font);
48
49 capt_layout->addWidget(_caption_logo_left, 0, Qt::AlignRight);
50 capt_layout->addWidget(_caption_label, 0, Qt::AlignHCenter );
51 capt_layout->addWidget(_caption_logo_right, 0, Qt::AlignLeft);
52
53 _main_layout->addLayout( capt_layout );
54 _main_layout->addWidget( _line_edit_name );
55
56 _main_layout->setMargin(0);
57 _main_layout->setSpacing(2);
58
59 //----------------------------
60 _line_edit_name->setAlignment( Qt::AlignCenter );
61 _line_edit_name->setText( _instance_name );
62 _line_edit_name->setFixedWidth( DEFAULT_LINE_WIDTH );
63
64 _main_widget->setAttribute(Qt::WA_NoSystemBackground);
65
66 _line_edit_name->setStyleSheet("color: white; "
67 "background-color: transparent;"
68 "border: 0px;");
69
70 //--------------------------------------
71 _form_layout = new QFormLayout( _params_widget );
72 _form_layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
73
74 _main_layout->addWidget(_params_widget);
75 _params_widget->setStyleSheet("color: white;");

Callers

nothing calls this directly

Calls 3

GetUIDFunction · 0.85
NodeStyleClass · 0.85
setLayoutMethod · 0.80

Tested by

no test coverage detected