本文整理汇总了C++中LabelList::setAutoDelete方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelList::setAutoDelete方法的具体用法?C++ LabelList::setAutoDelete怎么用?C++ LabelList::setAutoDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LabelList
的用法示例。
在下文中一共展示了LabelList::setAutoDelete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fm
void
RadialMap::Widget::paintExplodedLabels(QPainter &paint) const
{
//we are a friend of RadialMap::Map
LabelList list;
list.setAutoDelete(true);
Q3PtrListIterator<Label> it(list);
unsigned int startLevel = 0;
//1. Create list of labels sorted in the order they will be rendered
if (m_focus && m_focus->file() != m_tree) //separate behavior for selected vs unselected segments
{
//don't bother with files
if (m_focus->file() && !m_focus->file()->isDirectory())
return;
//find the range of levels we will be potentially drawing labels for
//startLevel is the level above whatever m_focus is in
for (const Directory *p = (const Directory*)m_focus->file(); p != m_tree; ++startLevel)
p = p->parent();
//range=2 means 2 levels to draw labels for
unsigned int a1, a2, minAngle;
a1 = m_focus->start();
a2 = m_focus->end(); //boundry angles
minAngle = int(m_focus->length() * LABEL_MIN_ANGLE_FACTOR);
#define segment (*it)
#define ring (m_map.m_signature + i)
//**** Levels should be on a scale starting with 0
//**** range is a useless parameter
//**** keep a topblock var which is the lowestLevel OR startLevel for identation purposes
for (unsigned int i = startLevel; i <= m_map.m_visibleDepth; ++i)
for (Iterator<Segment> it = ring->iterator(); it != ring->end(); ++it)
if (segment->start() >= a1 && segment->end() <= a2)
if (segment->length() > minAngle)
list.inSort(new Label(segment, i));
#undef ring
#undef segment
} else {
#define ring m_map.m_signature
for (Iterator<Segment> it = ring->iterator(); it != ring->end(); ++it)
if ((*it)->length() > 288)
list.inSort(new Label((*it), 0));
#undef ring
}
//2. Check to see if any adjacent labels are too close together
// if so, remove the least significant labels
it.toFirst();
Q3PtrListIterator<Label> jt(it);
++jt;
while (jt) //**** no need to check _it_ as jt will be NULL if _it_ was too
{
//this method is fairly efficient
if ((*it)->tooClose((*jt)->a)) {
if ((*it)->lvl > (*jt)->lvl) {
list.remove(*it);
it = jt;
}
else
list.remove(*jt);
}
else
++it;
jt = it;
++jt;
}
//used in next two steps
bool varySizes;
//**** should perhaps use doubles
int *sizes = new int [ m_map.m_visibleDepth + 1 ]; //**** make sizes an array of floats I think instead (or doubles)
do
{
//3. Calculate font sizes
{
//determine current range of levels to draw for
uint range = 0;
for (it.toFirst(); it != 0; ++it)
//.........这里部分代码省略.........