mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
multi layer identify:
- restore editing, if one feature is identified on a editable vector layer - expand just the first feature on the first layer git-svn-id: http://svn.osgeo.org/qgis/trunk@11626 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
558ea8dc24
commit
c77d2ecafe
@ -54,6 +54,7 @@ class QgsIdentifyResultsDock : public QDockWidget
|
||||
deleteLater();
|
||||
}
|
||||
};
|
||||
|
||||
// Tree hierachy
|
||||
//
|
||||
// layer [userrole: QgsMapLayer]
|
||||
@ -124,13 +125,13 @@ void QgsIdentifyResults::addFeature( QgsMapLayer *layer, int fid,
|
||||
const QMap<QString, QString> &attributes,
|
||||
const QMap<QString, QString> &derivedAttributes )
|
||||
{
|
||||
QTreeWidgetItem *item = layerItem( layer );
|
||||
QTreeWidgetItem *layItem = layerItem( layer );
|
||||
|
||||
if ( item == 0 )
|
||||
if ( layItem == 0 )
|
||||
{
|
||||
item = new QTreeWidgetItem( QStringList() << layer->name() << tr( "Layer" ) );
|
||||
item->setData( 0, Qt::UserRole, QVariant::fromValue( dynamic_cast<QObject*>( layer ) ) );
|
||||
lstResults->addTopLevelItem( item );
|
||||
layItem = new QTreeWidgetItem( QStringList() << layer->name() << tr( "Layer" ) );
|
||||
layItem->setData( 0, Qt::UserRole, QVariant::fromValue( dynamic_cast<QObject*>( layer ) ) );
|
||||
lstResults->addTopLevelItem( layItem );
|
||||
|
||||
connect( layer, SIGNAL( destroyed() ), this, SLOT( layerDestroyed() ) );
|
||||
|
||||
@ -158,9 +159,7 @@ void QgsIdentifyResults::addFeature( QgsMapLayer *layer, int fid,
|
||||
}
|
||||
}
|
||||
|
||||
item->addChild( featItem );
|
||||
item->setExpanded( true );
|
||||
featItem->setExpanded( true );
|
||||
layItem->addChild( featItem );
|
||||
}
|
||||
|
||||
// Call to show the dialog box.
|
||||
@ -170,6 +169,28 @@ void QgsIdentifyResults::show()
|
||||
lstResults->sortItems( 0, Qt::AscendingOrder );
|
||||
expandColumnsToFit();
|
||||
|
||||
if ( lstResults->topLevelItemCount() > 0 )
|
||||
{
|
||||
QTreeWidgetItem *layItem = lstResults->topLevelItem( 0 );
|
||||
QTreeWidgetItem *featItem = layItem->child( 0 );
|
||||
|
||||
if ( layItem->childCount() == 1 )
|
||||
{
|
||||
QgsVectorLayer *layer = dynamic_cast<QgsVectorLayer *>( layItem->data( 0, Qt::UserRole ).value<QObject *>() );
|
||||
if ( layer && layer->isEditable() )
|
||||
{
|
||||
// if this is the only feature, it's on a vector layer and that layer is editable:
|
||||
// don't show the edit dialog instead of the results window
|
||||
editFeature( featItem );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// expand first layer and feature
|
||||
featItem->setExpanded( true );
|
||||
layItem->setExpanded( true );
|
||||
}
|
||||
|
||||
QDialog::show();
|
||||
}
|
||||
// Slot called when user clicks the Close button
|
||||
|
@ -13,7 +13,9 @@
|
||||
<string>QGIS Options</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset/>
|
||||
<iconset>
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="sizeGripEnabled" >
|
||||
<bool>true</bool>
|
||||
|
Loading…
x
Reference in New Issue
Block a user