mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -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" ) ) );
|
mDeleteAttributeButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDeleteAttribute.svg" ) ) );
|
||||||
mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionToggleEditing.svg" ) ) );
|
mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionToggleEditing.svg" ) ) );
|
||||||
mCalculateFieldButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCalculateField.svg" ) ) );
|
mCalculateFieldButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCalculateField.svg" ) ) );
|
||||||
|
mSaveLayerEditsButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSaveAllEdits.svg" ) ) );
|
||||||
|
|
||||||
//button signals
|
//button signals
|
||||||
connect( mToggleEditingButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::toggleEditing );
|
connect( mToggleEditingButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::toggleEditing );
|
||||||
connect( mAddAttributeButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::addAttributeClicked );
|
connect( mAddAttributeButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::addAttributeClicked );
|
||||||
connect( mDeleteAttributeButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::deleteAttributeClicked );
|
connect( mDeleteAttributeButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::deleteAttributeClicked );
|
||||||
connect( mCalculateFieldButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::calculateFieldClicked );
|
connect( mCalculateFieldButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::calculateFieldClicked );
|
||||||
|
connect( mSaveLayerEditsButton, &QAbstractButton::clicked, this, &QgsSourceFieldsProperties::saveLayerEditsClicked );
|
||||||
|
|
||||||
//slots
|
//slots
|
||||||
connect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsSourceFieldsProperties::editingToggled );
|
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 )
|
void QgsSourceFieldsProperties::attributesListCellChanged( int row, int column )
|
||||||
{
|
{
|
||||||
if ( column == AttrNameCol && mLayer && mLayer->isEditable() )
|
if ( column == AttrNameCol && mLayer && mLayer->isEditable() )
|
||||||
@ -429,11 +436,14 @@ void QgsSourceFieldsProperties::updateButtons()
|
|||||||
mDeleteAttributeButton->setEnabled( cap & Qgis::VectorProviderCapability::DeleteAttributes );
|
mDeleteAttributeButton->setEnabled( cap & Qgis::VectorProviderCapability::DeleteAttributes );
|
||||||
mAddAttributeButton->setEnabled( cap & Qgis::VectorProviderCapability::AddAttributes );
|
mAddAttributeButton->setEnabled( cap & Qgis::VectorProviderCapability::AddAttributes );
|
||||||
mToggleEditingButton->setChecked( true );
|
mToggleEditingButton->setChecked( true );
|
||||||
|
mSaveLayerEditsButton->setEnabled( true );
|
||||||
|
mSaveLayerEditsButton->setChecked( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mToggleEditingButton->setChecked( false );
|
mToggleEditingButton->setChecked( false );
|
||||||
mAddAttributeButton->setEnabled( false );
|
mAddAttributeButton->setEnabled( false );
|
||||||
|
mSaveLayerEditsButton->setEnabled( false );
|
||||||
|
|
||||||
// Enable delete button if items are selected
|
// Enable delete button if items are selected
|
||||||
mDeleteAttributeButton->setEnabled( !mFieldsList->selectedItems().isEmpty() );
|
mDeleteAttributeButton->setEnabled( !mFieldsList->selectedItems().isEmpty() );
|
||||||
|
@ -104,6 +104,7 @@ class GUI_EXPORT QgsSourceFieldsProperties : public QWidget, private Ui_QgsSourc
|
|||||||
void addAttributeClicked();
|
void addAttributeClicked();
|
||||||
void deleteAttributeClicked();
|
void deleteAttributeClicked();
|
||||||
void calculateFieldClicked();
|
void calculateFieldClicked();
|
||||||
|
void saveLayerEditsClicked();
|
||||||
|
|
||||||
void attributeAdded( int idx );
|
void attributeAdded( int idx );
|
||||||
void attributeDeleted( int idx );
|
void attributeDeleted( int idx );
|
||||||
|
@ -23,26 +23,23 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="4">
|
<item row="0" column="4">
|
||||||
<spacer name="horizontalSpacer_2">
|
<widget class="QToolButton" name="mCalculateFieldButton">
|
||||||
<property name="orientation">
|
<property name="toolTip">
|
||||||
<enum>Qt::Horizontal</enum>
|
<string>Field calculator</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="text">
|
||||||
<size>
|
<string/>
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QToolButton" name="mToggleEditingButton">
|
<widget class="QToolButton" name="mToggleEditingButton">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Toggle editing mode</string>
|
<string>Toggle editing mode</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="whatsThis">
|
|
||||||
<string>Click to toggle table editing</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -51,6 +48,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="0" column="0">
|
||||||
<widget class="QToolButton" name="mAddAttributeButton">
|
<widget class="QToolButton" name="mAddAttributeButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -65,39 +75,28 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</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">
|
<property name="shortcut">
|
||||||
<string>Ctrl+N</string>
|
<string>Ctrl+N</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="6">
|
||||||
<widget class="QToolButton" name="mDeleteAttributeButton">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="toolTip">
|
<property name="orientation">
|
||||||
<string>Delete field</string>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="sizeHint" stdset="0">
|
||||||
<string/>
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
</spacer>
|
||||||
<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>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3">
|
<item row="0" column="3">
|
||||||
<widget class="QToolButton" name="mCalculateFieldButton">
|
<widget class="QToolButton" name="mSaveLayerEditsButton">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Field calculator</string>
|
<string>Save Layer Edits</string>
|
||||||
</property>
|
|
||||||
<property name="whatsThis">
|
|
||||||
<string>Click to toggle table editing</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
@ -116,6 +115,7 @@
|
|||||||
<tabstop>mAddAttributeButton</tabstop>
|
<tabstop>mAddAttributeButton</tabstop>
|
||||||
<tabstop>mDeleteAttributeButton</tabstop>
|
<tabstop>mDeleteAttributeButton</tabstop>
|
||||||
<tabstop>mToggleEditingButton</tabstop>
|
<tabstop>mToggleEditingButton</tabstop>
|
||||||
|
<tabstop>mSaveLayerEditsButton</tabstop>
|
||||||
<tabstop>mCalculateFieldButton</tabstop>
|
<tabstop>mCalculateFieldButton</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user