本文整理汇总了C++中BrowserNode::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ BrowserNode::parent方法的具体用法?C++ BrowserNode::parent怎么用?C++ BrowserNode::parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrowserNode
的用法示例。
在下文中一共展示了BrowserNode::parent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepare_for_move
void PackageCanvas::prepare_for_move(bool on_resize) {
if (! on_resize) {
DiagramCanvas::prepare_for_move(on_resize);
Q3CanvasItemList l = collisions(TRUE);
Q3CanvasItemList::ConstIterator it;
Q3CanvasItemList::ConstIterator end = l.end();
DiagramItem * di;
BrowserNode * p = get_bn();
for (it = l.begin(); it != end; ++it) {
if ((*it)->visible() && // at least not deleted
!(*it)->selected() &&
((di = QCanvasItemToDiagramItem(*it)) != 0) &&
di->move_with_its_package()) {
BrowserNode * bn = di->get_bn();
do
bn = (BrowserNode *) bn->parent();
while (bn->get_type() != UmlPackage);
if (bn == p) {
the_canvas()->select(*it);
di->prepare_for_move(FALSE);
}
}
}
}
}
示例2: accept
void BasicDialog::accept() {
if (!check_edits(edits) || !kvtable->check_unique())
return;
BrowserNode * bn = data->get_browser_node();
if (edname != 0) {
QString s = edname->text().stripWhiteSpace();
if ((s != bn->get_name()) &&
((BrowserNode *) bn->parent())->wrong_child_name(s, bn->get_type(),
bn->allow_spaces(),
bn->allow_empty())) {
msg_critical(TR("Error"), edname->text() + TR("\n\nillegal name or already used"));
return;
}
else
bn->set_name(s);
}
bool newst = data->set_stereotype(fromUnicode(edstereotype->currentText().stripWhiteSpace()));
bn->set_comment(comment->text());
UmlWindow::update_comment_if_needed(bn);
kvtable->update(bn);
ProfiledStereotypes::modified(bn, newst);
bn->package_modified();
data->modified();
Q3TabDialog::accept();
}
示例3: while
BrowserNode * BrowserNode::get_container(UmlCode k) const {
BrowserNode * p = (BrowserNode *) this;
while ((p != 0) && (p->get_type() != k))
p = (BrowserNode *) p->parent();
return p;
}
示例4: unconsistent_fixed
void BrowserNode::unconsistent_fixed(const char * what, BrowserNode * newone) {
UnconsistencyFixedMsg += QString("<li>") + what + QString(" <i>") +
quote(full_name()) + QString("</i> and <i>") +
quote(newone->full_name()) + QString("</i></li>\n");
BrowserNode * bn = this;
while (bn->get_type() != UmlPackage)
bn = (BrowserNode *) bn->parent();
if (ModifiedPackages.findRef(bn) == -1)
ModifiedPackages.append(bn);
}
示例5: hide_inherited
void ConstraintTable::hide_inherited(ConstraintCanvas * c)
{
BrowserNode * cl = c->cl->get_bn();
BrowserNodeList & elts = c->elements;
BrowserNode * bn;
int row;
QString yes = TR(" yes");
QString empty;
for (bn = elts.first(), row = 0; bn != 0; bn = elts.next(), row += 1)
setText(row, 0,
((bn == cl) || (bn->parent() == cl)) ? yes : empty);
}
示例6: accept
void ActivityDialog::accept()
{
if (!check_edits(edits) || !kvtable->check_unique())
return;
BrowserNode * bn = activity->browser_node;
QString s;
s = edname->text().trimmed();
if ((s != bn->get_name()) &&
((BrowserNode *) bn->parent())->wrong_child_name(s, UmlActivity,
bn->allow_spaces(),
bn->allow_empty()))
msg_critical(tr("Error"), s + tr("\n\nillegal name or already used"));
else {
bn->set_name(s);
bool newst = activity->set_stereotype(fromUnicode(edstereotype->currentText().trimmed()));
int index = list.indexOf(edspecification->currentText().trimmed());
activity->set_specification((index != -1)
? (BrowserOperation *) opers.at(index)
: 0);
activity->read_only = readonly_cb->isChecked();
activity->single_execution = singlexec_cb->isChecked();
activity->is_active = active_cb->isChecked();
uml.accept(activity->uml_condition);
cpp.accept(activity->cpp_condition);
java.accept(activity->java_condition);
bn->set_comment(comment->text());
UmlWindow::update_comment_if_needed(bn);
activity->constraint = constraint->trimmedText();
kvtable->updateNodeFromThis(bn);
ProfiledStereotypes::modified(bn, newst);
bn->modified();
bn->package_modified();
activity->modified();
TabDialog::accept();
}
}
示例7: search
void BrowserSearchDialog::search() {
nodes.clear();
results->clear();
nodes.search(BrowserView::get_project(), ed->text(),
case_sensitive->isChecked());
nodes.sort();
BrowserNode * bn;
for (bn = nodes.first(); bn != 0; bn = nodes.next()) {
QString up = ((BrowserNode *) bn->parent())->get_path();
results->insertItem((up.isEmpty())
? QString(bn->text(0))
: bn->text(0) + QString(" [") + up + "]");
}
}
示例8: accept
void TransitionDialog::accept()
{
if (!check_edits(edits) || !kvtable->check_unique())
return;
BrowserNode * bn = rel->browser_node;
QString s;
s = edname->text().trimmed();
if (s.isEmpty())
s = "<transition>";
if ((s != bn->get_name()) &&
((BrowserNode *) bn->parent())->wrong_child_name(s, UmlTransition,
bn->allow_spaces(),
bn->allow_empty()))
msg_critical(tr("Error"), s + tr("\n\nillegal name or already used"));
else {
bn->set_name(s);
bool newst = rel->set_stereotype(fromUnicode(edstereotype->currentText().trimmed()));
if (internal_cb != 0)
rel->set_internal(internal_cb->isChecked());
uml.accept(rel->uml);
cpp.accept(rel->cpp);
java.accept(rel->java);
bn->set_comment(comment->text());
UmlWindow::update_comment_if_needed(bn);
kvtable->updateNodeFromThis(bn);
ProfiledStereotypes::modified(bn, newst);
bn->modified();
bn->package_modified();
rel->modified();
TabDialog::accept();
}
}
示例9: accept
void ExpansionRegionDialog::accept()
{
if (!check_edits(edits) || !kvtable->check_unique())
return;
BrowserNode * bn = data->get_browser_node();
if (edname != 0) {
QString s = edname->text().trimmed();
if ((s != bn->get_name()) &&
((BrowserNode *) bn->parent())->wrong_child_name(s, bn->get_type(),
bn->allow_spaces(),
bn->allow_empty())) {
msg_critical(TR("Error"), edname->text() + TR("\n\nillegal name or already used"));
return;
}
else
bn->set_name(s);
}
data->must_isolate = must_isolate_cb->isChecked();
data->mode = expansion_mode_kind(edmode->currentText().toLatin1().constData());
bool newst = data->set_stereotype(fromUnicode(edstereotype->currentText().trimmed()));
bn->set_comment(comment->text());
UmlWindow::update_comment_if_needed(bn);
kvtable->updateNodeFromThis(bn);
ProfiledStereotypes::modified(bn, newst);
bn->package_modified();
data->modified();
TabDialog::accept();
}
示例10: accept
void FlowDialog::accept()
{
if (!check_edits(edits) || !kvtable->check_unique())
return;
BrowserNode * bn = flow->browser_node;
QString s;
s = edname->text().stripWhiteSpace();
if ((s != bn->get_name()) &&
((BrowserNode *) bn->parent())->wrong_child_name(s, UmlFlow,
bn->allow_spaces(),
bn->allow_empty()))
msg_critical(TR("Error"), s + TR("\n\nillegal name or already used"));
else {
bn->set_name(s);
bool newst = flow->set_stereotype(fromUnicode(edstereotype->currentText().stripWhiteSpace()));
uml.accept(flow->uml);
cpp.accept(flow->cpp);
java.accept(flow->java);
bn->set_comment(comment->text());
UmlWindow::update_comment_if_needed(bn);
kvtable->updateNodeFromThis(bn);
ProfiledStereotypes::modified(bn, newst);
bn->modified();
bn->package_modified();
flow->modified();
Q3TabDialog::accept();
}
}
示例11: TabDialog
StateDialog::StateDialog(StateData * d)
: TabDialog(0, 0, FALSE, Qt::WA_DeleteOnClose), state(d)
{
d->browser_node->edit_start();
if (d->browser_node->is_writable()) {
setOkButton(tr("OK"));
setCancelButton(tr("Cancel"));
}
else {
setOkButton(QString());
setCancelButton(tr("Close"));
}
setWindowTitle(tr("State dialog"));
visit = !hasOkButton();
BrowserNode * bn = state->browser_node;
GridBox * grid;
//
// general tab
//
grid = new GridBox(2, this);
umltab = grid;
grid->setMargin(5);
grid->setSpacing(5);
grid->addWidget(new QLabel(tr("name : "), grid));
grid->addWidget(edname = new LineEdit(bn->get_name(), grid));
edname->setReadOnly(visit);
grid->addWidget(new QLabel(tr("stereotype : "), grid));
grid->addWidget(edstereotype = new QComboBox( grid));
edstereotype->setEditable(!visit);
edstereotype->addItem(toUnicode(state->get_stereotype()));
if (!visit) {
edstereotype->addItems(BrowserState::default_stereotypes());
edstereotype->addItems(ProfiledStereotypes::defaults(UmlState));
edstereotype->setAutoCompletion(completion());
}
edstereotype->setCurrentIndex(0);
QSizePolicy sp = edstereotype->sizePolicy();
sp.setHorizontalPolicy(QSizePolicy::Expanding);
edstereotype->setSizePolicy(sp);
SmallPushButton* sButton;
connect(sButton = new SmallPushButton(tr("specification :"), grid), SIGNAL(clicked()),
this, SLOT(menu_specification()));
grid->addWidget(sButton);
grid->addWidget(edspecification = new QComboBox(grid));
edspecification->setSizePolicy(sp);
if (visit) {
if (state->get_specification() == 0)
edspecification->addItem("");
else
edspecification->addItem(state->get_specification()->full_name(TRUE));
}
else {
edspecification->addItem("");
edspecification->setAutoCompletion(completion());
BrowserOperation::instances(opers);
opers.full_names(speclist);
edspecification->addItems(speclist);
edspecification->setCurrentIndex((state->get_specification() == 0)
? 0
: opers.indexOf(state->get_specification()) + 1);
}
switch (((BrowserNode *) bn->parent())->get_type()) {
case UmlState:
case UmlRegion:
if ((state->get_reference() != 0) || (bn->firstChild() == 0)) {
connect(sButton = new SmallPushButton(tr("reference :"), grid), SIGNAL(clicked()),
this, SLOT(menu_reference()));
grid->addWidget(sButton);
grid->addWidget(edreference = new QComboBox(grid));
edreference->setSizePolicy(sp);
if (visit) {
if (state->get_reference() == 0)
edreference->addItem("");
else
edreference->addItem(state->get_reference()->full_name(TRUE));
}
else {
edreference->addItem("");
edreference->setAutoCompletion(completion());
if (((BrowserState *) bn)->can_reference()) {
BrowserState::instances(states, TRUE);
QMutableListIterator<BrowserNode *> it(states);
while (it.hasNext()) {
BrowserState *state = (BrowserState *)it.next();
if (!((BrowserState *) bn)->can_reference(state) ||
//.........这里部分代码省略.........
示例12: accept
void ParameterDialog::accept()
{
if (!check_edits(edits) || !kvtable->check_unique())
return;
BrowserNode * bn = param->browser_node;
QString s;
s = edname->text().trimmed();
if ((s != param->name()) &&
((BrowserNode *) bn->parent())->wrong_child_name(s, UmlParameter,
bn->allow_spaces(),
bn->allow_empty()))
msg_critical(tr("Error"), s + tr("\n\nillegal name or already used"));
else {
// check consistency
UmlParamDirection dir = direction(eddir->currentText());
bool exception = exception_rb->isChecked();
UmlParamEffect effect = ::effect(edeffect->currentText());
QString err;
if ((dir == UmlIn) && exception)
err = tr("An input parameter cannot be an exception.\n");
switch (effect) {
case UmlDelete:
if ((dir != UmlIn) && (dir != UmlInOut))
err += tr("Only in and inout parameter may have a delete effect.");
break;
case UmlCreate:
if ((dir != UmlOut) && (dir != UmlInOut) && (dir != UmlReturn))
err += tr("Only out, inout and return parameter may have a create effect.");
break;
default:
break;
}
if (!err.isEmpty())
msg_critical(tr("Error"), err);
else {
bn->set_name(s);
bool newst = param->set_stereotype(fromUnicode(edstereotype->currentText().trimmed()));
AType t;
s = edtype->currentText().trimmed();
if (!s.isEmpty()) {
int index = list.indexOf(s);
if (index >= 0)
t.type = (BrowserClass *) nodes.at(index);
else
t.explicit_type = s;
}
param->set_type(t);
param->dir = dir;
param->multiplicity =
edmultiplicity->currentText().trimmed();
param->ordering = ordering(edordering->currentText().toLatin1());
param->effect = effect;
param->is_control = is_control_cb->isChecked();
param->unique = unique_cb->isChecked();
param->exception = exception;
param->stream = stream_rb->isChecked();
param->in_state = edin_state->text().trimmed();
param->default_value = edinit->text();
param->uml_selection = eduml_selection->text().trimmed();
param->cpp_selection = edcpp_selection->text().trimmed();
param->java_selection = edjava_selection->text().trimmed();
bn->set_comment(comment->text());
UmlWindow::update_comment_if_needed(bn);
kvtable->updateNodeFromThis(bn);
ProfiledStereotypes::modified(bn, newst);
bn->modified();
bn->package_modified();
param->modified();
TabDialog::accept();
}
}
}
示例13: synchronize
// synchronize all in todir, current packages are 'nodes'
void BrowserNode::synchronize(QDir & todir, Q3Dict<BrowserNode> & nodes)
{
static Q3Dict<void> useful(9973); // all useful files
static bool made_useful = TRUE; // set at the first call
// compare nodes with young packages
Q3DictIterator<BrowserNode> ity(Youngs);
for (; ity.current(); ++ity) {
BrowserNode * from = ity.current();
BrowserNode * curr_bn = nodes.find(ity.currentKey());
if ((curr_bn == 0) || (curr_bn->state == Old)) {
// don't exist or must be updated
if (made_useful)
useful.insert(ity.currentKey(), (void *) 1);
QDir & fromdir = from->view->get_dir();
// copy package file
copy(fromdir, todir, from->filename);
// copy diagrams files
QStringList::Iterator its;
QStringList & diags = from->diagrams;
if (made_useful) {
for (its = diags.begin(); its != diags.end(); ++its) {
copy_if_needed(fromdir, todir, *its);
useful.insert(*its, (void *) 1);
}
}
else
for (its = diags.begin(); its != diags.end(); ++its)
copy_if_needed(fromdir, todir, *its);
// copy class body files
QStringList & cls = from->classes;
if (made_useful) {
for (its = cls.begin(); its != cls.end(); ++its) {
copy_if_needed(fromdir, todir, *its);
useful.insert(*its, (void *) 1);
}
}
else
for (its = cls.begin(); its != cls.end(); ++its)
copy_if_needed(fromdir, todir, *its);
if (from->parent() == 0) {
// project, special files
copy_if_needed(fromdir, todir, "cpp_includes");
copy_if_needed(fromdir, todir, "idl_includes");
copy_if_needed(fromdir, todir, "java_imports");
copy_if_needed(fromdir, todir, "generation_settings");
copy_if_needed(fromdir, todir, "import");
copy_if_needed(fromdir, todir, "include");
copy_if_needed(fromdir, todir, "stereotypes");
copy_if_needed(fromdir, todir, "tools");
}
}
else if (made_useful)
// young, memorize packages, diagrams and classes body file
from->memo(useful);
}
if (made_useful) {
// memorize up to date packages, diagrams and classes body file
Q3DictIterator<BrowserNode> itn(nodes);
for (; itn.current(); ++itn)
if (itn.current()->state == UpToDate)
itn.current()->memo(useful);
made_useful = FALSE;
}
// remove files associated to deleted elements
purge(todir, useful);
}
示例14: TabDialog
ClassInstanceDialog::ClassInstanceDialog(ClassInstanceData * i)
: TabDialog(0, "class instance dialog", FALSE, Qt::WA_DeleteOnClose),
inst(i), atbl(0), rtbl(0)
{
setWindowTitle(tr("Class instance dialog"));
BrowserNode * bn = inst->get_browser_node();
bn->edit_start();
if (bn->is_writable()) {
setOkButton(tr("OK"));
setCancelButton(tr("Cancel"));
}
else {
setOkButton(QString());
setCancelButton(tr("Close"));
}
visit = !hasOkButton();
GridBox * grid;
// general tab
grid = new GridBox(2, this);
grid->setMargin(5);
grid->setSpacing(5);
grid->addWidget(new QLabel(tr("name : "), grid));
grid->addWidget(edname = new LineEdit(bn->get_name(), grid));
if (visit)
edname->setReadOnly(TRUE);
grid->addWidget(new QLabel(tr("stereotype :"), grid));
grid->addWidget(edstereotype = new QComboBox( grid));
edstereotype->setEditable(!visit);
edstereotype->addItem(toUnicode(bn->get_stereotype()));
if (! visit) {
edstereotype->addItems(ProfiledStereotypes::defaults(UmlClassInstance));
edstereotype->setAutoCompletion(completion());
}
SmallPushButton * b;
grid->addWidget(b = new SmallPushButton(tr("class :"), grid));
connect(b, SIGNAL(clicked()), this, SLOT(menu_class()));
grid->addWidget(edtype = new QComboBox(grid));
if (visit) {
edtype->addItem(inst->get_class()->full_name());
nodes.append(inst->get_class());
}
else {
BrowserClass::instances(nodes);
nodes.full_names(list);
edtype->addItems(list);
edtype->setCurrentIndex(nodes.indexOf(inst->get_class()));
connect(edtype, SIGNAL(activated(int)), this, SLOT(type_changed(int)));
}
if (visit)
cl_container = 0;
else {
cl_container = (BrowserNode *) bn->parent();
if ((cl_container != 0) && !cl_container->is_writable())
cl_container = 0;
}
VVBox * vtab;
grid->addWidget(vtab = new VVBox(grid));
vtab->addWidget(new QLabel(tr("description :"), vtab));
if (! visit) {
connect(b =new SmallPushButton(tr("Editor"), vtab), SIGNAL(clicked()),
this, SLOT(edit_description()));
vtab->addWidget(b);
}
grid->addWidget(comment = new MultiLineEdit(grid));
comment->setReadOnly(visit);
comment->setText(bn->get_comment());
QFont font = comment->font();
if (! hasCodec())
font.setFamily("Courier");
font.setFixedPitch(TRUE);
comment->setFont(font);
addTab(grid, "Uml");
// attributes tab
//.........这里部分代码省略.........
示例15: QLabel
StateDialog::StateDialog(StateData * d)
: Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), state(d)
{
d->browser_node->edit_start();
if (d->browser_node->is_writable()) {
setOkButton(TR("OK"));
setCancelButton(TR("Cancel"));
}
else {
setOkButton(QString());
setCancelButton(TR("Close"));
}
setCaption(TR("State dialog"));
visit = !hasOkButton();
BrowserNode * bn = state->browser_node;
Q3Grid * grid;
//
// general tab
//
grid = new Q3Grid(2, this);
umltab = grid;
grid->setMargin(5);
grid->setSpacing(5);
new QLabel(TR("name : "), grid);
edname = new LineEdit(bn->get_name(), grid);
edname->setReadOnly(visit);
new QLabel(TR("stereotype : "), grid);
edstereotype = new Q3ComboBox(!visit, grid);
edstereotype->insertItem(toUnicode(state->get_stereotype()));
if (!visit) {
edstereotype->insertStringList(BrowserState::default_stereotypes());
edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlState));
edstereotype->setAutoCompletion(completion());
}
edstereotype->setCurrentItem(0);
QSizePolicy sp = edstereotype->sizePolicy();
sp.setHorData(QSizePolicy::Expanding);
edstereotype->setSizePolicy(sp);
connect(new SmallPushButton(TR("specification :"), grid), SIGNAL(clicked()),
this, SLOT(menu_specification()));
edspecification = new Q3ComboBox(FALSE, grid);
edspecification->setSizePolicy(sp);
if (visit) {
if (state->get_specification() == 0)
edspecification->insertItem("");
else
edspecification->insertItem(state->get_specification()->full_name(TRUE));
}
else {
edspecification->insertItem("");
edspecification->setAutoCompletion(completion());
BrowserOperation::instances(opers);
opers.full_names(speclist);
edspecification->insertStringList(speclist);
edspecification->setCurrentItem((state->get_specification() == 0)
? 0
: opers.findRef(state->get_specification()) + 1);
}
switch (((BrowserNode *) bn->parent())->get_type()) {
case UmlState:
case UmlRegion:
if ((state->get_reference() != 0) || (bn->firstChild() == 0)) {
connect(new SmallPushButton(TR("reference :"), grid), SIGNAL(clicked()),
this, SLOT(menu_reference()));
edreference = new Q3ComboBox(FALSE, grid);
edreference->setSizePolicy(sp);
if (visit) {
if (state->get_reference() == 0)
edreference->insertItem("");
else
edreference->insertItem(state->get_reference()->full_name(TRUE));
}
else {
edreference->insertItem("");
edreference->setAutoCompletion(completion());
if (((BrowserState *) bn)->can_reference()) {
BrowserState::instances(states, TRUE);
BrowserNode * st = states.first();
while (st != 0) {
if (!((BrowserState *) bn)->can_reference((BrowserState *) st) ||
((BrowserState *) st)->is_ref()) {
states.remove();
st = states.current();
}
//.........这里部分代码省略.........