本文整理汇总了C++中QValueList::last方法的典型用法代码示例。如果您正苦于以下问题:C++ QValueList::last方法的具体用法?C++ QValueList::last怎么用?C++ QValueList::last使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QValueList
的用法示例。
在下文中一共展示了QValueList::last方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void Layout::setup()
{
startPoint = QPoint( 32767, 32767 );
QValueList<QWidgetList> lists;
QWidget *lastParent = 0;
QWidgetList *lastList = 0;
QWidget *w = 0;
// Go through all widgets of the list we got. As we can only
// layout widgets which have the same parent, we first do some
// sorting which means create a list for each parent containing
// its child here. After that we keep working on the list of
// childs which has the most entries.
// Widgets which are already laid out are thrown away here too
for ( w = widgets.first(); w; w = widgets.next() ) {
if ( w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout )
continue;
if ( lastParent != w->parentWidget() ) {
lastList = 0;
lastParent = w->parentWidget();
QValueList<QWidgetList>::Iterator it = lists.begin();
for ( ; it != lists.end(); ++it ) {
if ( ( *it ).first()->parentWidget() == w->parentWidget() )
lastList = &( *it );
}
if ( !lastList ) {
QWidgetList l;
l.setAutoDelete( FALSE );
lists.append( l );
lastList = &lists.last();
}
}
lastList->append( w );
}
// So, now find the list with the most entries
lastList = 0;
QValueList<QWidgetList>::Iterator it = lists.begin();
for ( ; it != lists.end(); ++it ) {
if ( !lastList || ( *it ).count() > lastList->count() )
lastList = &( *it );
}
// If we found no list (because no widget did fit at all) or the
// best list has only one entry and we do not layout a container,
// we leave here.
if ( !lastList || ( lastList->count() < 2 &&
( !layoutBase ||
( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( layoutBase ) ) ) &&
layoutBase != formWindow->mainContainer() ) )
) ) {
widgets.clear();
startPoint = QPoint( 0, 0 );
return;
}
// Now we have a new and clean widget list, which makes sense
// to layout
widgets = *lastList;
// Also use the only correct parent later, so store it
parent = WidgetFactory::widgetOfContainer( widgets.first()->parentWidget() );
// Now calculate the position where the layout-meta-widget should
// be placed and connect to widgetDestroyed() signals of the
// widgets to get informed if one gets deleted to be able to
// handle that and do not crash in this case
for ( w = widgets.first(); w; w = widgets.next() ) {
connect( w, SIGNAL( destroyed() ),
this, SLOT( widgetDestroyed() ) );
startPoint = QPoint( QMIN( startPoint.x(), w->x() ),
QMIN( startPoint.y(), w->y() ) );
geometries.insert( w, QRect( w->pos(), w->size() ) );
// Change the Z-order, as saving/loading uses the Z-order for
// writing/creating widgets and this has to be the same as in
// the layout. Else saving + loading will give different results
w->raise();
}
}