QgsWMSLayerItem::QgsWMSLayerItem( QgsDataItem *parent, QString name, QString path, const QgsWmsCapabilitiesProperty &capabilitiesProperty, const QgsDataSourceUri &dataSourceUri, const QgsWmsLayerProperty &layerProperty ) : QgsLayerItem( parent, name, path, QString(), QgsLayerItem::Raster, QStringLiteral( "wms" ) ) , mCapabilitiesProperty( capabilitiesProperty ) , mDataSourceUri( dataSourceUri ) , mLayerProperty( layerProperty ) { mSupportedCRS = mLayerProperty.crs; mSupportFormats = mCapabilitiesProperty.capability.request.getMap.format; QgsDebugMsg( "uri = " + mDataSourceUri.encodedUri() ); mUri = createUri(); // Populate everything, it costs nothing, all info about layers is collected for ( const QgsWmsLayerProperty &layerProperty : qgis::as_const( mLayerProperty.layer ) ) { // Attention, the name may be empty QgsDebugMsg( QString::number( layerProperty.orderId ) + ' ' + layerProperty.name + ' ' + layerProperty.title ); QString pathName = layerProperty.name.isEmpty() ? QString::number( layerProperty.orderId ) : layerProperty.name; QgsWMSLayerItem *layer = new QgsWMSLayerItem( this, layerProperty.title, mPath + '/' + pathName, mCapabilitiesProperty, dataSourceUri, layerProperty ); //mChildren.append( layer ); addChildItem( layer ); } mIconName = QStringLiteral( "mIconWms.svg" ); setState( Populated ); }
void SunMenuItemView::childItemAdded(MenuItemModel* newMenu) { MenuItemModel* parent = static_cast<MenuItemModel*>(sender()); Q_ASSERT(parent == mItemModel); addChildItem(newMenu); recalculateChildMenusAngles(); }
void ScutCxListItem::addChildItem(CCNode *child) { LayoutParam layout; layout.val_x.t = ABS_WITH_PIXEL; layout.val_y.t = ABS_WITH_PIXEL; CCPoint point = child->getPosition(); layout.val_x.val.pixel_val = point.x; layout.val_y.val.pixel_val = point.y; addChildItem(child,layout); }
void QgsDataItem::populate() { if ( mPopulated ) return; QgsDebugMsg( "mPath = " + mPath ); QVector<QgsDataItem*> children = createChildren(); foreach ( QgsDataItem *child, children ) { // initialization, do not refresh! That would result in infinite loop (beginInsertItems->rowCount->populate) addChildItem( child ); }
void QgsCptCityDataItem::populate() { if ( mPopulated ) return; QgsDebugMsg( "mPath = " + mPath ); QApplication::setOverrideCursor( Qt::WaitCursor ); QVector<QgsCptCityDataItem *> children = createChildren(); Q_FOREACH ( QgsCptCityDataItem *child, children ) { // initialization, do not refresh! That would result in infinite loop (beginInsertItems->rowCount->populate) addChildItem( child ); }
void SunMenuItemView::initialize() { Q_ASSERT_X(mItemModel != 0 && mItemModel->displayedItem() != 0, "MenuItemView::initialize()", "You should pass a valid MenuItemModel pointer"); Q_ASSERT_X(mParentLayer != 0, "MenuItemView::initialize()", "Parent layer for item MUST be specified."); connect(representation(),SIGNAL(brushChanged(const QBrush&)), this, SLOT(updateBrush(const QBrush&))); updateBrush(representation()->brush()); setAcceptHoverEvents(true); setParent(mItemModel); setParentItem(mParentItemView); // Cache useless in this situation because we don't use transformation and menu doesn't change it's position. //It's increases memory usage and greatly reduces the animation performance. setCacheMode(QGraphicsItem::NoCache); // setFlag(QGraphicsItem::ItemStacksBehindParent, true); if (mItemModel->displayedItem()->graphicsItem()) mItemModel->displayedItem()->graphicsItem()->setParentItem(this); connect(mItemModel, SIGNAL(childAdded(MenuItemModel*)), this, SLOT(childItemAdded(MenuItemModel*))); mSubLayer = 0; mStartAngle = 0; mSweepLength = 0; mWidth = 0; mInnerRadius = 0; if (!mItemModel->childMenus().isEmpty()) { foreach(MenuItemModel* mc, mItemModel->childMenus()) addChildItem(mc); } updateShape(); recalculateChildMenusAngles(); }
void QgsMssqlConnectionItem::refresh() { QgsDebugMsg( "mPath = " + mPath ); // read up the schemas and layers from database QVector<QgsDataItem*> items = createChildren(); // Add new items foreach ( QgsDataItem *item, items ) { // Is it present in childs? int index = findItem( mChildren, item ); if ( index >= 0 ) { (( QgsMssqlSchemaItem* )mChildren[index] )->addLayers( item ); delete item; continue; } addChildItem( item, true ); }
void QgsDb2ConnectionItem::refresh() { QgsDebugMsg( "db2 mPath = " + mPath ); // read up the schemas and layers from database QVector<QgsDataItem *> items = createChildren(); // Add new items Q_FOREACH ( QgsDataItem *item, items ) { // Is it present in children? int index = findItem( mChildren, item ); if ( index >= 0 ) { ( ( QgsDb2SchemaItem * )mChildren.at( index ) )->addLayers( item ); delete item; continue; } addChildItem( item, true ); }
foreach ( QgsDataItem *item, createChildren() ) { addChildItem( item, true ); }
Q_FOREACH ( QgsDataItem *item, createChildren() ) { addChildItem( item, true ); }
void ScutCxListItem::addChildItem(CCNode *child, const LayoutParam &layout) { addChildItem(child, layout, 0); }
foreach ( QgsDataItem *item, createChildren() ) { QgsDebugMsg( QString( "Adding child %1" ).arg( item->name() ) ); addChildItem( item, true ); }