[QGIS Commit] r12378 - in trunk/qgis/src: app/attributetable ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Dec 8 18:59:13 EST 2009


Author: jef
Date: 2009-12-08 18:59:12 -0500 (Tue, 08 Dec 2009)
New Revision: 12378

Modified:
   trunk/qgis/src/app/attributetable/qgsattributetabledialog.cpp
   trunk/qgis/src/app/attributetable/qgsattributetabledialog.h
   trunk/qgis/src/ui/qgsattributetabledialog.ui
Log:
fix #1650

Modified: trunk/qgis/src/app/attributetable/qgsattributetabledialog.cpp
===================================================================
--- trunk/qgis/src/app/attributetable/qgsattributetabledialog.cpp	2009-12-08 23:33:09 UTC (rev 12377)
+++ trunk/qgis/src/app/attributetable/qgsattributetabledialog.cpp	2009-12-08 23:59:12 UTC (rev 12378)
@@ -89,18 +89,21 @@
   mZoomMapToSelectedRowsButton->setIcon( getThemeIcon( "/mActionZoomToSelected.png" ) );
   mInvertSelectionButton->setIcon( getThemeIcon( "/mActionInvertSelection.png" ) );
   mToggleEditingButton->setIcon( getThemeIcon( "/mActionToggleEditing.png" ) );
+  mDeleteSelectedButton->setIcon( getThemeIcon( "/mActionDeleteSelected.png" ) );
   mOpenFieldCalculator->setIcon( getThemeIcon( "/mActionCalculateField.png" ) );
   mAddAttribute->setIcon( getThemeIcon( "/mActionNewAttribute.png" ) );
   mRemoveAttribute->setIcon( getThemeIcon( "/mActionDeleteAttribute.png" ) );
 
   // toggle editing
   bool canChangeAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues;
+  bool canDeleteFeatures = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteFeatures;
   bool canAddAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes;
   bool canDeleteAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteAttributes;
   mToggleEditingButton->setCheckable( true );
   mToggleEditingButton->setChecked( mLayer->isEditable() );
   mToggleEditingButton->setEnabled( canChangeAttributes );
   mOpenFieldCalculator->setEnabled( canChangeAttributes && mLayer->isEditable() );
+  mDeleteSelectedButton->setEnabled( canDeleteFeatures && mLayer->isEditable() );
   mAddAttribute->setEnabled( canAddAttributes && mLayer->isEditable() );
   mRemoveAttribute->setEnabled( canDeleteAttributes && mLayer->isEditable() );
 
@@ -230,6 +233,11 @@
   mLayer->removeSelection();
 }
 
+void QgsAttributeTableDialog::on_mDeleteSelectedButton_clicked()
+{
+  mLayer->deleteSelectedFeatures();
+}
+
 void QgsAttributeTableDialog::on_cbxShowSelectedOnly_toggled( bool theFlag )
 {
   mFilterModel->setHideUnselected( theFlag );
@@ -615,9 +623,11 @@
   mToggleEditingButton->blockSignals( false );
 
   bool canChangeAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues;
+  bool canDeleteFeatures = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteFeatures;
   bool canAddAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes;
   bool canDeleteAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteAttributes;
   mOpenFieldCalculator->setEnabled( canChangeAttributes && mLayer->isEditable() );
+  mDeleteSelectedButton->setEnabled( canDeleteFeatures && mLayer->isEditable() );
   mAddAttribute->setEnabled( canAddAttributes && mLayer->isEditable() );
   mRemoveAttribute->setEnabled( canDeleteAttributes && mLayer->isEditable() );
 

Modified: trunk/qgis/src/app/attributetable/qgsattributetabledialog.h
===================================================================
--- trunk/qgis/src/app/attributetable/qgsattributetabledialog.h	2009-12-08 23:33:09 UTC (rev 12377)
+++ trunk/qgis/src/app/attributetable/qgsattributetabledialog.h	2009-12-08 23:59:12 UTC (rev 12378)
@@ -145,6 +145,11 @@
      */
     void on_mOpenFieldCalculator_clicked();
 
+    /**
+     * deletes the selected features
+     */
+    void on_mDeleteSelectedButton_clicked();
+
   signals:
     /**
      * Informs that editing mode ha been toggled

Modified: trunk/qgis/src/ui/qgsattributetabledialog.ui
===================================================================
--- trunk/qgis/src/ui/qgsattributetabledialog.ui	2009-12-08 23:33:09 UTC (rev 12377)
+++ trunk/qgis/src/ui/qgsattributetabledialog.ui	2009-12-08 23:59:12 UTC (rev 12378)
@@ -21,6 +21,57 @@
      </property>
     </widget>
    </item>
+   <item row="2" column="0">
+    <layout class="QHBoxLayout">
+     <item>
+      <widget class="QCheckBox" name="cbxShowSelectedOnly">
+       <property name="text">
+        <string>Show selected records only</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QCheckBox" name="cbxSearchSelectedOnly">
+       <property name="text">
+        <string>Search selected records only</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Advanced search</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QToolButton" name="mAdvancedSearchButton">
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="iconSize">
+        <size>
+         <width>12</width>
+         <height>12</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
    <item row="1" column="0">
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
@@ -171,6 +222,17 @@
       </widget>
      </item>
      <item>
+      <widget class="QToolButton" name="mDeleteSelectedButton">
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="icon">
+        <iconset>
+         <normaloff>../../images/themes/default/mActionDeleteSelected.png</normaloff>../../images/themes/default/mActionDeleteSelected.png</iconset>
+       </property>
+      </widget>
+     </item>
+     <item>
       <widget class="QToolButton" name="mAddAttribute">
        <property name="toolTip">
         <string>New column</string>
@@ -259,57 +321,6 @@
      </item>
     </layout>
    </item>
-   <item row="2" column="0">
-    <layout class="QHBoxLayout">
-     <item>
-      <widget class="QCheckBox" name="cbxShowSelectedOnly">
-       <property name="text">
-        <string>Show selected records only</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QCheckBox" name="cbxSearchSelectedOnly">
-       <property name="text">
-        <string>Search selected records only</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer>
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>Advanced search</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QToolButton" name="mAdvancedSearchButton">
-       <property name="text">
-        <string>...</string>
-       </property>
-       <property name="iconSize">
-        <size>
-         <width>12</width>
-         <height>12</height>
-        </size>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
   </layout>
  </widget>
  <customwidgets>



More information about the QGIS-commit mailing list