本文整理汇总了C++中Q3ValueList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3ValueList::end方法的具体用法?C++ Q3ValueList::end怎么用?C++ Q3ValueList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3ValueList
的用法示例。
在下文中一共展示了Q3ValueList::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QCOMPARE
void tst_Q3ValueList::beginEnd()
{
Q3ValueList<int> a;
a.append( 1 );
a.append( 10 );
a.append( 100 );
Q3ValueListConstIterator<int> cit1 = a.begin();
Q3ValueListConstIterator<int> cit2 = a.end();
QCOMPARE( *(cit1), 1 );
QCOMPARE( *(--cit2), 100 );
Q3ValueListIterator<int> it1 = a.begin();
Q3ValueListIterator<int> it2 = a.end();
*(it1) = 2;
*(--it2) = 200;
// Using const iterators to verify
QCOMPARE( *(cit1), 2 );
QCOMPARE( *(cit2), 200 );
Q3ValueList<int> b;
b.append( 1 );
Q3ValueList<int> b2 = b;
QVERIFY( b.constBegin() == b2.constBegin() );
QVERIFY( b.constEnd() == b2.constEnd() );
b2.append( 2 );
QVERIFY( b.constBegin() != b2.constBegin() );
QVERIFY( b2.constBegin() == b2.constBegin() );
}
示例2: undo_mark_deleted
/*!
* Undo marks deleted current element or group (with subgroups).
* \param item (in) - marked deleted element or group item.
*/
void CatalogForm::undo_mark_deleted( Q3ListViewItem * item )
{
qulonglong id = getElementId(item);
if(id)
{
cat->select(id);
if(cat->First())
{
cat->setMarkDeletedElement(id,false);
item->setPixmap(0,getElementPixmap());
}
}
else
{
id = getGroupId(item);
if(id)
{
// cat->select(QString("id=%1").arg(id),md_group);
//if(cat->FirstInGroupTable())
Q3ValueList<qulonglong> listDeletedId;
// cat->setMarkDeletedGroup(id, listDeletedId,false);
cat->getMarkDeletedList(id, listDeletedId);
Q3ValueList<qulonglong>::iterator it = listDeletedId.begin();
while(it != listDeletedId.end()) //first delete elements in this group
{
if(map_el.contains(*it))
{
map_el[*it]->setPixmap(0, getElementPixmap());
cat->setMarkDeletedElement(*it,false);
it = listDeletedId.remove(it);
}
else
{
++it;
}
}
it = listDeletedId.begin();
while(it != listDeletedId.end()) //second delete groups
{
if(map_gr.contains(*it))
{
map_gr[*it]->setPixmap(0, getGroupPixmap());
cat->setMarkDeletedGroup(*it,false);
it = listDeletedId.remove(it);
//map_el[*it]->invalidateHeight();// setHeight(10);
}
else
{
++it;
}
}
}
}
}
示例3: mark_deleted
/*!
* Marks deleted current element or group (with subgroups).
* While for mark deleted items sets ahother pixmap only.
* \param item (in) - marked deleted element or group item.
*/
void CatalogForm::mark_deleted( Q3ListViewItem * item )
{
qulonglong id = getElementId(item);
if(id)
{
cat->select(id);
// cat->setSelected(true);
if(cat->First())
{
cat->setMarkDeletedElement(id,true);
item->setPixmap(0,getMarkDeletedPixmap());
}
}
else
{
id = getGroupId(item);
if(id)
{
loadElements(id); // populate items in group
Q3ValueList<qulonglong> listDeletedId;
cat->getMarkDeletedList(id,listDeletedId);
Q3ValueList<qulonglong>::iterator it = listDeletedId.begin();
while(it != listDeletedId.end()) //first delete elements in this group
{
if(map_el.contains(*it))
{
map_el[*it]->setPixmap(0, getMarkDeletedPixmap());
cat->setMarkDeletedElement(*it,true);
it = listDeletedId.remove(it);
}
else
{
++it;
}
}
it = listDeletedId.begin();
while(it != listDeletedId.end()) //second delete groups
{
if(map_gr.contains(*it))
{
map_gr[*it]->setPixmap(0, getMarkDeletedPixmap());
cat->setMarkDeletedGroup(*it,true);
it = listDeletedId.remove(it);
//map_el[*it]->invalidateHeight();// setHeight(10);
}
else
{
++it;
}
}
}
}
}
示例4: QVERIFY
void tst_Q3ValueList::fromLast()
{
Q3ValueList<int> a;
Q3ValueListIterator<int> it = a.fromLast();
QVERIFY( (it == a.end()) );
a.append( 1 );
a.append( 10 );
a.append( 100 );
it = a.fromLast();
QVERIFY( (it != a.end()) );
QCOMPARE( a.last(), 100 );
*(a.fromLast()) = 200;
QCOMPARE( a.last(), 200 );
}
示例5: del_item
/*!
* Delets current element or group (with subgroups).
* \param item (in) - deleted element or group item.
*/
void CatalogForm::del_item( Q3ListViewItem * item )
{
// cat->groupSelect(getGroupId(item));
qulonglong id = getElementId(item);
if(id)
{
cat->select(id);
if(cat->First())
{
cat->delElement();
map_el.remove(id);
delete item;
item = 0;
}
}
else
{
id = getGroupId(item);
if(id)
{
Q3ValueList<qulonglong> listDeletedId;
cat->delGroup(id, listDeletedId);
Q3ValueList<qulonglong>::iterator it = listDeletedId.begin();
while(it!= listDeletedId.end())
{
if(map_el.contains(*it)) map_el.remove(*it);
else if(map_gr.contains(*it)) map_gr.remove(*it);
++it;
}
delete item; // destructor delete all subitems
item = 0;
}
}
}
示例6: write_uml_params
void UmlOperation::write_uml_params(FileOut & out)
{
const Q3ValueList<UmlParameter> p = params();
Q3ValueList<UmlParameter>::ConstIterator it;
for (it = p.begin(); it != p.end(); ++it) {
out.indent();
out << "<ownedParameter xmi:type=\"uml:Parameter\" name=\"" << (*it).name
<< "\" xmi:id=\"BOUML_op_param_"
<< ++param_id << "\" direction=\"";
if (_pk_prefix)
out << "pk_";
switch ((*it).dir) {
case InputOutputDirection:
out << "inout\">\n";
break;
case OutputDirection:
out << "out\">\n";
break;
default:
out << "in\">\n";
}
out.indent(+1);
UmlItem::write_type(out, (*it).type);
out.indent(-1);
out.indent();
out << "</ownedParameter>\n";
}
}
示例7: generate_formals
void UmlClass::generate_formals(QTextOStream & f) {
Q3ValueList<UmlFormalParameter> fs = formals();
if (! fs.isEmpty()) {
Q3ValueList<UmlFormalParameter>::Iterator it;
const char * sep = "<";
for (it = fs.begin(); it != fs.end(); it++) {
UmlFormalParameter & p = *it;
f << sep;
sep = ", ";
f << p.name();
const UmlTypeSpec & t = p.extend();
if (t.type != 0) {
f << " extends ";
t.type->write(f);
}
else if (! t.explicit_type.isEmpty())
f << " extends " << JavaSettings::type(t.explicit_type);
}
f << ">";
}
}
示例8: get_template_prefixes
void UmlClass::get_template_prefixes(Q3CString & template1,
Q3CString & template2) {
Q3ValueList<UmlFormalParameter> formals = this->formals();
if (!formals.isEmpty()) {
Q3ValueList<UmlFormalParameter>::ConstIterator it;
const char * sep1 = "template<";
const char * sep2 = "<";
for (it = formals.begin(); it != formals.end(); ++it) {
const UmlFormalParameter & f = *it;
template1 += sep1;
template1 += f.type();
template1 += " ";
template1 += f.name();
template2 += sep2;
template2 += f.name();
sep1 = sep2 = ", ";
}
template1 += ">\n";
template2 += ">";
}
}
示例9: generate_implements
void UmlRelation::generate_implements(const char *& sep, QTextOStream & f,
const Q3ValueList<UmlActualParameter> & actuals,
const Q3CString & cl_stereotype) {
switch (relationKind()) {
default:
return;
case aGeneralisation:
case aRealization:
if (javaDecl().isEmpty())
return;
UmlClass * role_type = roleType();
const Q3CString & other_stereotype = role_type->java_stereotype();
if ((other_stereotype == "interface") || (other_stereotype == "@interface")) {
if ((cl_stereotype == "union") || (cl_stereotype == "enum_pattern")) {
write_trace_header();
UmlCom::trace(Q3CString(" <font color=\"red\"><b>an <i>")
+ cl_stereotype + "</i> cannot inherits</b></font><br>");
incr_warning();
}
else {
f << sep;
sep = ", ";
const char * p = javaDecl();
while (*p) {
if (!strncmp(p, "${type}", 7)) {
role_type->write(f);
p += 7;
if (!actuals.isEmpty()) {
Q3ValueList<UmlActualParameter>::ConstIterator ita;
bool used = FALSE;
for (ita = actuals.begin(); ita != actuals.end(); ++ita) {
if ((*ita).superClass() == role_type) {
used = TRUE;
(*ita).generate(f);
}
}
if (used) {
f << ">";
}
}
}
else if (*p == '@')
manage_alias(p, f);
else
f << *p++;
}
}
}
}
}
示例10: write_stereotyped
void UmlItem::write_stereotyped(FileOut & out)
{
QMap<QString, Q3PtrList<UmlItem> >::Iterator it;
for (it = _stereotypes.begin(); it != _stereotypes.end(); ++it) {
const char * st = it.key();
UmlClass * cl = UmlClass::findStereotype(it.key(), TRUE);
if (cl != 0) {
Q3ValueList<WrapperStr> extended;
cl->get_extended(extended);
Q3PtrList<UmlItem> & l = it.data();
UmlItem * elt;
for (elt = l.first(); elt != 0; elt = l.next()) {
out << "\t<" << st;
out.id_prefix(elt, "STELT_");
const Q3Dict<WrapperStr> props = elt->properties();
Q3DictIterator<WrapperStr> itp(props);
while (itp.current()) {
QString k = itp.currentKey();
if (k.contains(':') == 2) {
out << " ";
out.quote((const char *)k.mid(k.findRev(':') + 1)); //[jasa] ambiguous call
out << "=\"";
out.quote((const char *)*itp.current());
out << '"';
}
++itp;
}
Q3ValueList<WrapperStr>::Iterator iter_extended;
for (iter_extended = extended.begin();
iter_extended != extended.end();
++iter_extended) {
WrapperStr vr = "base_" + *iter_extended;
out.ref(elt, vr);
}
out << "/>\n";
elt->unload();
}
}
}
}
示例11: init_pins_tab
void ParameterSetDialog::init_pins_tab()
{
bool visit = !hasOkButton();
Q3HBox * hbox;
QPushButton * button;
Q3VBox * vbox = new Q3VBox(this);
Q3VBox * page = vbox;
const Q3ValueList<BrowserPin *> & inpins = data->pins;
Q3ValueList<BrowserPin *>::ConstIterator it;
if (!visit) {
hbox = new Q3HBox(vbox);
vbox = new Q3VBox(hbox);
vbox->setMargin(5);
(new QLabel(TR("Parameters out of Parameter Set"), vbox))->setAlignment(Qt::AlignCenter);
lb_available = new Q3ListBox(vbox);
lb_available->setSelectionMode(Q3ListBox::Multi);
BrowserParameterSet * bn =
(BrowserParameterSet *) data->get_browser_node();
Q3ValueList<BrowserPin *> allpins =
((BrowserActivityAction *) bn->parent())->get_pins();
for (it = allpins.begin(); it != allpins.end(); it++)
if (inpins.find(*it) == inpins.end())
lb_available->insertItem(new ListBoxBrowserNode(*it, (*it)->full_name(TRUE)));
lb_available->sort();
vbox = new Q3VBox(hbox);
vbox->setMargin(5);
(new QLabel("", vbox))->setScaledContents(TRUE);
button = new QPushButton(vbox);
button->setPixmap(*rightPixmap);
connect(button, SIGNAL(clicked()), this, SLOT(associate_cls()));
(new QLabel("", vbox))->setScaledContents(TRUE);
button = new QPushButton(vbox);
button->setPixmap(*leftPixmap);
connect(button, SIGNAL(clicked()), this, SLOT(unassociate_cls()));
(new QLabel("", vbox))->setScaledContents(TRUE);
vbox = new Q3VBox(hbox);
}
vbox->setMargin(5);
(new QLabel(TR("Parameters in Parameter Set"), vbox))->setAlignment(Qt::AlignCenter);
lb_member = new Q3ListBox(vbox);
lb_member->setSelectionMode((visit) ? Q3ListBox::NoSelection
: Q3ListBox::Multi);
for (it = inpins.begin(); it != inpins.end(); ++it)
lb_member->insertItem(new ListBoxBrowserNode(*it, (*it)->full_name(TRUE)));
addTab(page, TR("Parameters"));
}
示例12: saveTagsTo
void Tag::saveTagsTo(Q3ValueList<Tag*> &list, const QString &fullPath)
{
// Create Document:
QDomDocument document(/*doctype=*/"basketTags");
QDomElement root = document.createElement("basketTags");
root.setAttribute("nextStateUid", static_cast<long long int>(nextStateUid) );
document.appendChild(root);
// Save all tags:
for (List::iterator it = list.begin(); it != list.end(); ++it) {
Tag *tag = *it;
// Create tag node:
QDomElement tagNode = document.createElement("tag");
root.appendChild(tagNode);
// Save tag properties:
XMLWork::addElement( document, tagNode, "name", tag->name() );
XMLWork::addElement( document, tagNode, "shortcut", tag->shortcut().primary().toString());
XMLWork::addElement( document, tagNode, "inherited", XMLWork::trueOrFalse(tag->inheritedBySiblings()) );
// Save all states:
for (State::List::iterator it2 = (*it)->states().begin(); it2 != (*it)->states().end(); ++it2) {
State *state = *it2;
// Create state node:
QDomElement stateNode = document.createElement("state");
tagNode.appendChild(stateNode);
// Save state properties:
stateNode.setAttribute("id", state->id());
XMLWork::addElement( document, stateNode, "name", state->name() );
XMLWork::addElement( document, stateNode, "emblem", state->emblem() );
QDomElement textNode = document.createElement("text");
stateNode.appendChild(textNode);
QString textColor = (state->textColor().isValid() ? state->textColor().name() : "");
textNode.setAttribute( "bold", XMLWork::trueOrFalse(state->bold()) );
textNode.setAttribute( "italic", XMLWork::trueOrFalse(state->italic()) );
textNode.setAttribute( "underline", XMLWork::trueOrFalse(state->underline()) );
textNode.setAttribute( "strikeOut", XMLWork::trueOrFalse(state->strikeOut()) );
textNode.setAttribute( "color", textColor );
QDomElement fontNode = document.createElement("font");
stateNode.appendChild(fontNode);
fontNode.setAttribute( "name", state->fontName() );
fontNode.setAttribute( "size", state->fontSize() );
QString backgroundColor = (state->backgroundColor().isValid() ? state->backgroundColor().name() : "");
XMLWork::addElement( document, stateNode, "backgroundColor", backgroundColor );
QDomElement textEquivalentNode = document.createElement("textEquivalent");
stateNode.appendChild(textEquivalentNode);
textEquivalentNode.setAttribute( "string", state->textEquivalent() );
textEquivalentNode.setAttribute( "onAllTextLines", XMLWork::trueOrFalse(state->onAllTextLines()) );
}
}
// Write to Disk:
if (!Basket::safelySaveToFile(fullPath, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + document.toString()))
DEBUG_WIN << "<font color=red>FAILED to save tags</font>!";
}
示例13: dragObject
Q3DragObject* NoteDrag::dragObject(NoteSelection *noteList, bool cutting, QWidget *source)
{
if (noteList->count() <= 0)
return 0;
// The MimeSource:
K3MultipleDrag *multipleDrag = new K3MultipleDrag(source);
// Make sure the temporary folder exists and is empty (we delete previously moved file(s) (if exists)
// since we override the content of the clipboard and previous file willn't be accessable anymore):
createAndEmptyCuttingTmpFolder();
// The "Native Format" Serialization:
QBuffer buffer;
if (buffer.open(QIODevice::WriteOnly)) {
QDataStream stream(&buffer);
// First append a pointer to the basket:
stream << (quint64)(noteList->firstStacked()->note->basket());
// Then a list of pointers to all notes, and parent groups:
for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked())
stream << (quint64)(node->note);
Q3ValueList<Note*> groups = noteList->parentGroups();
for (Q3ValueList<Note*>::iterator it = groups.begin(); it != groups.end(); ++it)
stream << (quint64)(*it);
stream << (quint64)0;
// And finally the notes themselves:
serializeNotes(noteList, stream, cutting);
// Append the object:
buffer.close();
Q3StoredDrag *dragObject = new Q3StoredDrag(NOTE_MIME_STRING, source);
dragObject->setEncodedData(buffer.buffer());
multipleDrag->addDragObject(dragObject);
}
// The "Other Flavours" Serialization:
serializeText( noteList, multipleDrag );
serializeHtml( noteList, multipleDrag );
serializeImage( noteList, multipleDrag );
serializeLinks( noteList, multipleDrag, cutting );
// The Alternate Flavours:
if (noteList->count() == 1)
noteList->firstStacked()->note->content()->addAlternateDragObjects(multipleDrag);
// If it is a drag, and not a copy/cut, add the feedback pixmap:
if (source)
setFeedbackPixmap(noteList, multipleDrag);
return multipleDrag;
}
示例14: serializeImage
void NoteDrag::serializeImage(NoteSelection *noteList, K3MultipleDrag *multipleDrag)
{
Q3ValueList<QPixmap> pixmaps;
QPixmap pixmap;
for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked()) {
pixmap = node->note->content()->toPixmap();
if (!pixmap.isNull())
pixmaps.append(pixmap);
}
if (!pixmaps.isEmpty()) {
QPixmap pixmapEquivalent;
if (pixmaps.count() == 1)
pixmapEquivalent = pixmaps[0];
else {
// Search the total size:
int height = 0;
int width = 0;
for (Q3ValueList<QPixmap>::iterator it = pixmaps.begin(); it != pixmaps.end(); ++it) {
height += (*it).height();
if ((*it).width() > width)
width = (*it).width();
}
// Create the image by painting all image into one big image:
pixmapEquivalent.resize(width, height);
pixmapEquivalent.fill(Qt::white);
QPainter painter(&pixmapEquivalent);
height = 0;
for (Q3ValueList<QPixmap>::iterator it = pixmaps.begin(); it != pixmaps.end(); ++it) {
painter.drawPixmap(0, height, *it);
height += (*it).height();
}
}
Q3ImageDrag *imageDrag = new Q3ImageDrag(pixmapEquivalent.convertToImage());
multipleDrag->addDragObject(imageDrag);
}
}
示例15:
K3BookmarkDrag::K3BookmarkDrag( const Q3ValueList<KBookmark> & bookmarks, const Q3StrList & urls,
QWidget * dragSource, const char * name )
: Q3UriDrag( urls, dragSource, name ), m_bookmarks( bookmarks ), m_doc("xbel")
{
// We need to create the XML for this drag right now and not
// in encodedData because when cutting a folder, the children
// wouldn't be part of the bookmarks anymore, when encodedData
// is requested.
QDomElement elem = m_doc.createElement("xbel");
m_doc.appendChild( elem );
for ( Q3ValueListConstIterator<KBookmark> it = bookmarks.begin(); it != bookmarks.end(); ++it ) {
elem.appendChild( (*it).internalElement().cloneNode( true /* deep */ ) );
}
//kDebug(7043) << "K3BookmarkDrag::K3BookmarkDrag " << m_doc.toString();
}