Skip to content
Permalink
Browse files

geometry less features: update add feature tool in digitizing toolbar…

… and icon in attribute table (fixes #8262)
  • Loading branch information
jef-n committed Feb 13, 2014
1 parent 588d5f4 commit dae8ea66a169db7539a08dc81d2ebe9dab789f37
@@ -147,6 +147,7 @@
<file>themes/default/mActionCaptureLine.png</file>
<file>themes/default/mActionCapturePoint.png</file>
<file>themes/default/mActionCapturePolygon.png</file>
<file>themes/default/mActionNewTableRow.png</file>
<file>themes/default/mActionChangeLabelProperties.png</file>
<file>themes/default/mActionCheckQgisVersion.png</file>
<file>themes/default/mActionCollapseTree.png</file>
Binary file not shown.
@@ -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 ) );

@@ -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;
@@ -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<QgsVectorLayer *>( mCanvas->currentLayer() );
if ( vlayer && vlayer->geometryType() == QGis::NoGeometry )
{
QgsFeature f;
addFeature( vlayer, &f );
return;
}

QgsMapTool::activate();
}

void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
{
QgsDebugMsg( "entered." );
@@ -26,4 +26,5 @@ class APP_EXPORT QgsMapToolAddFeature : public QgsMapToolCapture
void canvasReleaseEvent( QMouseEvent * e );

bool addFeature( QgsVectorLayer *vlayer, QgsFeature *f );
void activate();
};
@@ -105,7 +105,13 @@
<string>Add feature</string>
</property>
<property name="text">
<string>+</string>
<string/>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>

0 comments on commit dae8ea6

Please sign in to comment.
You can’t perform that action at this time.