本文整理汇总了C++中QPtrList::removeRef方法的典型用法代码示例。如果您正苦于以下问题:C++ QPtrList::removeRef方法的具体用法?C++ QPtrList::removeRef怎么用?C++ QPtrList::removeRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPtrList
的用法示例。
在下文中一共展示了QPtrList::removeRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setSelection
//.........这里部分代码省略.........
kdDebug( 6040 ) << "old selection (" << oldStart << "," << oldStartPos << "," << oldEnd << "," << oldEndPos << ")" << endl;
kdDebug( 6040 ) << "new selection (" << s << "," << sp << "," << e << "," << ep << ")" << endl;
#endif
// update selection status of all objects between m_selectionStart and m_selectionEnd
RenderObject* o = s;
while (o && o!=e)
{
o->setSelectionState(SelectionInside);
// kdDebug( 6040 ) << "setting selected " << o << ", " << o->isText() << endl;
RenderObject* no;
if ( !(no = o->firstChild()) )
if ( !(no = o->nextSibling()) )
{
no = o->parent();
while (no && !no->nextSibling())
no = no->parent();
if (no)
no = no->nextSibling();
}
if (o->selectionState() == SelectionInside && !newSelectedInside.containsRef(o))
newSelectedInside.append(o);
o=no;
}
s->setSelectionState(SelectionStart);
e->setSelectionState(SelectionEnd);
if(s == e) s->setSelectionState(SelectionBoth);
if (!m_view)
return;
newSelectedInside.removeRef(s);
newSelectedInside.removeRef(e);
QRect updateRect;
// Don't use repaint() because it will cause all rects to
// be united (see khtmlview::scheduleRepaint()). Instead
// just draw damage rects for objects that have a change
// in selection state.
// ### for Qt, updateContents will unite them, too. This has to be
// circumvented somehow (LS)
// Are any of the old fully selected objects not in the new selection?
// If so we have to draw them.
// Could be faster by building list of non-intersecting rectangles rather
// than unioning rectangles.
QPtrListIterator<RenderObject> oldIterator(oldSelectedInside);
bool firstRect = true;
for (; oldIterator.current(); ++oldIterator){
if (!newSelectedInside.containsRef(oldIterator.current())){
if (firstRect){
updateRect = enclosingPositionedRect(oldIterator.current());
firstRect = false;
}
else
updateRect = updateRect.unite(enclosingPositionedRect(oldIterator.current()));
}
}
if (!firstRect){
m_view->updateContents( updateRect );
}
// Are any of the new fully selected objects not in the previous selection?