本文整理汇总了C++中LineEdit::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ LineEdit::connect方法的具体用法?C++ LineEdit::connect怎么用?C++ LineEdit::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LineEdit
的用法示例。
在下文中一共展示了LineEdit::connect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memnew
NewProjectDialog() {
VBoxContainer *vb = memnew( VBoxContainer );
add_child(vb);
set_child_rect(vb);
Label* l = memnew(Label);
l->set_text("Project Path:");
vb->add_child(l);
pp=l;
project_path = memnew( LineEdit );
MarginContainer *mc = memnew( MarginContainer );
vb->add_child(mc);
HBoxContainer *pphb = memnew( HBoxContainer );
mc->add_child(pphb);
pphb->add_child(project_path);
project_path->set_h_size_flags(SIZE_EXPAND_FILL);
Button* browse = memnew( Button );
pphb->add_child(browse);
browse->set_text("Browse");
browse->connect("pressed", this,"_browse_path");
l = memnew(Label);
l->set_text("Project Name:");
l->set_pos(Point2(5,50));
vb->add_child(l);
pn=l;
project_name = memnew( LineEdit );
mc = memnew( MarginContainer );
vb->add_child(mc);
mc->add_child(project_name);
project_name->set_text("New Game Project");
l = memnew(Label);
l->set_text("That's a BINGO!");
vb->add_child(l);
error=l;
l->add_color_override("font_color",Color(1,0.4,0.3,0.8));
l->set_align(Label::ALIGN_CENTER);
get_ok()->set_text("Create");
DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
project_path->set_text(d->get_current_dir());
memdelete(d);
fdialog = memnew( FileDialog );
add_child(fdialog);
fdialog->set_access(FileDialog::ACCESS_FILESYSTEM);
project_name->connect("text_changed", this,"_text_changed");
project_path->connect("text_changed", this,"_path_text_changed");
fdialog->connect("dir_selected", this,"_path_selected");
fdialog->connect("file_selected", this,"_file_selected");
set_hide_on_ok(false);
import_mode=false;
}
示例2: _update_graph
void AnimationNodeBlendTreeEditor::_update_graph() {
if (updating)
return;
graph->set_scroll_ofs(blend_tree->get_graph_offset() * EDSCALE);
if (blend_tree->get_parent().is_valid()) {
goto_parent->show();
} else {
goto_parent->hide();
}
graph->clear_connections();
//erase all nodes
for (int i = 0; i < graph->get_child_count(); i++) {
if (Object::cast_to<GraphNode>(graph->get_child(i))) {
memdelete(graph->get_child(i));
i--;
}
}
animations.clear();
List<StringName> nodes;
blend_tree->get_node_list(&nodes);
for (List<StringName>::Element *E = nodes.front(); E; E = E->next()) {
GraphNode *node = memnew(GraphNode);
graph->add_child(node);
Ref<AnimationNode> agnode = blend_tree->get_node(E->get());
if (!agnode->is_connected("changed", this, "_node_changed")) {
agnode->connect("changed", this, "_node_changed", varray(agnode->get_instance_id()), CONNECT_DEFERRED);
}
node->set_offset(agnode->get_position() * EDSCALE);
node->set_title(agnode->get_caption());
node->set_name(E->get());
int base = 0;
if (String(E->get()) != "output") {
LineEdit *name = memnew(LineEdit);
name->set_text(E->get());
name->set_expand_to_text_length(true);
node->add_child(name);
node->set_slot(0, false, 0, Color(), true, 0, get_color("font_color", "Label"));
name->connect("text_entered", this, "_node_renamed", varray(agnode));
name->connect("focus_exited", this, "_node_renamed_focus_out", varray(name, agnode));
base = 1;
node->set_show_close_button(true);
node->connect("close_request", this, "_delete_request", varray(E->get()), CONNECT_DEFERRED);
}
for (int i = 0; i < agnode->get_input_count(); i++) {
Label *in_name = memnew(Label);
node->add_child(in_name);
in_name->set_text(agnode->get_input_name(i));
node->set_slot(base + i, true, 0, get_color("font_color", "Label"), false, 0, Color());
}
node->connect("dragged", this, "_node_dragged", varray(agnode));
if (EditorNode::get_singleton()->item_has_editor(agnode.ptr())) {
node->add_child(memnew(HSeparator));
Button *open_in_editor = memnew(Button);
open_in_editor->set_text(TTR("Open Editor"));
open_in_editor->set_icon(get_icon("Edit", "EditorIcons"));
node->add_child(open_in_editor);
open_in_editor->connect("pressed", this, "_open_in_editor", varray(E->get()), CONNECT_DEFERRED);
open_in_editor->set_h_size_flags(SIZE_SHRINK_CENTER);
}
if (agnode->has_filter()) {
node->add_child(memnew(HSeparator));
Button *edit_filters = memnew(Button);
edit_filters->set_text(TTR("Edit Filters"));
edit_filters->set_icon(get_icon("AnimationFilter", "EditorIcons"));
node->add_child(edit_filters);
edit_filters->connect("pressed", this, "_edit_filters", varray(E->get()), CONNECT_DEFERRED);
edit_filters->set_h_size_flags(SIZE_SHRINK_CENTER);
}
Ref<AnimationNodeAnimation> anim = agnode;
if (anim.is_valid()) {
MenuButton *mb = memnew(MenuButton);
mb->set_text(anim->get_animation());
mb->set_icon(get_icon("Animation", "EditorIcons"));
Array options;
node->add_child(memnew(HSeparator));
node->add_child(mb);
ProgressBar *pb = memnew(ProgressBar);
//.........这里部分代码省略.........
示例3: memnew
EditorFontImportDialog(EditorFontImportPlugin *p_plugin) {
plugin=p_plugin;
VBoxContainer *vbc = memnew( VBoxContainer );
add_child(vbc);
set_child_rect(vbc);
HBoxContainer *hbc = memnew( HBoxContainer);
vbc->add_child(hbc);
VBoxContainer *vbl = memnew( VBoxContainer );
hbc->add_child(vbl);
hbc->set_v_size_flags(SIZE_EXPAND_FILL);
vbl->set_h_size_flags(SIZE_EXPAND_FILL);
VBoxContainer *vbr = memnew( VBoxContainer );
hbc->add_child(vbr);
vbr->set_h_size_flags(SIZE_EXPAND_FILL);
source = memnew( LineEditFileChooser );
source->get_file_dialog()->set_access(FileDialog::ACCESS_FILESYSTEM);
source->get_file_dialog()->set_mode(FileDialog::MODE_OPEN_FILE);
source->get_file_dialog()->add_filter("*.ttf;TrueType");
source->get_file_dialog()->add_filter("*.otf;OpenType");
source->get_line_edit()->connect("text_entered",this,"_src_changed");
vbl->add_margin_child("Source Font:",source);
font_size = memnew( SpinBox );
vbl->add_margin_child("Source Font Size:",font_size);
font_size->set_min(3);
font_size->set_max(256);
font_size->set_val(16);
font_size->connect("value_changed",this,"_font_size_changed");
dest = memnew( LineEditFileChooser );
//
List<String> fl;
Ref<Font> font= memnew(Font);
dest->get_file_dialog()->add_filter("*.fnt ; Font" );
//ResourceSaver::get_recognized_extensions(font,&fl);
//for(List<String>::Element *E=fl.front();E;E=E->next()) {
// dest->get_file_dialog()->add_filter("*."+E->get());
//}
vbl->add_margin_child("Dest Resource:",dest);
HBoxContainer *testhb = memnew( HBoxContainer );
test_string = memnew( LineEdit );
test_string->set_text("The quick brown fox jumps over the lazy dog.");
test_string->set_h_size_flags(SIZE_EXPAND_FILL);
test_string->set_stretch_ratio(5);
testhb->add_child(test_string);
test_color = memnew( ColorPickerButton );
test_color->set_color(get_color("font_color","Label"));
test_color->set_h_size_flags(SIZE_EXPAND_FILL);
test_color->set_stretch_ratio(1);
test_color->connect("color_changed",this,"_update_text3");
testhb->add_child(test_color);
vbl->add_spacer();
vbl->add_margin_child("Test: ",testhb);
HBoxContainer *upd_hb = memnew( HBoxContainer );
// vbl->add_child(upd_hb);
upd_hb->add_spacer();
Button *update = memnew( Button);
upd_hb->add_child(update);
update->set_text("Update");
update->connect("pressed",this,"_update");
options = memnew( _EditorFontImportOptions );
prop_edit = memnew( PropertyEditor() );
vbr->add_margin_child("Options:",prop_edit,true);
options->connect("changed",this,"_prop_changed");
prop_edit->hide_top_label();
Panel *panel = memnew( Panel );
vbc->add_child(panel);
test_label = memnew( Label );
test_label->set_autowrap(true);
panel->add_child(test_label);
test_label->set_area_as_parent_rect();
panel->set_v_size_flags(SIZE_EXPAND_FILL);
test_string->connect("text_changed",this,"_update_text2");
set_title("Font Import");
timer = memnew( Timer );
add_child(timer);
timer->connect("timeout",this,"_update");
timer->set_wait_time(0.4);
timer->set_one_shot(true);
get_ok()->connect("pressed", this,"_import");
get_ok()->set_text("Import");
error_dialog = memnew ( ConfirmationDialog );
add_child(error_dialog);
error_dialog->get_ok()->set_text("Accept");
set_hide_on_ok(false);
}