void QwtDynGridLayout::setGeometry(const QRect &rect) { QLayout::setGeometry(rect); if ( isEmpty() ) return; d_data->numCols = columnsForWidth(rect.width()); d_data->numRows = itemCount() / d_data->numCols; if ( itemCount() % d_data->numCols ) d_data->numRows++; #if QT_VERSION < 0x040000 QValueList<QRect> itemGeometries = layoutItems(rect, d_data->numCols); #else QList<QRect> itemGeometries = layoutItems(rect, d_data->numCols); #endif int index = 0; for (PrivateData::LayoutItemList::iterator it = d_data->itemList.begin(); it != d_data->itemList.end(); ++it) { QWidget *w = (*it)->widget(); if ( w ) { w->setGeometry(itemGeometries[index]); index++; } } }
void MessageView::messageItemClicked(YawnerNS::UiNS::ViewNS::MessageViewNS::MessageItem *item) { if (_viewMode != Thread || _currentThreadId != item->message()->getThreadStarterId()) { _currentThreadId = item->message()->getThreadStarterId(); _viewMode = Thread; QList<YawnerNS::UiNS::ViewNS::MessageViewNS::MessageItem*> threadList; QListIterator<YawnerNS::UiNS::ViewNS::MessageViewNS::MessageItem*> all(_messagesItems); all.toBack(); while (all.hasPrevious()) { if (all.peekPrevious()->message()->getThreadStarterId() == _currentThreadId) { threadList.append(all.previous()); } else { all.previous()->animateOpacity(0); } } qSort( threadList.begin(), threadList.end(), YawnerNS::UiNS::ViewNS::MessageViewNS::message_item_is_older_than ); layoutItems(&threadList); } else { _viewMode = Feed; layoutItems(&_messagesItems); } }
unsigned int CategorizedList::AddCategory(const std::string& name) { CategoryPtr p(new Category(*this, name)); m_categories.push_back(p); layoutItems(); return (unsigned int)m_categories.size() - 1; }
void MessageView::setWidth(int width) { setSceneRect(sceneRect().x(), sceneRect().y(), width, sceneRect().height()); QListIterator<YawnerNS::UiNS::ViewNS::MessageViewNS::MessageItem*> it(_messagesItems); while (it.hasNext()) { it.next()->setWidth(width - std::min(4, verticalScrollBar()->width())); } layoutItems(&_messagesItems); }
QgsLayoutItem *QgsLayout::itemByTemplateUuid( const QString &uuid ) const { QList<QgsLayoutItem *> itemList; layoutItems( itemList ); for ( QgsLayoutItem *item : qgis::as_const( itemList ) ) { if ( item->mTemplateUuid == uuid ) return item; } return nullptr; }
QgsLayoutItem *QgsLayout::itemByUuid( const QString &uuid, bool includeTemplateUuids ) const { QList<QgsLayoutItem *> itemList; layoutItems( itemList ); for ( QgsLayoutItem *item : qgis::as_const( itemList ) ) { if ( item->uuid() == uuid ) return item; else if ( includeTemplateUuids && item->mTemplateUuid == uuid ) return item; } return nullptr; }
void ScrollList::layout(){ layoutItems(); if(mVerticalScrolling){ float scrollyHeight = mScrollableHolder->getHeight(); if(scrollyHeight < getHeight()){ scrollyHeight = getHeight(); } if(mScrollableHolder){ mScrollableHolder->setSize(getWidth(), scrollyHeight); } if (getPerspective()){ if(mFillFromTop){ pushItemsTop(); } } else if(!mFillFromTop){ pushItemsTop(); } } else { float scrollyWidth = mScrollableHolder->getWidth(); if(scrollyWidth < getWidth()){ scrollyWidth = getWidth(); } if(mScrollableHolder){ mScrollableHolder->setSize(scrollyWidth, getHeight()); } } if(mScrollArea){ mScrollArea->setScrollSize(getWidth(), getHeight()); } assignItems(); }
QgsLayoutItemMap *QgsLayout::referenceMap() const { // prefer explicitly set reference map if ( QgsLayoutItemMap *map = qobject_cast< QgsLayoutItemMap * >( itemByUuid( mWorldFileMapId ) ) ) return map; // else try to find largest map QList< QgsLayoutItemMap * > maps; layoutItems( maps ); QgsLayoutItemMap *largestMap = nullptr; double largestMapArea = 0; for ( QgsLayoutItemMap *map : qgis::as_const( maps ) ) { double area = map->rect().width() * map->rect().height(); if ( area > largestMapArea ) { largestMapArea = area; largestMap = map; } } return largestMap; }
void Q3DockAreaLayout::setGeometry(const QRect &r) { QLayout::setGeometry(r); layoutItems(r); }
bool BaseList::onResumeLayout(void) { layoutItems(); return base_window::onResumeLayout(); }
void BaseList::onChildRemove(window_ptr& node) { layoutItems(); }
void BaseList::onChildAdd(window_ptr& node) { layoutItems(); }
void CategorizedList::Clear() { m_categories.clear(); layoutItems(); }
void CategorizedList::RemoveCategory(unsigned int idx) { m_categories.erase(m_categories.begin() + idx); layoutItems(); }
bool BaseList::onLoad(void) { layoutItems(); return base_window::onLoad(); }
QList< QgsLayoutItem * > QgsLayout::loadFromTemplate( const QDomDocument &document, const QgsReadWriteContext &context, bool clearExisting, bool *ok ) { if ( ok ) *ok = false; QList< QgsLayoutItem * > result; if ( clearExisting ) { clear(); } QDomDocument doc; // If this is a 2.x composition template, convert it to a layout template if ( QgsCompositionConverter::isCompositionTemplate( document ) ) { doc = QgsCompositionConverter::convertCompositionTemplate( document, mProject ); } else { doc = document; } // remove all uuid attributes since we don't want duplicates UUIDS QDomNodeList itemsNodes = doc.elementsByTagName( QStringLiteral( "LayoutItem" ) ); for ( int i = 0; i < itemsNodes.count(); ++i ) { QDomNode itemNode = itemsNodes.at( i ); if ( itemNode.isElement() ) { itemNode.toElement().removeAttribute( QStringLiteral( "uuid" ) ); } } QDomNodeList multiFrameNodes = doc.elementsByTagName( QStringLiteral( "LayoutMultiFrame" ) ); for ( int i = 0; i < multiFrameNodes.count(); ++i ) { QDomNode multiFrameNode = multiFrameNodes.at( i ); if ( multiFrameNode.isElement() ) { multiFrameNode.toElement().removeAttribute( QStringLiteral( "uuid" ) ); QDomNodeList frameNodes = multiFrameNode.toElement().elementsByTagName( QStringLiteral( "childFrame" ) ); QDomNode itemNode = frameNodes.at( i ); if ( itemNode.isElement() ) { itemNode.toElement().removeAttribute( QStringLiteral( "uuid" ) ); } } } //read general settings if ( clearExisting ) { QDomElement layoutElem = doc.documentElement(); if ( layoutElem.isNull() ) { return result; } bool loadOk = readXml( layoutElem, doc, context ); if ( !loadOk ) { return result; } layoutItems( result ); } else { result = addItemsFromXml( doc.documentElement(), doc, context ); } if ( ok ) *ok = true; return result; }