[QGIS Commit] r11626 - in trunk/qgis/src: app ui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri Sep 11 17:56:44 EDT 2009
Author: jef
Date: 2009-09-11 17:56:44 -0400 (Fri, 11 Sep 2009)
New Revision: 11626
Modified:
trunk/qgis/src/app/qgsidentifyresults.cpp
trunk/qgis/src/ui/qgsoptionsbase.ui
Log:
multi layer identify:
- restore editing, if one feature is identified on a editable vector layer
- expand just the first feature on the first layer
Modified: trunk/qgis/src/app/qgsidentifyresults.cpp
===================================================================
--- trunk/qgis/src/app/qgsidentifyresults.cpp 2009-09-11 21:47:21 UTC (rev 11625)
+++ trunk/qgis/src/app/qgsidentifyresults.cpp 2009-09-11 21:56:44 UTC (rev 11626)
@@ -54,6 +54,7 @@
deleteLater();
}
};
+
// Tree hierachy
//
// layer [userrole: QgsMapLayer]
@@ -124,13 +125,13 @@
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 @@
}
}
- item->addChild( featItem );
- item->setExpanded( true );
- featItem->setExpanded( true );
+ layItem->addChild( featItem );
}
// Call to show the dialog box.
@@ -170,6 +169,28 @@
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
Modified: trunk/qgis/src/ui/qgsoptionsbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsoptionsbase.ui 2009-09-11 21:47:21 UTC (rev 11625)
+++ trunk/qgis/src/ui/qgsoptionsbase.ui 2009-09-11 21:56:44 UTC (rev 11626)
@@ -13,7 +13,9 @@
<string>QGIS Options</string>
</property>
<property name="windowIcon" >
- <iconset/>
+ <iconset>
+ <normaloff/>
+ </iconset>
</property>
<property name="sizeGripEnabled" >
<bool>true</bool>
More information about the QGIS-commit
mailing list