Skip to content
Permalink
Browse files

optionally allow adding postgis table addition with double click and …

…extended selection of tables (fixes #1801)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11140 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Jul 21, 2009
1 parent 36a294e commit bf0f39ef5306707bd8f0f71589cb10717e6dcb7d
Showing with 568 additions and 515 deletions.
  1. +28 −1 src/app/qgsdbsourceselect.cpp
  2. +3 −0 src/app/qgsdbsourceselect.h
  3. +3 −1 src/app/qgsoptions.cpp
  4. +111 −98 src/ui/qgsdbsourceselectbase.ui
  5. +423 −415 src/ui/qgsoptionsbase.ui
@@ -67,8 +67,12 @@ QgsDbSourceSelect::QgsDbSourceSelect( QWidget *parent, Qt::WFlags fl )
mTablesTreeView->setModel( &mProxyModel );
mTablesTreeView->setSortingEnabled( true );

QSettings settings;
mTablesTreeView->setSelectionMode( settings.value( "/qgis/addPostgisDC", false ).toBool() ?
QAbstractItemView::ExtendedSelection :
QAbstractItemView::MultiSelection );

mSearchGroupBox->hide();
connect( mTablesTreeView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( setSql( const QModelIndex& ) ) );

//for Qt < 4.3.2, passing -1 to include all model columns
//in search does not seem to work
@@ -110,6 +114,29 @@ void QgsDbSourceSelect::on_cmbConnections_activated( int )
dbChanged();
}

void QgsDbSourceSelect::on_btnBuildQuery_clicked()
{
setSql( mTablesTreeView->currentIndex() );
}

void QgsDbSourceSelect::on_mTablesTreeView_clicked( const QModelIndex &index )
{
btnBuildQuery->setEnabled( index.parent().isValid() );
}

void QgsDbSourceSelect::on_mTablesTreeView_doubleClicked( const QModelIndex &index )
{
QSettings settings;
if ( settings.value( "/qgis/addPostgisDC", false ).toBool() )
{
addTables();
}
else
{
setSql( index );
}
}

void QgsDbSourceSelect::on_mSearchOptionsButton_clicked()
{
if ( mSearchGroupBox->isVisible() )
@@ -85,6 +85,7 @@ class QgsDbSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
void on_btnAdd_clicked();
void on_btnNew_clicked();
void on_btnEdit_clicked();
void on_btnBuildQuery_clicked();
void on_btnDelete_clicked();
void on_mSearchOptionsButton_clicked();
void on_mSearchTableEdit_textChanged( const QString & text );
@@ -95,6 +96,8 @@ class QgsDbSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
void on_cmbConnections_activated( int );
void setLayerType( QString schema, QString table, QString column,
QString type );
void on_mTablesTreeView_clicked( const QModelIndex &index );
void on_mTablesTreeView_doubleClicked( const QModelIndex &index );
//!Sets a new regular expression to the model
void setSearchExpression( const QString& regexp );

@@ -139,6 +139,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
cbxLegendClassifiers->setChecked( settings.value( "/qgis/showLegendClassifiers", false ).toBool() );
cbxHideSplash->setChecked( settings.value( "/qgis/hideSplash", false ).toBool() );
cbxAttributeTableDocked->setChecked( settings.value( "/qgis/dockAttributeTable", false ).toBool() );
cbxAddPostgisDC->setChecked( settings.value( "/qgis/addPostgisDC", false ).toBool() );

//set the colour for selections
int myRed = settings.value( "/qgis/default_selection_color_red", 255 ).toInt();
@@ -218,7 +219,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
mSearchRadiusVertexEditComboBox->setCurrentIndex( settings.value( "/qgis/digitizing/search_radius_vertex_edit_unit", 0 ).toInt() );

//vertex marker
mMarkersOnlyForSelectedCheckBox->setChecked(settings.value( "/qgis/digitizing/marker_only_for_selected", false ).toBool());
mMarkersOnlyForSelectedCheckBox->setChecked( settings.value( "/qgis/digitizing/marker_only_for_selected", false ).toBool() );

mMarkerStyleComboBox->addItem( tr( "Semi transparent circle" ) );
mMarkerStyleComboBox->addItem( tr( "Cross" ) );
@@ -339,6 +340,7 @@ void QgsOptions::saveOptions()
settings.setValue( "/qgis/showLegendClassifiers", cbxLegendClassifiers->isChecked() );
settings.setValue( "/qgis/hideSplash", cbxHideSplash->isChecked() );
settings.setValue( "/qgis/dockAttributeTable", cbxAttributeTableDocked->isChecked() );
settings.setValue( "/qgis/addPostgisDC", cbxAddPostgisDC->isChecked() );
settings.setValue( "/qgis/new_layers_visible", chkAddedVisibility->isChecked() );
settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() );
settings.setValue( "/qgis/use_qimage_to_render", !( chkUseQPixmap->isChecked() ) );

0 comments on commit bf0f39e

Please sign in to comment.
You can’t perform that action at this time.