mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-05 00:09:32 -04:00
Save edits button in fields properties tab (#58564)
* save edits button in fields properties tab * change button order * remove iconset tag, we use theme folder * remove whatsthis and add new button to tabstop
This commit is contained in:
parent
eaa39c4a14
commit
d9fc20b80c
@ -40,12 +40,14 @@ QgsSourceFieldsProperties::QgsSourceFieldsProperties( QgsVectorLayer *layer, QWi
|
||||
mDeleteAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDeleteAttribute.svg" ) ) );
|
||||
mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionToggleEditing.svg" ) ) );
|
||||
mCalculateFieldButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCalculateField.svg" ) ) );
|
||||
mSaveLayerEditsButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSaveAllEdits.svg" ) ) );
|
||||
|
||||
//button signals
|
||||
connect( mToggleEditingButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::toggleEditing );
|
||||
connect( mAddAttributeButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::addAttributeClicked );
|
||||
connect( mDeleteAttributeButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::deleteAttributeClicked );
|
||||
connect( mCalculateFieldButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::calculateFieldClicked );
|
||||
connect( mSaveLayerEditsButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::saveLayerEditsClicked );
|
||||
|
||||
//slots
|
||||
connect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsSourceFieldsProperties::editingToggled );
|
||||
@ -381,6 +383,11 @@ void QgsSourceFieldsProperties::calculateFieldClicked()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsSourceFieldsProperties::saveLayerEditsClicked()
|
||||
{
|
||||
mLayer->commitChanges( false );
|
||||
}
|
||||
|
||||
void QgsSourceFieldsProperties::attributesListCellChanged( int row, int column )
|
||||
{
|
||||
if ( column == AttrNameCol && mLayer && mLayer->isEditable() )
|
||||
@ -429,11 +436,14 @@ void QgsSourceFieldsProperties::updateButtons()
|
||||
mDeleteAttributeButton->setEnabled( cap & Qgis::VectorProviderCapability::DeleteAttributes );
|
||||
mAddAttributeButton->setEnabled( cap & Qgis::VectorProviderCapability::AddAttributes );
|
||||
mToggleEditingButton->setChecked( true );
|
||||
mSaveLayerEditsButton->setEnabled( true );
|
||||
mSaveLayerEditsButton->setChecked( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
mToggleEditingButton->setChecked( false );
|
||||
mAddAttributeButton->setEnabled( false );
|
||||
mSaveLayerEditsButton->setEnabled( false );
|
||||
|
||||
// Enable delete button if items are selected
|
||||
mDeleteAttributeButton->setEnabled( !mFieldsList->selectedItems().isEmpty() );
|
||||
|
@ -104,6 +104,7 @@ class GUI_EXPORT QgsSourceFieldsProperties : public QWidget, private Ui_QgsSourc
|
||||
void addAttributeClicked();
|
||||
void deleteAttributeClicked();
|
||||
void calculateFieldClicked();
|
||||
void saveLayerEditsClicked();
|
||||
|
||||
void attributeAdded( int idx );
|
||||
void attributeDeleted( int idx );
|
||||
|
@ -23,26 +23,23 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="QToolButton" name="mCalculateFieldButton">
|
||||
<property name="toolTip">
|
||||
<string>Field calculator</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</spacer>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="mToggleEditingButton">
|
||||
<property name="toolTip">
|
||||
<string>Toggle editing mode</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Click to toggle table editing</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
@ -51,6 +48,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="mDeleteAttributeButton">
|
||||
<property name="toolTip">
|
||||
<string>Delete field</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QToolButton" name="mAddAttributeButton">
|
||||
<property name="sizePolicy">
|
||||
@ -65,39 +75,28 @@
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>../../../../.designer/backup/.designer/xpm/new_attribute.png</normaloff>../../../../.designer/backup/.designer/xpm/new_attribute.png</iconset>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="mDeleteAttributeButton">
|
||||
<property name="toolTip">
|
||||
<string>Delete field</string>
|
||||
<item row="0" column="6">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>../../../../.designer/backup/.designer/xpm/delete_attribute.png</normaloff>../../../../.designer/backup/.designer/xpm/delete_attribute.png</iconset>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QToolButton" name="mCalculateFieldButton">
|
||||
<widget class="QToolButton" name="mSaveLayerEditsButton">
|
||||
<property name="toolTip">
|
||||
<string>Field calculator</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Click to toggle table editing</string>
|
||||
<string>Save Layer Edits</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -116,6 +115,7 @@
|
||||
<tabstop>mAddAttributeButton</tabstop>
|
||||
<tabstop>mDeleteAttributeButton</tabstop>
|
||||
<tabstop>mToggleEditingButton</tabstop>
|
||||
<tabstop>mSaveLayerEditsButton</tabstop>
|
||||
<tabstop>mCalculateFieldButton</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user