Skip to content

Commit c77d2ec

Browse files
author
jef
committedSep 11, 2009
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
1 parent 558ea8d commit c77d2ec

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed
 

‎src/app/qgsidentifyresults.cpp

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class QgsIdentifyResultsDock : public QDockWidget
5454
deleteLater();
5555
}
5656
};
57+
5758
// Tree hierachy
5859
//
5960
// layer [userrole: QgsMapLayer]
@@ -124,13 +125,13 @@ void QgsIdentifyResults::addFeature( QgsMapLayer *layer, int fid,
124125
const QMap<QString, QString> &attributes,
125126
const QMap<QString, QString> &derivedAttributes )
126127
{
127-
QTreeWidgetItem *item = layerItem( layer );
128+
QTreeWidgetItem *layItem = layerItem( layer );
128129

129-
if ( item == 0 )
130+
if ( layItem == 0 )
130131
{
131-
item = new QTreeWidgetItem( QStringList() << layer->name() << tr( "Layer" ) );
132-
item->setData( 0, Qt::UserRole, QVariant::fromValue( dynamic_cast<QObject*>( layer ) ) );
133-
lstResults->addTopLevelItem( item );
132+
layItem = new QTreeWidgetItem( QStringList() << layer->name() << tr( "Layer" ) );
133+
layItem->setData( 0, Qt::UserRole, QVariant::fromValue( dynamic_cast<QObject*>( layer ) ) );
134+
lstResults->addTopLevelItem( layItem );
134135

135136
connect( layer, SIGNAL( destroyed() ), this, SLOT( layerDestroyed() ) );
136137

@@ -158,9 +159,7 @@ void QgsIdentifyResults::addFeature( QgsMapLayer *layer, int fid,
158159
}
159160
}
160161

161-
item->addChild( featItem );
162-
item->setExpanded( true );
163-
featItem->setExpanded( true );
162+
layItem->addChild( featItem );
164163
}
165164

166165
// Call to show the dialog box.
@@ -170,6 +169,28 @@ void QgsIdentifyResults::show()
170169
lstResults->sortItems( 0, Qt::AscendingOrder );
171170
expandColumnsToFit();
172171

172+
if ( lstResults->topLevelItemCount() > 0 )
173+
{
174+
QTreeWidgetItem *layItem = lstResults->topLevelItem( 0 );
175+
QTreeWidgetItem *featItem = layItem->child( 0 );
176+
177+
if ( layItem->childCount() == 1 )
178+
{
179+
QgsVectorLayer *layer = dynamic_cast<QgsVectorLayer *>( layItem->data( 0, Qt::UserRole ).value<QObject *>() );
180+
if ( layer && layer->isEditable() )
181+
{
182+
// if this is the only feature, it's on a vector layer and that layer is editable:
183+
// don't show the edit dialog instead of the results window
184+
editFeature( featItem );
185+
return;
186+
}
187+
}
188+
189+
// expand first layer and feature
190+
featItem->setExpanded( true );
191+
layItem->setExpanded( true );
192+
}
193+
173194
QDialog::show();
174195
}
175196
// Slot called when user clicks the Close button

‎src/ui/qgsoptionsbase.ui

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
<string>QGIS Options</string>
1414
</property>
1515
<property name="windowIcon" >
16-
<iconset/>
16+
<iconset>
17+
<normaloff/>
18+
</iconset>
1719
</property>
1820
<property name="sizeGripEnabled" >
1921
<bool>true</bool>

0 commit comments

Comments
 (0)
Please sign in to comment.