mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-10 00:04:23 -04:00
Use QgsSettingsEntry for the settings of classes inheriting qgsabstractdbsourceselect
This commit is contained in:
parent
28d6088961
commit
ae73aa7db1
@ -26,6 +26,7 @@ Base class for database source widget selectors.
|
|||||||
static const QgsSettingsEntryInteger *settingSearchColumn;
|
static const QgsSettingsEntryInteger *settingSearchColumn;
|
||||||
static const QgsSettingsEntryBool *settingSearchRegex;
|
static const QgsSettingsEntryBool *settingSearchRegex;
|
||||||
static const QgsSettingsEntryBool *settingHoldDialogOpen;
|
static const QgsSettingsEntryBool *settingHoldDialogOpen;
|
||||||
|
static const QgsSettingsEntryInteger *settingColumnWidths;
|
||||||
|
|
||||||
QgsAbstractDbSourceSelect( QWidget *parent = 0, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Standalone );
|
QgsAbstractDbSourceSelect( QWidget *parent = 0, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Standalone );
|
||||||
%Docstring
|
%Docstring
|
||||||
|
@ -26,6 +26,7 @@ Base class for database source widget selectors.
|
|||||||
static const QgsSettingsEntryInteger *settingSearchColumn;
|
static const QgsSettingsEntryInteger *settingSearchColumn;
|
||||||
static const QgsSettingsEntryBool *settingSearchRegex;
|
static const QgsSettingsEntryBool *settingSearchRegex;
|
||||||
static const QgsSettingsEntryBool *settingHoldDialogOpen;
|
static const QgsSettingsEntryBool *settingHoldDialogOpen;
|
||||||
|
static const QgsSettingsEntryInteger *settingColumnWidths;
|
||||||
|
|
||||||
QgsAbstractDbSourceSelect( QWidget *parent = 0, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Standalone );
|
QgsAbstractDbSourceSelect( QWidget *parent = 0, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Standalone );
|
||||||
%Docstring
|
%Docstring
|
||||||
|
@ -51,8 +51,7 @@ QgsOgrDbSourceSelect::QgsOgrDbSourceSelect( const QString &theSettingsKey, const
|
|||||||
setupButtons( buttonBox );
|
setupButtons( buttonBox );
|
||||||
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsOgrDbSourceSelect::showHelp );
|
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsOgrDbSourceSelect::showHelp );
|
||||||
|
|
||||||
QgsSettings settings;
|
mHoldDialogOpen->setChecked( settingHoldDialogOpen->value( { SETTINGS_WINDOWS_PATH.arg( mOgrDriverName ) } ) );
|
||||||
mHoldDialogOpen->setChecked( settings.value( QStringLiteral( "%1HoldDialogOpen" ).arg( SETTINGS_WINDOWS_PATH.arg( mOgrDriverName ) ), false, QgsSettings::Section::Providers ).toBool() );
|
|
||||||
|
|
||||||
setWindowTitle( tr( "Add %1 Layer(s)" ).arg( name() ) );
|
setWindowTitle( tr( "Add %1 Layer(s)" ).arg( name() ) );
|
||||||
btnEdit->hide(); // hide the edit button
|
btnEdit->hide(); // hide the edit button
|
||||||
@ -76,8 +75,7 @@ QgsOgrDbSourceSelect::QgsOgrDbSourceSelect( const QString &theSettingsKey, const
|
|||||||
|
|
||||||
QgsOgrDbSourceSelect::~QgsOgrDbSourceSelect()
|
QgsOgrDbSourceSelect::~QgsOgrDbSourceSelect()
|
||||||
{
|
{
|
||||||
QgsSettings settings;
|
settingHoldDialogOpen->setValue( mHoldDialogOpen->isChecked(), { SETTINGS_WINDOWS_PATH.arg( mOgrDriverName ) } );
|
||||||
settings.setValue( QStringLiteral( "%1HoldDialogOpen" ).arg( SETTINGS_WINDOWS_PATH.arg( mOgrDriverName ) ), mHoldDialogOpen->isChecked(), QgsSettings::Section::Providers );
|
|
||||||
//store general settings in base class
|
//store general settings in base class
|
||||||
storeSettings();
|
storeSettings();
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,10 @@
|
|||||||
#include <QItemDelegate>
|
#include <QItemDelegate>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
|
|
||||||
const QgsSettingsEntryInteger *QgsAbstractDbSourceSelect::settingSearchColumn = new QgsSettingsEntryInteger( QStringLiteral( "%searchColumn" ), QgsSettingsTree::sTreeWindowState, -1 );
|
const QgsSettingsEntryInteger *QgsAbstractDbSourceSelect::settingSearchColumn = new QgsSettingsEntryInteger( QStringLiteral( "%1searchColumn" ), QgsSettingsTree::sTreeWindowState, -1 );
|
||||||
const QgsSettingsEntryBool *QgsAbstractDbSourceSelect::settingSearchRegex = new QgsSettingsEntryBool( QStringLiteral( "%searchRegex" ), QgsSettingsTree::sTreeWindowState );
|
const QgsSettingsEntryBool *QgsAbstractDbSourceSelect::settingSearchRegex = new QgsSettingsEntryBool( QStringLiteral( "%1searchRegex" ), QgsSettingsTree::sTreeWindowState );
|
||||||
const QgsSettingsEntryBool *QgsAbstractDbSourceSelect::settingHoldDialogOpen = new QgsSettingsEntryBool( QStringLiteral( "%holdDialogOpen" ), QgsSettingsTree::sTreeWindowState );
|
const QgsSettingsEntryBool *QgsAbstractDbSourceSelect::settingHoldDialogOpen = new QgsSettingsEntryBool( QStringLiteral( "%1holdDialogOpen" ), QgsSettingsTree::sTreeWindowState );
|
||||||
|
const QgsSettingsEntryInteger *QgsAbstractDbSourceSelect::settingColumnWidths = new QgsSettingsEntryInteger( QStringLiteral( "%1columnWidths/%2" ), QgsSettingsTree::sTreeWindowState );
|
||||||
|
|
||||||
QgsAbstractDbSourceSelect::QgsAbstractDbSourceSelect( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
QgsAbstractDbSourceSelect::QgsAbstractDbSourceSelect( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
|
||||||
: QgsAbstractDataSourceWidget( parent, fl, widgetMode )
|
: QgsAbstractDataSourceWidget( parent, fl, widgetMode )
|
||||||
|
@ -39,6 +39,7 @@ class GUI_EXPORT QgsAbstractDbSourceSelect : public QgsAbstractDataSourceWidget,
|
|||||||
static const QgsSettingsEntryInteger *settingSearchColumn;
|
static const QgsSettingsEntryInteger *settingSearchColumn;
|
||||||
static const QgsSettingsEntryBool *settingSearchRegex;
|
static const QgsSettingsEntryBool *settingSearchRegex;
|
||||||
static const QgsSettingsEntryBool *settingHoldDialogOpen;
|
static const QgsSettingsEntryBool *settingHoldDialogOpen;
|
||||||
|
static const QgsSettingsEntryInteger *settingColumnWidths;
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
QgsAbstractDbSourceSelect( QWidget *parent = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Standalone );
|
QgsAbstractDbSourceSelect( QWidget *parent = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Standalone );
|
||||||
|
@ -177,11 +177,14 @@ QgsMssqlSourceSelect::QgsMssqlSourceSelect( QWidget *parent, Qt::WindowFlags fl,
|
|||||||
const QgsSettings settings;
|
const QgsSettings settings;
|
||||||
mTablesTreeView->setSelectionMode( QAbstractItemView::ExtendedSelection );
|
mTablesTreeView->setSelectionMode( QAbstractItemView::ExtendedSelection );
|
||||||
|
|
||||||
mHoldDialogOpen->setChecked( settings.value( QStringLiteral( "%1HoldDialogOpen" ).arg( SETTINGS_WINDOWS_PATH ), false ).toBool() );
|
mHoldDialogOpen->setChecked( settingHoldDialogOpen->value( { SETTINGS_WINDOWS_PATH } ) );
|
||||||
|
|
||||||
for ( int i = 0; i < mTableModel->columnCount(); i++ )
|
for ( int i = 0; i < mTableModel->columnCount(); i++ )
|
||||||
{
|
{
|
||||||
mTablesTreeView->setColumnWidth( i, settings.value( QStringLiteral( "%1columnWidths/%2" ).arg( SETTINGS_WINDOWS_PATH, i ), mTablesTreeView->columnWidth( i ) ).toInt() );
|
if ( settingColumnWidths->value( { SETTINGS_WINDOWS_PATH, QString::number( i ) } ) > 0 )
|
||||||
|
{
|
||||||
|
mTablesTreeView->setColumnWidth( i, settingColumnWidths->value( { SETTINGS_WINDOWS_PATH, QString::number( i ) } ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cbxAllowGeometrylessTables->setDisabled( true );
|
cbxAllowGeometrylessTables->setDisabled( true );
|
||||||
@ -285,12 +288,12 @@ QgsMssqlSourceSelect::~QgsMssqlSourceSelect()
|
|||||||
mColumnTypeThread->wait();
|
mColumnTypeThread->wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsSettings settings;
|
settingHoldDialogOpen->setValue( mHoldDialogOpen->isChecked(), { SETTINGS_WINDOWS_PATH } );
|
||||||
settings.setValue( QStringLiteral( "%1HoldDialogOpen" ).arg( SETTINGS_WINDOWS_PATH ), mHoldDialogOpen->isChecked() );
|
|
||||||
|
|
||||||
|
QgsSettings settings;
|
||||||
for ( int i = 0; i < mTableModel->columnCount(); i++ )
|
for ( int i = 0; i < mTableModel->columnCount(); i++ )
|
||||||
{
|
{
|
||||||
settings.setValue( QStringLiteral( "%1columnWidths/%2" ).arg( SETTINGS_WINDOWS_PATH, i ), mTablesTreeView->columnWidth( i ) );
|
settingColumnWidths->setValue( mTablesTreeView->columnWidth( i ), { SETTINGS_WINDOWS_PATH, QString::number( i ) } );
|
||||||
}
|
}
|
||||||
//store general settings in base class
|
//store general settings in base class
|
||||||
storeSettings();
|
storeSettings();
|
||||||
|
@ -232,11 +232,15 @@ QgsPgSourceSelect::QgsPgSourceSelect( QWidget *parent, Qt::WindowFlags fl, QgsPr
|
|||||||
mTablesTreeView->setSelectionMode( QAbstractItemView::ExtendedSelection );
|
mTablesTreeView->setSelectionMode( QAbstractItemView::ExtendedSelection );
|
||||||
|
|
||||||
QgsSettings settings;
|
QgsSettings settings;
|
||||||
mHoldDialogOpen->setChecked( settings.value( QStringLiteral( "%1HoldDialogOpen" ).arg( SETTINGS_WINDOWS_PATH ), false ).toBool() );
|
|
||||||
|
mHoldDialogOpen->setChecked( settingHoldDialogOpen->value( { SETTINGS_WINDOWS_PATH } ) );
|
||||||
|
|
||||||
for ( int i = 0; i < mTableModel->columnCount(); i++ )
|
for ( int i = 0; i < mTableModel->columnCount(); i++ )
|
||||||
{
|
{
|
||||||
mTablesTreeView->setColumnWidth( i, settings.value( QStringLiteral( "%1columnWidths/%2" ).arg( SETTINGS_WINDOWS_PATH, i ), mTablesTreeView->columnWidth( i ) ).toInt() );
|
if ( settingColumnWidths->value( { SETTINGS_WINDOWS_PATH, QString::number( i ) } ) > 0 )
|
||||||
|
{
|
||||||
|
mTablesTreeView->setColumnWidth( i, settingColumnWidths->value( { SETTINGS_WINDOWS_PATH, QString::number( i ) } ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,12 +335,10 @@ QgsPgSourceSelect::~QgsPgSourceSelect()
|
|||||||
finishList();
|
finishList();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsSettings settings;
|
settingHoldDialogOpen->setValue( mHoldDialogOpen->isChecked(), { SETTINGS_WINDOWS_PATH } );
|
||||||
settings.setValue( QStringLiteral( "%1HoldDialogOpen" ).arg( SETTINGS_WINDOWS_PATH ), mHoldDialogOpen->isChecked() );
|
|
||||||
|
|
||||||
for ( int i = 0; i < mTableModel->columnCount(); i++ )
|
for ( int i = 0; i < mTableModel->columnCount(); i++ )
|
||||||
{
|
{
|
||||||
settings.setValue( QStringLiteral( "%1columnWidths/%1" ).arg( SETTINGS_WINDOWS_PATH, i ), mTablesTreeView->columnWidth( i ) );
|
settingColumnWidths->setValue( mTablesTreeView->columnWidth( i ), { SETTINGS_WINDOWS_PATH, QString::number( i ) } );
|
||||||
}
|
}
|
||||||
//store general settings in base class
|
//store general settings in base class
|
||||||
storeSettings();
|
storeSettings();
|
||||||
|
@ -59,8 +59,7 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QWidget *parent, Qt::Windo
|
|||||||
setupButtons( buttonBox );
|
setupButtons( buttonBox );
|
||||||
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsSpatiaLiteSourceSelect::showHelp );
|
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsSpatiaLiteSourceSelect::showHelp );
|
||||||
|
|
||||||
const QgsSettings settings;
|
mHoldDialogOpen->setChecked( settingHoldDialogOpen->value( { SETTINGS_WINDOWS_PATH } ) );
|
||||||
mHoldDialogOpen->setChecked( settings.value( QStringLiteral( "%1HoldDialogOpen" ).arg( SETTINGS_WINDOWS_PATH ), false ).toBool() );
|
|
||||||
|
|
||||||
setWindowTitle( tr( "Add SpatiaLite Layer(s)" ) );
|
setWindowTitle( tr( "Add SpatiaLite Layer(s)" ) );
|
||||||
btnEdit->hide(); // hide the edit button
|
btnEdit->hide(); // hide the edit button
|
||||||
@ -90,8 +89,7 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QWidget *parent, Qt::Windo
|
|||||||
|
|
||||||
QgsSpatiaLiteSourceSelect::~QgsSpatiaLiteSourceSelect()
|
QgsSpatiaLiteSourceSelect::~QgsSpatiaLiteSourceSelect()
|
||||||
{
|
{
|
||||||
QgsSettings settings;
|
settingHoldDialogOpen->setValue( mHoldDialogOpen->isChecked(), { SETTINGS_WINDOWS_PATH } );
|
||||||
settings.setValue( QStringLiteral( "%1HoldDialogOpen" ).arg( SETTINGS_WINDOWS_PATH ), mHoldDialogOpen->isChecked() );
|
|
||||||
//store general settings in base class
|
//store general settings in base class
|
||||||
storeSettings();
|
storeSettings();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user