diff --git a/images/images.qrc b/images/images.qrc index 5463dc3b1e7..4d5eaad2931 100644 --- a/images/images.qrc +++ b/images/images.qrc @@ -147,6 +147,7 @@ themes/default/mActionCaptureLine.png themes/default/mActionCapturePoint.png themes/default/mActionCapturePolygon.png + themes/default/mActionNewTableRow.png themes/default/mActionChangeLabelProperties.png themes/default/mActionCheckQgisVersion.png themes/default/mActionCollapseTree.png diff --git a/images/themes/default/mActionNewTableRow.png b/images/themes/default/mActionNewTableRow.png new file mode 100644 index 00000000000..5544ad9dfac Binary files /dev/null and b/images/themes/default/mActionNewTableRow.png differ diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index bde3cb9fe0a..616280a6042 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -8701,6 +8701,10 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer ) mActionDeleteRing->setEnabled( isEditable && canChangeGeometry ); mActionOffsetCurve->setEnabled( false ); } + else if ( vlayer->geometryType() == QGis::NoGeometry ) + { + mActionAddFeature->setIcon( QgsApplication::getThemeIcon( "/mActionNewTableRow.png" ) ); + } mActionOpenFieldCalc->setEnabled( isEditable && ( canChangeAttributes || canAddAttributes ) ); diff --git a/src/app/qgsattributetabledialog.cpp b/src/app/qgsattributetabledialog.cpp index fbbf73b705f..83bbca706b8 100644 --- a/src/app/qgsattributetabledialog.cpp +++ b/src/app/qgsattributetabledialog.cpp @@ -154,6 +154,7 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid mTableViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTable.png" ) ); mAttributeViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionPropertyItem.png" ) ); mExpressionSelectButton->setIcon( QgsApplication::getThemeIcon( "/mIconExpressionSelect.svg" ) ); + mAddFeature->setIcon( QgsApplication::getThemeIcon( "/mActionNewTableRow.png" ) ); // toggle editing bool canChangeAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues; diff --git a/src/app/qgsmaptooladdfeature.cpp b/src/app/qgsmaptooladdfeature.cpp index 89e95d63cd3..df444e43de8 100644 --- a/src/app/qgsmaptooladdfeature.cpp +++ b/src/app/qgsmaptooladdfeature.cpp @@ -45,6 +45,24 @@ bool QgsMapToolAddFeature::addFeature( QgsVectorLayer *vlayer, QgsFeature *f ) return action.addFeature(); } +void QgsMapToolAddFeature::activate() +{ + if ( !mCanvas || mCanvas->isDrawing() ) + { + return; + } + + QgsVectorLayer *vlayer = qobject_cast( mCanvas->currentLayer() ); + if ( vlayer && vlayer->geometryType() == QGis::NoGeometry ) + { + QgsFeature f; + addFeature( vlayer, &f ); + return; + } + + QgsMapTool::activate(); +} + void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e ) { QgsDebugMsg( "entered." ); diff --git a/src/app/qgsmaptooladdfeature.h b/src/app/qgsmaptooladdfeature.h index 21ba5d82ef6..cc778c4c1e4 100644 --- a/src/app/qgsmaptooladdfeature.h +++ b/src/app/qgsmaptooladdfeature.h @@ -26,4 +26,5 @@ class APP_EXPORT QgsMapToolAddFeature : public QgsMapToolCapture void canvasReleaseEvent( QMouseEvent * e ); bool addFeature( QgsVectorLayer *vlayer, QgsFeature *f ); + void activate(); }; diff --git a/src/ui/qgsattributetabledialog.ui b/src/ui/qgsattributetabledialog.ui index 6dc714a4669..649383ddf2f 100644 --- a/src/ui/qgsattributetabledialog.ui +++ b/src/ui/qgsattributetabledialog.ui @@ -105,7 +105,13 @@ Add feature - + + + + + + 18 + 18 +