"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/app/qgsattributetabledialog.cpp" between
QGIS-final-3_14_15.tar.gz and QGIS-final-3_14_16.tar.gz

About: QGIS (Quantum GIS) is a Geographic Information System that supports vector, raster, and database formats. Latest release (3.14.x series).

qgsattributetabledialog.cpp  (QGIS-final-3_14_15):qgsattributetabledialog.cpp  (QGIS-final-3_14_16)
skipping to change at line 20 skipping to change at line 20
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
***************************************************************************/ ***************************************************************************/
#include <QMessageBox> #include <QMessageBox>
#include <QGridLayout> #include <QGridLayout>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QMenu>
#include "qgsattributetabledialog.h" #include "qgsattributetabledialog.h"
#include "qgsattributetablemodel.h" #include "qgsattributetablemodel.h"
#include "qgsattributetablefiltermodel.h" #include "qgsattributetablefiltermodel.h"
#include "qgsattributetableview.h" #include "qgsattributetableview.h"
#include "qgsexpressioncontextutils.h" #include "qgsexpressioncontextutils.h"
#include "qgsapplication.h" #include "qgsapplication.h"
#include "qgsvectorlayer.h" #include "qgsvectorlayer.h"
#include "qgsvectorlayerutils.h" #include "qgsvectorlayerutils.h"
skipping to change at line 114 skipping to change at line 115
connect( mActionZoomMapToSelectedRows, &QAction::triggered, this, &QgsAttribut eTableDialog::mActionZoomMapToSelectedRows_triggered ); connect( mActionZoomMapToSelectedRows, &QAction::triggered, this, &QgsAttribut eTableDialog::mActionZoomMapToSelectedRows_triggered );
connect( mActionPanMapToSelectedRows, &QAction::triggered, this, &QgsAttribute TableDialog::mActionPanMapToSelectedRows_triggered ); connect( mActionPanMapToSelectedRows, &QAction::triggered, this, &QgsAttribute TableDialog::mActionPanMapToSelectedRows_triggered );
connect( mActionSelectedToTop, &QAction::toggled, this, &QgsAttributeTableDial og::mActionSelectedToTop_toggled ); connect( mActionSelectedToTop, &QAction::toggled, this, &QgsAttributeTableDial og::mActionSelectedToTop_toggled );
connect( mActionAddAttribute, &QAction::triggered, this, &QgsAttributeTableDia log::mActionAddAttribute_triggered ); connect( mActionAddAttribute, &QAction::triggered, this, &QgsAttributeTableDia log::mActionAddAttribute_triggered );
connect( mActionRemoveAttribute, &QAction::triggered, this, &QgsAttributeTable Dialog::mActionRemoveAttribute_triggered ); connect( mActionRemoveAttribute, &QAction::triggered, this, &QgsAttributeTable Dialog::mActionRemoveAttribute_triggered );
connect( mActionOrganizeColumns, &QAction::triggered, this, &QgsAttributeTable Dialog::mActionOrganizeColumns_triggered ); connect( mActionOrganizeColumns, &QAction::triggered, this, &QgsAttributeTable Dialog::mActionOrganizeColumns_triggered );
connect( mActionOpenFieldCalculator, &QAction::triggered, this, &QgsAttributeT ableDialog::mActionOpenFieldCalculator_triggered ); connect( mActionOpenFieldCalculator, &QAction::triggered, this, &QgsAttributeT ableDialog::mActionOpenFieldCalculator_triggered );
connect( mActionDeleteSelected, &QAction::triggered, this, &QgsAttributeTableD ialog::mActionDeleteSelected_triggered ); connect( mActionDeleteSelected, &QAction::triggered, this, &QgsAttributeTableD ialog::mActionDeleteSelected_triggered );
connect( mMainView, &QgsDualView::currentChanged, this, &QgsAttributeTableDial og::mMainView_currentChanged ); connect( mMainView, &QgsDualView::currentChanged, this, &QgsAttributeTableDial og::mMainView_currentChanged );
connect( mActionAddFeature, &QAction::triggered, this, &QgsAttributeTableDialo g::mActionAddFeature_triggered ); connect( mActionAddFeature, &QAction::triggered, this, &QgsAttributeTableDialo g::mActionAddFeature_triggered );
connect( mActionAddFeatureViaAttributeTable, &QAction::triggered, this, &QgsAt
tributeTableDialog::mActionAddFeatureViaAttributeTable_triggered );
connect( mActionAddFeatureViaAttributeForm, &QAction::triggered, this, &QgsAtt
ributeTableDialog::mActionAddFeatureViaAttributeForm_triggered );
connect( mActionExpressionSelect, &QAction::triggered, this, &QgsAttributeTabl eDialog::mActionExpressionSelect_triggered ); connect( mActionExpressionSelect, &QAction::triggered, this, &QgsAttributeTabl eDialog::mActionExpressionSelect_triggered );
connect( mMainView, &QgsDualView::showContextMenuExternally, this, &QgsAttribu teTableDialog::showContextMenu ); connect( mMainView, &QgsDualView::showContextMenuExternally, this, &QgsAttribu teTableDialog::showContextMenu );
mActionSelectAll->setShortcuts( QKeySequence::SelectAll ); mActionSelectAll->setShortcuts( QKeySequence::SelectAll );
mActionSelectAll->setShortcutContext( Qt::WidgetWithChildrenShortcut ); mActionSelectAll->setShortcutContext( Qt::WidgetWithChildrenShortcut );
mActionCopySelectedRows->setShortcuts( QKeySequence::Copy ); mActionCopySelectedRows->setShortcuts( QKeySequence::Copy );
mActionCopySelectedRows->setShortcutContext( Qt::WidgetWithChildrenShortcut ); mActionCopySelectedRows->setShortcutContext( Qt::WidgetWithChildrenShortcut );
mActionCutSelectedRows->setShortcuts( QKeySequence::Cut ); mActionCutSelectedRows->setShortcuts( QKeySequence::Cut );
mActionCutSelectedRows->setShortcutContext( Qt::WidgetWithChildrenShortcut ); mActionCutSelectedRows->setShortcutContext( Qt::WidgetWithChildrenShortcut );
mActionPasteFeatures->setShortcuts( QKeySequence::Paste ); mActionPasteFeatures->setShortcuts( QKeySequence::Paste );
mActionPasteFeatures->setShortcutContext( Qt::WidgetWithChildrenShortcut ); mActionPasteFeatures->setShortcutContext( Qt::WidgetWithChildrenShortcut );
QgsSettings settings;
mActionAddFeature->setMenu( new QMenu( mActionAddFeature->parentWidget() ) );
mActionAddFeature->menu()->addAction( mActionAddFeatureViaAttributeTable );
mActionAddFeature->menu()->addAction( mActionAddFeatureViaAttributeForm );
mActionAddFeature->setIcon(
settings.value( QStringLiteral( "/qgis/attributeTableLastAddFeatureMethod" )
) == QStringLiteral( "attributeForm" )
? mActionAddFeatureViaAttributeForm->icon()
: mActionAddFeatureViaAttributeTable->icon() );
const QgsFields fields = mLayer->fields(); const QgsFields fields = mLayer->fields();
for ( const QgsField &field : fields ) for ( const QgsField &field : fields )
{ {
mVisibleFields.append( field.name() ); mVisibleFields.append( field.name() );
} }
// Fix selection color on losing focus (Windows) // Fix selection color on losing focus (Windows)
setStyleSheet( QgisApp::instance()->styleSheet() ); setStyleSheet( QgisApp::instance()->styleSheet() );
setAttribute( Qt::WA_DeleteOnClose ); setAttribute( Qt::WA_DeleteOnClose );
layout()->setMargin( 0 ); layout()->setMargin( 0 );
layout()->setContentsMargins( 0, 0, 0, 0 ); layout()->setContentsMargins( 0, 0, 0, 0 );
static_cast< QGridLayout * >( layout() )->setVerticalSpacing( 0 ); static_cast< QGridLayout * >( layout() )->setVerticalSpacing( 0 );
QgsSettings settings;
int size = settings.value( QStringLiteral( "/qgis/iconSize" ), 16 ).toInt(); int size = settings.value( QStringLiteral( "/qgis/iconSize" ), 16 ).toInt();
if ( size > 32 ) if ( size > 32 )
{ {
size -= 16; size -= 16;
} }
else if ( size == 32 ) else if ( size == 32 )
{ {
size = 24; size = 24;
} }
else else
skipping to change at line 589 skipping to change at line 600
QgisApp::instance()->saveEdits( mLayer, true, true ); QgisApp::instance()->saveEdits( mLayer, true, true );
} }
void QgsAttributeTableDialog::mActionReload_triggered() void QgsAttributeTableDialog::mActionReload_triggered()
{ {
mMainView->masterModel()->layer()->dataProvider()->reloadData(); mMainView->masterModel()->layer()->dataProvider()->reloadData();
} }
void QgsAttributeTableDialog::mActionAddFeature_triggered() void QgsAttributeTableDialog::mActionAddFeature_triggered()
{ {
QgsSettings s;
if ( s.value( QStringLiteral( "/qgis/attributeTableLastAddFeatureMethod" ) ) =
= QStringLiteral( "attributeForm" ) )
mActionAddFeatureViaAttributeForm_triggered();
else
mActionAddFeatureViaAttributeTable_triggered();
}
void QgsAttributeTableDialog::mActionAddFeatureViaAttributeTable_triggered()
{
if ( !mLayer->isEditable() ) if ( !mLayer->isEditable() )
return; return;
QgsSettings s;
s.setValue( QStringLiteral( "/qgis/attributeTableLastAddFeatureMethod" ), QStr
ingLiteral( "attributeTable" ) );
mActionAddFeature->setIcon( mActionAddFeatureViaAttributeTable->icon() );
QgsAttributeTableModel *masterModel = mMainView->masterModel(); QgsAttributeTableModel *masterModel = mMainView->masterModel();
QgsFeature f; QgsFeature f;
QgsFeatureAction action( tr( "Geometryless feature added" ), f, mLayer, QStrin g(), -1, this ); QgsFeatureAction action( tr( "Geometryless feature added" ), f, mLayer, QStrin g(), -1, this );
action.setForceSuppressFormPopup( true ); // we're already showing the table, allowing users to enter the new feature's attributes directly action.setForceSuppressFormPopup( true ); // we're already showing the table, allowing users to enter the new feature's attributes directly
if ( action.addFeature() ) if ( action.addFeature() )
{ {
masterModel->reload( masterModel->index( 0, 0 ), masterModel->index( masterM odel->rowCount() - 1, masterModel->columnCount() - 1 ) ); masterModel->reload( masterModel->index( 0, 0 ), masterModel->index( masterM odel->rowCount() - 1, masterModel->columnCount() - 1 ) );
mMainView->setCurrentEditSelection( QgsFeatureIds() << action.feature().id()
);
}
}
void QgsAttributeTableDialog::mActionAddFeatureViaAttributeForm_triggered()
{
if ( !mLayer->isEditable() )
return;
QgsSettings s;
s.setValue( QStringLiteral( "/qgis/attributeTableLastAddFeatureMethod" ), QStr
ingLiteral( "attributeForm" ) );
mActionAddFeature->setIcon( mActionAddFeatureViaAttributeForm->icon() );
QgsFeature f;
QgsFeatureAction action( tr( "Feature Added" ), f, mLayer, QString(), -1, this
);
QgsAttributeTableModel *masterModel = mMainView->masterModel();
if ( action.addFeature() )
{
masterModel->reload( masterModel->index( 0, 0 ), masterModel->index( masterM
odel->rowCount() - 1, masterModel->columnCount() - 1 ) );
mMainView->setCurrentEditSelection( QgsFeatureIds() << action.feature().id()
);
} }
} }
void QgsAttributeTableDialog::mActionExpressionSelect_triggered() void QgsAttributeTableDialog::mActionExpressionSelect_triggered()
{ {
QgsExpressionSelectionDialog *dlg = new QgsExpressionSelectionDialog( mLayer ) ; QgsExpressionSelectionDialog *dlg = new QgsExpressionSelectionDialog( mLayer ) ;
dlg->setMessageBar( QgisApp::instance()->messageBar() ); dlg->setMessageBar( QgisApp::instance()->messageBar() );
dlg->setAttribute( Qt::WA_DeleteOnClose ); dlg->setAttribute( Qt::WA_DeleteOnClose );
dlg->show(); dlg->show();
} }
 End of changes. 7 change blocks. 
2 lines changed or deleted 59 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)