[QGIS Commit] r12796 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jan 19 07:44:04 EST 2010


Author: jef
Date: 2010-01-19 07:44:04 -0500 (Tue, 19 Jan 2010)
New Revision: 12796

Modified:
   trunk/qgis/src/app/qgsattributedialog.cpp
   trunk/qgis/src/app/qgsattributedialog.h
   trunk/qgis/src/app/qgsidentifyresults.cpp
Log:
open attribute dialogs non-modal when not in editing mode

Modified: trunk/qgis/src/app/qgsattributedialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributedialog.cpp	2010-01-19 12:43:17 UTC (rev 12795)
+++ trunk/qgis/src/app/qgsattributedialog.cpp	2010-01-19 12:44:04 UTC (rev 12796)
@@ -273,6 +273,16 @@
   }
 }
 
+void QgsAttributeDialog::show()
+{
+  if ( mDialog )
+  {
+    mDialog->setAttribute( Qt::WA_DeleteOnClose );
+    mDialog->show();
+    mDialog = 0;
+  }
+}
+
 void QgsAttributeDialog::saveGeometry()
 {
   if ( mDialog )

Modified: trunk/qgis/src/app/qgsattributedialog.h
===================================================================
--- trunk/qgis/src/app/qgsattributedialog.h	2010-01-19 12:43:17 UTC (rev 12795)
+++ trunk/qgis/src/app/qgsattributedialog.h	2010-01-19 12:44:04 UTC (rev 12796)
@@ -54,6 +54,7 @@
     void accept();
 
     int exec();
+    void show();
 
     void dialogDestroyed();
 

Modified: trunk/qgis/src/app/qgsidentifyresults.cpp
===================================================================
--- trunk/qgis/src/app/qgsidentifyresults.cpp	2010-01-19 12:43:17 UTC (rev 12795)
+++ trunk/qgis/src/app/qgsidentifyresults.cpp	2010-01-19 12:44:04 UTC (rev 12796)
@@ -293,7 +293,7 @@
 // (saves the current window size/position)
 void QgsIdentifyResults::close()
 {
-  clear(); 
+  clear();
 
   delete mActionPopup;
   mActionPopup = 0;
@@ -761,7 +761,9 @@
 
   QgsAttributeMap src = f.attributeMap();
 
-  vlayer->beginEditCommand( tr( "Attribute changed" ) );
+  if ( vlayer->isEditable() )
+    vlayer->beginEditCommand( tr( "Attribute changed" ) );
+
   QgsAttributeDialog *ad = new QgsAttributeDialog( vlayer, &f );
 
   if ( !vlayer->isEditable() && vlayer->actions()->size() > 0 )
@@ -789,25 +791,33 @@
     }
   }
 
-  if ( ad->exec() )
+  if ( vlayer->isEditable() )
   {
-    const QgsAttributeMap &dst = f.attributeMap();
-    for ( QgsAttributeMap::const_iterator it = dst.begin(); it != dst.end(); it++ )
+    if ( ad->exec() )
     {
-      if ( !src.contains( it.key() ) || it.value() != src[it.key()] )
+      const QgsAttributeMap &dst = f.attributeMap();
+      for ( QgsAttributeMap::const_iterator it = dst.begin(); it != dst.end(); it++ )
       {
-        vlayer->changeAttributeValue( f.id(), it.key(), it.value() );
+        if ( !src.contains( it.key() ) || it.value() != src[it.key()] )
+        {
+          vlayer->changeAttributeValue( f.id(), it.key(), it.value() );
+        }
       }
+      vlayer->endEditCommand();
     }
-    vlayer->endEditCommand();
+    else
+    {
+      vlayer->destroyEditCommand();
+    }
+
+    delete ad;
+
+    mCanvas->refresh();
   }
   else
   {
-    vlayer->destroyEditCommand();
+    ad->show();
   }
-
-  delete ad;
-  mCanvas->refresh();
 }
 
 void QgsIdentifyResults::highlightAll()



More information about the QGIS-commit mailing list