本文整理汇总了C++中Q3PtrDict类的典型用法代码示例。如果您正苦于以下问题:C++ Q3PtrDict类的具体用法?C++ Q3PtrDict怎么用?C++ Q3PtrDict使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Q3PtrDict类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_
void UmlBaseCollaborationDiagramDefinition::read_()
{
Q3PtrDict<UmlClassInstanceReference> instances;
unsigned n;
unsigned rank;
n = UmlCom::read_unsigned();
_instances.resize(n);
for (rank = 0; rank != n; rank += 1) {
UmlClassInstanceReference * i = new UmlClassInstanceReference();
_instances.insert(rank, i);
instances.insert((void *) UmlCom::read_unsigned(), i);
i->read_();
}
_instances.setAutoDelete(TRUE);
n = UmlCom::read_unsigned();
_messages.resize(n);
for (rank = 0; rank != n; rank += 1) {
UmlCollaborationMessage * m = new UmlCollaborationMessage();
_messages.insert(rank, m);
m->read_(instances);
}
_messages.setAutoDelete(TRUE);
}
示例2: save_list
void ColMsgTable::save_list(ColMsgList & l, Q3PtrDict<ColMsgList> & saved) {
if (saved.find(&l) == 0) {
saved.insert(&l, new ColMsgList(l));
Q3PtrListIterator<ColMsg> it(l);
for (; it.current(); ++it) {
ColMsg * m = it.current();
save_list(m->get_msgs(), saved);
save_list(m->in->get_msgs(), saved);
}
}
}
示例3: get_drawn
static void get_drawn(DiagramItemList & items,
Q3PtrDict<DiagramItem> & drawn)
{
DiagramItem * di;
for (di = items.first(); di != 0; di = items.next()) {
UmlCode k = di->type();
switch (k) {
case UmlComponent:
case UmlPackage:
drawn.replace(di->get_bn()->get_data(), di);
break;
default:
if (IsaSimpleRelation(k))
drawn.replace(((ArrowCanvas *) di)->get_data(), di);
}
}
}
示例4: drop
// the relation is not yet drawn,
void SimpleRelationCanvas::drop(BrowserNode * bn, UmlCanvas * canvas,
Q3PtrDict<DiagramItem> & drawn)
{
SimpleRelationData * def = (SimpleRelationData *) bn->get_data();
BrowserNode * from = def->get_start_node();
BrowserNode * to = def->get_end_node();
DiagramItem * ccfrom = drawn[from->get_data()];
DiagramItem * ccto = drawn[to->get_data()];
if ((ccfrom != 0) && (ccto != 0)) {
SimpleRelationCanvas * rel =
new SimpleRelationCanvas(canvas, ccfrom, ccto, from,
bn->get_type(), 0, -1.0, -1.0, def);
rel->show();
rel->package_modified();
drawn.replace(def, rel);
// package set modified by caller
}
}
示例5: dialog
void ComponentDiagramView::add_related_elements(DiagramItem * di, QString what,
bool inh, bool assoc) {
BrowserNodeList l;
RelatedElementsDialog dialog(di->get_bn(), what, inh, assoc, l);
dialog.raise();
if (dialog.exec() == QDialog::Accepted) {
QApplication::setOverrideCursor(Qt::waitCursor);
DiagramItemList items(canvas()->allItems());
Q3PtrDict<DiagramItem> drawn;
get_drawn(items, drawn);
history_save();
history_protected = TRUE;
int xmax = canvas()->width() - Diagram_Margin;
int ymax = canvas()->height() - Diagram_Margin;
QRect re = di->rect();
int x = re.x();
int y = re.bottom() + Diagram_Margin;
int future_y = y;
Q3PtrListIterator<BrowserNode> it(l);
BrowserNode * bn;
for (; (bn = it.current()) != 0; ++it) {
if (drawn[bn->get_data()] == 0) {
DiagramCanvas * dc;
switch (bn->get_type()) {
case UmlComponent:
dc = new ComponentCanvas(bn, the_canvas(), x, y);
break;
case UmlPackage:
dc = new PackageCanvas(bn, the_canvas(), x, y, 0);
break;
default:
continue;
}
drawn.replace(dc->get_bn()->get_data(), dc);
if ((x + dc->width()) > xmax)
dc->move(x = Diagram_Margin, y = future_y);
if (y + dc->height() > ymax) {
dc->move(x = Diagram_Margin, y = Diagram_Margin);
future_y = y + dc->height() + Diagram_Margin;
}
else {
int bot = y + dc->height() + Diagram_Margin;
if (bot > future_y)
future_y = bot;
}
x = x + dc->width() + Diagram_Margin;
dc->show();
dc->upper();
}
}
canvas()->update();
history_protected = FALSE;
window()->package_modified();
QApplication::restoreOverrideCursor();
}
}
示例6: add_marked_elements
void ComponentDiagramView::add_marked_elements(const QPoint& p,
Q3PtrDict<DiagramItem> & drawn) {
QApplication::setOverrideCursor(Qt::waitCursor);
history_save();
history_protected = TRUE;
int xmax = canvas()->width() - Diagram_Margin;
int ymax = canvas()->height() - Diagram_Margin;
int x = p.x();
int y = p.y();
int future_y = y;
const Q3PtrList<BrowserNode> & l = BrowserNode::marked_nodes();
Q3PtrListIterator<BrowserNode> it(l);
BrowserNode * bn;
for (; (bn = it.current()) != 0; ++it) {
if (drawn[bn->get_data()] == 0) {
DiagramCanvas * dc;
switch (bn->get_type()) {
case UmlComponent:
dc = new ComponentCanvas(bn, the_canvas(), x, y);
break;
case UmlPackage:
dc = new PackageCanvas(bn, the_canvas(), x, y, 0);
break;
default:
continue;
}
drawn.replace(dc->get_bn()->get_data(), dc);
if ((x + dc->width()) > xmax)
dc->move(x = Diagram_Margin, y = future_y);
if (y + dc->height() > ymax) {
dc->move(x = Diagram_Margin, y = Diagram_Margin);
future_y = y + dc->height() + Diagram_Margin;
}
else {
int bot = y + dc->height() + Diagram_Margin;
if (bot > future_y)
future_y = bot;
}
x = x + dc->width() + Diagram_Margin;
dc->show();
dc->upper();
}
}
UmlCanvas * cnv = (UmlCanvas *) canvas();
if (! cnv->must_draw_all_relations()) {
for (it.toFirst(); (bn = it.current()) != 0; ++it) {
if ((drawn[bn->get_data()] == 0) &&
IsaSimpleRelation(bn->get_type()))
SimpleRelationCanvas::drop(bn, cnv, drawn);
}
}
canvas()->update();
history_protected = FALSE;
window()->package_modified();
QApplication::restoreOverrideCursor();
}
示例7: validator
void ColMsgTable::change_ranks(int row, int col) {
ColMsg * msg = flat_msg_list[row];
HierarchicalRankValidator validator(view, msg->hierarchical_rank);
BooL ok;
QString new_hr = MyInputDialog::getText(TR("Enter new hierarchical rank"), TR("Hierarchical rank : "),
msg->hierarchical_rank, ok,
&validator);
if (ok && (new_hr != msg->hierarchical_rank)) {
QString old_hr = msg->hierarchical_rank;
#ifndef NEW_METHOD
// it may be (?, not reproduced) not possible to reintroduce the message
// at its original rank when the new rank is wrong => stop to follow this
// way and save the original def before trying to use the new rank ;-(
//
// Fixed by doing a ColDiagramView::update_msgs() after load ?
for (;;) {
msg->in->remove_it(msg);
msg->extract_it(view->get_msgs());
ColMsg::update_ranks(view->get_msgs());
msg->hierarchical_rank = new_hr;
msg->place_in_internal(view->get_msgs());
msg->place_in_its_support();
ColMsg::update_ranks(view->get_msgs());
if (new_hr.find('.') != -1) {
// upper level msg dest must be msg start
ColMsg * upper =
ColMsg::find_rec(new_hr.left(new_hr.findRev('.')), view->get_msgs());
if (upper == 0)
// error
new_hr = QString::null;
else {
CodObjCanvas * from;
CodObjCanvas * from_bis;
CodObjCanvas * to;
msg->in->get_from_to(from, to, msg->is_forward);
upper->in->get_from_to(from_bis, to, upper->is_forward);
if (to != from)
// error
new_hr = QString::null;
}
}
if (msg->hierarchical_rank != new_hr) {
msg_warning(TR("Warning"), TR("Invalid hierarchical rank"));
new_hr = old_hr;
}
else
break;
}
view->update_msgs();
if (new_hr != old_hr) {
refresh();
setCurrentCell(flat_msg_list.findIndex(msg), col);
}
#else
// save all the messages
Q3PtrDict<ColMsgList> saved;
saved.setAutoDelete(TRUE);
save_list(view->get_msgs(), saved);
// remove the message
msg->in->remove_it(msg);
msg->extract_it(view->get_msgs());
ColMsg::update_ranks(view->get_msgs());
// try to insert the msg with the asked rank
msg->hierarchical_rank = new_hr;
msg->place_in_internal(view->get_msgs());
msg->place_in_its_support();
ColMsg::update_ranks(view->get_msgs());
if (new_hr.find('.') != -1) {
// upper level msg dest must be msg start
ColMsg * upper =
ColMsg::find_rec(new_hr.left(new_hr.findRev('.')), view->get_msgs());
if (upper == 0)
// error
new_hr = QString::null;
else {
CodObjCanvas * from;
CodObjCanvas * from_bis;
CodObjCanvas * to;
msg->in->get_from_to(from, to, msg->is_forward);
upper->in->get_from_to(from_bis, to, upper->is_forward);
if (to != from)
// error
new_hr = QString::null;
}
//.........这里部分代码省略.........
示例8: it
void ArtifactCanvas::update_relations() {
// 'this' is a non source, check its associations
const Q3PtrDict<BrowserArtifact> * associated =
((ArtifactData *) browser_node->get_data())->get_associated();
Q3PtrDict<BrowserArtifact> associations;
Q3PtrListIterator<ArrowCanvas> it(lines);
while (it.current()) {
if ((it.current()->type() == UmlContain) &&
(((AssocContainCanvas *) it.current())->get_start() == this)) {
DiagramItem * adi = ((AssocContainCanvas *) it.current())->get_end();
if ((adi->type() == UmlArtifact) &&
(associated != 0) &&
(associated->find((BrowserArtifact *)
((ArtifactCanvas *) adi)->browser_node) != 0)) {
// association must exist
BrowserArtifact * c = (BrowserArtifact *)
((ArtifactCanvas *) adi)->browser_node;
associations.insert(c, c);
++it;
}
else
// association must not exist
it.current()->delete_it();
}
else
++it;
}
if (associated != 0) {
Q3PtrDictIterator<BrowserArtifact> it(*associated);
while (it.current()) {
if (associations.find(it.current()) == 0) {
// the association to 'it.current()' is not yet drawn
// search 'it.current()' cancas
Q3CanvasItemList all = canvas()->allItems();
Q3CanvasItemList::Iterator cit;
for (cit = all.begin(); cit != all.end(); ++cit) {
if ((*cit)->visible()) {
DiagramItem * adi = QCanvasItemToDiagramItem(*cit);
if ((adi != 0) && // an uml canvas item
(adi->type() == UmlArtifact) &&
(((ArtifactCanvas *) adi)->browser_node == it.current())) {
// find
(new AssocContainCanvas(the_canvas(), this, adi, 0, -1.0, -1.0))
->show();
break;
}
}
}
}
++it;
}
}
}
示例9: compareItems
int BrowserNodeList::compareItems(Q3PtrCollection::Item item1, Q3PtrCollection::Item item2)
{
QString s1 = ((BrowserNode *) item1)->get_name();
QString s2 = ((BrowserNode *) item2)->get_name();
if (s1 != s2) {
s1 += " ";
s2 += " ";
}
else {
QString * ps1 = SynonymousPath[(BrowserNode *) item1];
QString * ps2 = SynonymousPath[(BrowserNode *) item2];
if (ps1 == 0) {
s1 = ((BrowserNode *) item1)->full_name(TRUE);
ps1 = new QString(s1);
SynonymousPath.insert((BrowserNode *) item1, ps1);
}
else
s1 = *ps1;
if (ps2 == 0) {
s2 = ((BrowserNode *) item2)->full_name(TRUE);
ps2 = new QString(s2);
SynonymousPath.insert((BrowserNode *) item2, ps2);
}
else
s2 = *ps2;
}
return s1.compare(s2);
}
示例10: sort_it
void BrowserNodeList::sort_it() {
if (count() > 1000)
QApplication::setOverrideCursor(Qt::waitCursor);
BrowserPackage::prepare_for_sort();
sort();
SynonymousPath.setAutoDelete(TRUE);
SynonymousPath.clear();
if (count() > 1000)
QApplication::restoreOverrideCursor();
}