Skip to content

Commit

Permalink
geometry less features: update add feature tool in digitizing toolbar…
Browse files Browse the repository at this point in the history
… and icon in attribute table (fixes #8262)
  • Loading branch information
jef-n committed Feb 13, 2014
1 parent 588d5f4 commit dae8ea6
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions images/images.qrc
Expand Up @@ -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>
Expand Down
Binary file added images/themes/default/mActionNewTableRow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -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 ) );

Expand Down
1 change: 1 addition & 0 deletions src/app/qgsattributetabledialog.cpp
Expand Up @@ -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;
Expand Down
18 changes: 18 additions & 0 deletions src/app/qgsmaptooladdfeature.cpp
Expand Up @@ -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." );
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsmaptooladdfeature.h
Expand Up @@ -26,4 +26,5 @@ class APP_EXPORT QgsMapToolAddFeature : public QgsMapToolCapture
void canvasReleaseEvent( QMouseEvent * e );

bool addFeature( QgsVectorLayer *vlayer, QgsFeature *f );
void activate();
};
8 changes: 7 additions & 1 deletion src/ui/qgsattributetabledialog.ui
Expand Up @@ -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>
Expand Down

0 comments on commit dae8ea6

Please sign in to comment.