本文整理汇总了C++中BrowserNode::firstChild方法的典型用法代码示例。如果您正苦于以下问题:C++ BrowserNode::firstChild方法的具体用法?C++ BrowserNode::firstChild怎么用?C++ BrowserNode::firstChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrowserNode
的用法示例。
在下文中一共展示了BrowserNode::firstChild方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_annotation
void AnnotationDialog::add_annotation()
{
const int ndefault =
sizeof(DefaultAnnotations) / sizeof(*DefaultAnnotations);
int added_index = cb->currentItem();
QString added;
if (added_index < ndefault)
added = DefaultAnnotations[added_index];
else {
BrowserNode * cl = annotations.at(added_index - ndefault);
added = cl->get_name();
// have member ?
int n = 0;
QString first_name;
Q3ListViewItem * child;
for (child = cl->firstChild(); child != 0; child = child->nextSibling()) {
if (!((BrowserNode *) child)->deletedp()) {
switch (((BrowserNode *) child)->get_type()) {
case UmlClass:
case UmlExtraMember:
break;
default:
switch (++n) {
case 1:
first_name = ((BrowserNode *) child)->get_name();
break;
case 2:
added += "(" + first_name + QString("=, ")
+ ((BrowserNode *) child)->get_name() + "=";
break;
default:
added += QString(", ") + ((BrowserNode *) child)->get_name() + QString("=");
}
}
}
}
switch (n) {
case 0:
break;
case 1:
added += "()";
break;
default:
added += ")";
}
}
e->insert("@" + added + "\n");
e->setFocus();
}
示例2: 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) ||
//.........这里部分代码省略.........
示例3: 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();
}
//.........这里部分代码省略.........
示例4: if
PseudoStateDialog::PseudoStateDialog(PseudoStateData * ps)
: TabDialog(0, 0, FALSE, Qt::WA_DeleteOnClose), pst(ps)
{
BrowserPseudoState * bn = (BrowserPseudoState *) pst->browser_node;
BrowserState * refst;
SmallPushButton* sButton;
switch (bn->get_type()) {
case EntryPointPS:
case ExitPointPS:
if (((BrowserNode *) bn->parent())->get_type() == UmlState) {
refst = ((StateData *)((BrowserNode *) bn->parent())->get_data())->get_reference();
break;
}
// no break
default:
refst = 0;
}
bn->edit_start();
if (bn->is_writable()) {
setOkButton(TR("OK"));
setCancelButton(TR("Cancel"));
}
else {
setOkButton(QString());
setCancelButton(TR("Close"));
}
QString s = stringify(bn->get_type());
int index = s.indexOf("_");
if (index != -1)
s.replace(index, 1, " ");
setCaption((s + " dialog"));
visit = !hasOkButton();
// general tab
GridBox * 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));
edname->setReadOnly(visit);
grid->addWidget(new QLabel(TR("stereotype : "), grid));
grid->addWidget(edstereotype = new QComboBox(grid));
edstereotype->setEditable(!visit);
edstereotype->addItem(toUnicode(pst->get_stereotype()));
if (! visit) {
edstereotype->addItems(BrowserPseudoState::default_stereotypes());
edstereotype->addItems(ProfiledStereotypes::defaults(bn->get_type()));
edstereotype->setAutoCompletion(completion());
}
edstereotype->setCurrentIndex(0);
QSizePolicy sp = edstereotype->sizePolicy();
sp.setHorizontalPolicy(QSizePolicy::Expanding);
edstereotype->setSizePolicy(sp);
if (refst != 0) {
connect(new SmallPushButton(TR("reference :"), grid), SIGNAL(clicked()),
this, SLOT(menu_reference()));
grid->addWidget(edreference = new QComboBox(grid));
edreference->setSizePolicy(sp);
BrowserNode * ref = ((pst->get_reference() == 0) ||
!bn->can_reference(pst->get_reference()))
? 0 : pst->get_reference();
if (visit) {
if (ref == 0)
edreference->addItem("");
else
edreference->addItem(ref->full_name(TRUE));
}
else {
edreference->addItem("");
edreference->setAutoCompletion(completion());
BrowserNode * child;
UmlCode k = bn->get_type();
for (child = refst->firstChild();
child != 0;
child = child->nextSibling()) {
if (!((BrowserNode *) child)->deletedp()) {
UmlCode kk = ((BrowserNode *) child)->get_type();
if (kk == k)
pseudostates.append((BrowserNode *) child);
else if (kk == UmlRegion) {
for (BrowserNode * schild = child->firstChild();
//.........这里部分代码省略.........
示例5: accept
void RelatedElementsDialog::accept() {
bool inh = (inh_rb != 0) && inh_rb->isChecked();
bool dep = dep_rb->isChecked();
bool assoc = (assoc_rb != 0) && assoc_rb->isChecked();
if (!inh && !dep && !assoc)
return;
bool sametype = sametype_rb->isChecked();
UmlCode k = elt->get_type();
elts.clear();
Q3PtrDict<BrowserNode> d(71);
BrowserNodeList added;
int lvl = sb_level->value();
added.append(elt);
d.insert(elt, elt);
do {
BrowserNodeList newones;
Q3PtrListIterator<BrowserNode> it(added);
for (; it.current() != 0; ++it) {
BrowserNode * e = (BrowserNode *) it.current();
BrowserNode * bn;
if (referenced_rb->isChecked()) {
for (bn = (BrowserNode *) e->firstChild();
bn != 0;
bn = (BrowserNode *) bn->nextSibling()) {
if (! bn->deletedp()) {
BrowserNode * target;
switch (bn->get_type()) {
case UmlAssociation:
case UmlDirectionalAssociation:
case UmlAggregation:
case UmlAggregationByValue:
case UmlDirectionalAggregation:
case UmlDirectionalAggregationByValue:
if (! assoc) continue;
target = ((RelationData *) bn->get_data())->get_end_class();
break;
case UmlDependency:
if (! dep) continue;
target = ((RelationData *) bn->get_data())->get_end_class();
break;
case UmlGeneralisation:
case UmlRealize:
if (! inh) continue;
target = ((RelationData *) bn->get_data())->get_end_class();
break;
case UmlDependOn:
if (! dep) continue;
target = ((SimpleRelationData *) bn->get_data())->get_end_node();
break;
case UmlInherit:
if (! inh) continue;
target = ((SimpleRelationData *) bn->get_data())->get_end_node();
break;
default:
continue;
}
if ((sametype && (target->get_type() != k)) ||
(d[target] != 0))
continue;
d.insert(target, target);
newones.append(target);
}
}
}
if (referencing_rb->isChecked()) {
if (e->get_type() == UmlClass)
BrowserRelation::get_relating(e, d, newones, inh, dep, assoc);
BrowserSimpleRelation::get_relating(e, d, newones, inh, dep, sametype, k);
}
}
added = newones;
} while (--lvl != 0);
d.remove(elt);
Q3PtrDictIterator<BrowserNode> it(d);
while (it.current()) {
elts.append(it.current());
++it;
}
QDialog::accept();
}