本文整理汇总了C++中BrowserNode类的典型用法代码示例。如果您正苦于以下问题:C++ BrowserNode类的具体用法?C++ BrowserNode怎么用?C++ BrowserNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BrowserNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send_uml_def
void BasicData::send_uml_def(ToolCom * com, BrowserNode * bn,
const QString & comment) {
if (browser_node != 0) {
BrowserNode * d = browser_node->get_associated();
if (d != browser_node) {
// may have an associated diagram/view
if ((d != 0) && !d->deletedp())
d->write_id(com);
else
com->write_id(0);
}
}
com->write_string(stereotype);
((HaveKeyValueData *) bn)->send_def(com);
com->write_string(comment);
int api = com->api_format();
if (api > 11) {
com->write_bool(bn->markedp());
if (api > 30)
com->write_unsigned(bn->get_identifier());
}
}
示例2: mark_unmark
void ReferenceDialog::mark_unmark()
{
BrowserNode * bn = nodes.at(results->currentItem());
bn->toggle_mark(); // call update
BrowserView::force_visible(bn);
}
示例3: collisions
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);
}
}
}
}
}
示例4: void
void BrowserOperation::post_duplicate()
{
BrowserNode * x_of;
void (BrowserOperation::*set_x_of)(BrowserNode *);
if (get_of != 0) {
x_of = get_of;
get_of = 0;
set_x_of = &BrowserOperation::set_get_of;
}
else if (set_of != 0) {
x_of = set_of;
set_of = 0;
set_x_of = &BrowserOperation::set_set_of;
}
else
return;
// search for attribute/relation
QString s = x_of->get_name();
UmlCode k = x_of->get_type();
BrowserNode * child;
for (child = ((BrowserNode *)parent())->firstChild(); child != 0; child = child->nextSibling()) {
if ((((BrowserNode *) child)->get_type() == k) &&
((BrowserNode *) child)->get_name() == s) {
// this one
(this->*set_x_of)((BrowserNode *) child);
break;
}
}
}
示例5: parents
// check inheritance
QString BrowserNode::check_inherit(const BrowserNode * new_parent) const {
Q3PtrList<BrowserNode> all_parents;
Q3PtrList<BrowserNode> notyet = parents();
if (notyet.findRef(new_parent) != -1)
return TR("already generalize / realize");
notyet.append(new_parent);
do {
BrowserNode * cl = notyet.getFirst();
notyet.removeFirst();
if (cl == this)
return TR("can't have circular generalization / realization");
if (all_parents.findRef(cl) == -1) {
all_parents.append(cl);
Q3PtrList<BrowserNode> grand_parents = cl->parents();
for (cl = grand_parents.first(); cl; cl = grand_parents.next())
if (notyet.findRef(cl) == -1)
notyet.append(cl);
}
} while (! notyet.isEmpty());
return 0;
}
示例6: compute
void ReferenceDialog::compute() {
QApplication::setOverrideCursor(Qt::waitCursor);
Q3PtrList<BrowserNode> l;
BrowserNode * bn;
nodes.clear();
results->clear();
target->referenced_by(l);
for (bn = l.first(); bn; bn = l.next())
nodes.append(bn);
nodes.sort();
// remove duplicats
nodes.first();
while ((bn = nodes.current()) != 0)
if (bn == nodes.next())
nodes.remove();
QStringList names;
nodes.full_names(names);
QStringList::Iterator it;
for (bn = nodes.first(), it = names.begin();
bn;
bn = nodes.next(), ++it)
results->insertItem(*(bn->pixmap(0)), *it);
selected((nodes.isEmpty()) ? -1 : 0);
QApplication::restoreOverrideCursor();
}
示例7: undelete
bool RelationData::undelete(QString & warning, QString & renamed,
BrowserRelation * rel, BooL & br_deleted)
{
QString s;
bool changed = FALSE;
BrowserNode * parent = (BrowserNode *) rel->parent();
if (is_a(rel)) {
while (parent->wrong_child_name(a.role, type, FALSE, TRUE)) {
changed = TRUE;
a.role = "_" + a.role;
}
}
else {
while (parent->wrong_child_name(b.role, type, FALSE, TRUE)) {
changed = TRUE;
b.role = "_" + b.role;
}
}
br_deleted = FALSE;
undelete(warning, renamed);
return changed;
}
示例8: ADD_GETSET
void QuickEdit::SetupExtraNodeController()
{
extraNodeController = QSharedPointer<ItemController<BrowserNode> >( new ItemController<BrowserNode>());
extraNodeController->SetColumns(columns);
ADD_GETSET(BrowserExtraMember, extraNodeController, columns.indexOf("name"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toString().toLatin1().constData, get_name, set_name);
ADD_GETSET(BrowserExtraMember, extraNodeController, columns.indexOf("deleted"), QVector<int>({Qt::DisplayRole,Qt::EditRole}),
toBool, deletedp, set_deleted);
ADD_PIXMAP_GETTER(BrowserExtraMember, extraNodeController, columns.indexOf("name"), QVector<int>({Qt::DecorationRole}), pixmap);
extraNodeController->AddFlagsFunctor
(
[&](const QModelIndex& index)
{
Qt::ItemFlags result;
result |= Qt::ItemIsSelectable;
if(!(index.column() *in(columns.indexOf("name"), columns.indexOf("deleted"))))
return result;
TreeItemInterface* iface = static_cast<TreeItemInterface*>(index.internalPointer());
if(!iface)
return result;
BrowserNode* pointer = static_cast<BrowserNode*>(iface->InternalPointer());
if(!pointer)
return result;
if(pointer->is_writable())
result |= Qt::ItemIsEditable;
result |= Qt::ItemIsEnabled;
return result;
}
);
}
示例9: sizeof
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();
}
示例10: if
void QuickEdit::AddOperation()
{
QModelIndex current = ui->tvEditor->selectionModel()->currentIndex();
if(!current.isValid())
return;
current = current.sibling(current.row(), 0);
TreeItemInterface *itemAsInterface = static_cast<TreeItemInterface*>(current.internalPointer());
BrowserNode* currentNode = static_cast<BrowserNode*>(itemAsInterface->InternalPointer());
BrowserClass* classNode;
int newItemPosition = 0;
if(currentNode->TypeID() == TypeIdentifier<BrowserClass>::id())
{
classNode = static_cast<BrowserClass*>(currentNode);
newItemPosition = itemAsInterface->childCount();
}
else if(currentNode->TypeID() == TypeIdentifier<BrowserOperation>::id() && current.parent().isValid())
{
itemAsInterface = static_cast<TreeItemInterface*>(current.parent().internalPointer());
classNode = static_cast<BrowserClass*>(itemAsInterface->InternalPointer());
newItemPosition = current.row()+1;
current = current.parent();
}
else
return;
if(!classNode)
return;
BrowserOperation* newOperation = static_cast<BrowserOperation*>(classNode->addOperation());
classNode->move(newOperation, currentNode);
classNode->select_in_browser();
QModelIndex parentIndex;
TreeItemInterface* parent;
if(treeModel->parent(current).isValid())
{
parentIndex = treeModel->parent(current);
parentIndex = parentIndex.sibling(parentIndex.row(), 0);
parent = static_cast<TreeItemInterface*>(parentIndex.internalPointer());
}
else
parent = treeModel->RootItem();
int insertIndex = parent->GetIndexOfChild(itemAsInterface);
QSharedPointer<TreeItemInterface> sharedOfOperation = parent->GetChildren()[insertIndex];
if(!treeModel->insertRows(newItemPosition-1, 1, current))
return;
if(!current.isValid())
return;
QModelIndex newItem = treeModel->index(newItemPosition-1,0,current);
TreeItemInterface *newItemInterface = static_cast<TreeItemInterface*>(newItem.internalPointer());
TreeItem<BrowserNode>* newItemAsNode = static_cast<TreeItem<BrowserNode>*>(newItemInterface);
newItemAsNode->SetController(operationController);
newItemAsNode->SetParent(sharedOfOperation);
newItemAsNode->SetInternalData(newOperation);
}
示例11: m
void PseudoStateDialog::menu_reference()
{
Q3PopupMenu m(0);
m.insertItem(TR("Choose"), -1);
m.insertSeparator();
int index = reflist.findIndex(edreference->currentText());
if (index != -1)
m.insertItem(TR("Select in browser"), 0);
BrowserNode * bn = 0;
if (! visit) {
bn = BrowserView::selected_item();
if ((bn != 0) &&
!bn->deletedp() &&
((BrowserPseudoState *) pst->browser_node)->can_reference(bn))
m.insertItem(TR("Choose pseudo state selected in browser"), 1);
else
bn = 0;
}
if ((index != -1) || (bn != 0)) {
switch (m.exec(QCursor::pos())) {
case 0:
pseudostates.at(index)->select_in_browser();
break;
case 1: {
QString s = bn->full_name(TRUE);
if ((index = reflist.findIndex(s)) == -1) {
// new state, may be created through an other dialog
index = 0;
QStringList::Iterator iter = reflist.begin();
QStringList::Iterator iter_end = reflist.end();
while ((iter != iter_end) && (*iter < s)) {
++iter;
index += 1;
}
pseudostates.insert((unsigned) index, bn);
reflist.insert(iter, s);
edreference->insertItem(s, index + 1);
}
}
edreference->setCurrentItem(index + 1);
break;
default:
break;
}
}
}
示例12: return
BrowserNode * DeploymentNodeCanvas::new_type() {
BrowserNode * container = (BrowserNode *)
the_canvas()->browser_diagram()->parent();
return (container->is_writable())
? BrowserDeploymentNode::add_deploymentnode(container)
: 0;
}
示例13: 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;
}
示例14: prepare_update_lib
void BrowserArtifact::prepare_update_lib() const
{
all.memo_id_oid(get_ident(), original_id);
for (BrowserNode * child = firstChild();
child != 0;
child = child->nextSibling())
((BrowserNode *) child)->prepare_update_lib();
}
示例15: m
void ActivityDialog::menu_specification()
{
Q3PopupMenu m(0);
m.insertItem(TR("Choose"), -1);
m.insertSeparator();
int index = list.findIndex(edspecification->currentText().stripWhiteSpace());
if (index != -1)
m.insertItem(TR("Select in browser"), 0);
BrowserNode * bn = 0;
if (! visit) {
bn = BrowserView::selected_item();
if ((bn != 0) && (bn->get_type() == UmlOperation) && !bn->deletedp())
m.insertItem(TR("Choose operation selected in browser"), 1);
else
bn = 0;
}
if ((index != -1) || (bn != 0)) {
switch (m.exec(QCursor::pos())) {
case 0:
opers.at(index)->select_in_browser();
break;
case 1: {
QString s = bn->full_name(TRUE);
if ((index = list.findIndex(s)) == -1) {
// new operation, may be created through an other dialog
index = 0;
QStringList::Iterator iter = list.begin();
QStringList::Iterator iter_end = list.end();
while ((iter != iter_end) && (*iter < s)) {
++iter;
index += 1;
}
opers.insert((unsigned) index, bn);
list.insert(iter, s);
edspecification->insertItem(s, index + 1);
}
}
edspecification->setCurrentItem(index + 1);
break;
default:
break;
}
}
}