Skip to content

Commit dae8ea6

Browse files
committedFeb 13, 2014
geometry less features: update add feature tool in digitizing toolbar and icon in attribute table (fixes #8262)
1 parent 588d5f4 commit dae8ea6

File tree

7 files changed

+32
-1
lines changed

7 files changed

+32
-1
lines changed
 

‎images/images.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
<file>themes/default/mActionCaptureLine.png</file>
148148
<file>themes/default/mActionCapturePoint.png</file>
149149
<file>themes/default/mActionCapturePolygon.png</file>
150+
<file>themes/default/mActionNewTableRow.png</file>
150151
<file>themes/default/mActionChangeLabelProperties.png</file>
151152
<file>themes/default/mActionCheckQgisVersion.png</file>
152153
<file>themes/default/mActionCollapseTree.png</file>
760 Bytes
Loading

‎src/app/qgisapp.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8701,6 +8701,10 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
87018701
mActionDeleteRing->setEnabled( isEditable && canChangeGeometry );
87028702
mActionOffsetCurve->setEnabled( false );
87038703
}
8704+
else if ( vlayer->geometryType() == QGis::NoGeometry )
8705+
{
8706+
mActionAddFeature->setIcon( QgsApplication::getThemeIcon( "/mActionNewTableRow.png" ) );
8707+
}
87048708

87058709
mActionOpenFieldCalc->setEnabled( isEditable && ( canChangeAttributes || canAddAttributes ) );
87068710

‎src/app/qgsattributetabledialog.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
154154
mTableViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTable.png" ) );
155155
mAttributeViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionPropertyItem.png" ) );
156156
mExpressionSelectButton->setIcon( QgsApplication::getThemeIcon( "/mIconExpressionSelect.svg" ) );
157+
mAddFeature->setIcon( QgsApplication::getThemeIcon( "/mActionNewTableRow.png" ) );
157158

158159
// toggle editing
159160
bool canChangeAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues;

‎src/app/qgsmaptooladdfeature.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@ bool QgsMapToolAddFeature::addFeature( QgsVectorLayer *vlayer, QgsFeature *f )
4545
return action.addFeature();
4646
}
4747

48+
void QgsMapToolAddFeature::activate()
49+
{
50+
if ( !mCanvas || mCanvas->isDrawing() )
51+
{
52+
return;
53+
}
54+
55+
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() );
56+
if ( vlayer && vlayer->geometryType() == QGis::NoGeometry )
57+
{
58+
QgsFeature f;
59+
addFeature( vlayer, &f );
60+
return;
61+
}
62+
63+
QgsMapTool::activate();
64+
}
65+
4866
void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
4967
{
5068
QgsDebugMsg( "entered." );

‎src/app/qgsmaptooladdfeature.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ class APP_EXPORT QgsMapToolAddFeature : public QgsMapToolCapture
2626
void canvasReleaseEvent( QMouseEvent * e );
2727

2828
bool addFeature( QgsVectorLayer *vlayer, QgsFeature *f );
29+
void activate();
2930
};

‎src/ui/qgsattributetabledialog.ui

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@
105105
<string>Add feature</string>
106106
</property>
107107
<property name="text">
108-
<string>+</string>
108+
<string/>
109+
</property>
110+
<property name="iconSize">
111+
<size>
112+
<width>18</width>
113+
<height>18</height>
114+
</size>
109115
</property>
110116
</widget>
111117
</item>

0 commit comments

Comments
 (0)
Please sign in to comment.