Skip to content
Permalink
Browse files

database source select: 'move build query' to button box

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15283 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Feb 28, 2011
1 parent 7e4cc50 commit b183477cc5fe19bc7057e2808558e657ec82da2a
@@ -47,6 +47,11 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QgisApp * app, Qt::WFlags
connectionsGroupBox->setTitle( tr( "Databases" ) );
btnEdit->hide(); // hide the edit button

mBuildQueryButton = new QPushButton( tr( "&Build Query" ) );
buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole );
connect( mBuildQueryButton, SIGNAL( clicked() ), this, SLOT( buildQuery() ) );
mBuildQueryButton->setEnabled( false );

mAddButton = new QPushButton( tr( "&Add" ) );
buttonBox->addButton( mAddButton, QDialogButtonBox::ActionRole );
connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addClicked() ) );
@@ -101,14 +106,14 @@ void QgsSpatiaLiteSourceSelect::on_cmbConnections_activated( int )
dbChanged();
}

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

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

void QgsSpatiaLiteSourceSelect::on_mTablesTreeView_doubleClicked( const QModelIndex &index )
@@ -76,10 +76,10 @@ class QgsSpatiaLiteSourceSelect: public QDialog, private Ui::QgsDbSourceSelectBa
* Once connected, available layers are displayed.
*/
void on_btnConnect_clicked();
void buildQuery();
void addClicked();
//! Opens the create connection dialog to build a new connection
void on_btnNew_clicked();
void on_btnBuildQuery_clicked();
//! Deletes the selected connection
void on_btnDelete_clicked();
void on_mSearchTableEdit_textChanged( const QString & text );
@@ -151,6 +151,7 @@ class QgsSpatiaLiteSourceSelect: public QDialog, private Ui::QgsDbSourceSelectBa
QgsDbFilterProxyModel mProxyModel;

QString layerURI( const QModelIndex &index );
QPushButton *mBuildQueryButton;
QPushButton *mAddButton;
};

@@ -59,6 +59,11 @@ SaSourceSelect::SaSourceSelect( QWidget *parent, Qt::WFlags fl )
{
setupUi( this );

mBuildQueryButton = new QPushButton( tr( "&Build Query" ) );
buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole );
connect( mBuildQueryButton, SIGNAL( clicked() ), this, SLOT( buildQuery() ) );
mBuildQueryButton->setEnabled( false );

mAddButton = new QPushButton( tr( "&Add" ) );
buttonBox->addButton( mAddButton, QDialogButtonBox::ActionRole );
connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addTables() ) );
@@ -168,7 +173,7 @@ void SaSourceSelect::on_cmbConnections_activated( int )
settings.setValue( "/SQLAnywhere/connections/selected", cmbConnections->currentText() );
}

void SaSourceSelect::on_btnBuildQuery_clicked()
void SaSourceSelect::buildQuery()
{
setSql( mTablesTreeView->currentIndex() );
}
@@ -114,6 +114,7 @@ class SaSourceSelect : public QDialog, private Ui::SaSourceSelectBase
public slots:
//! Determines the tables the user selected and closes the dialog
void addTables();
void buildQuery();

/*! Connects to the database using the stored connection parameters.
* Once connected, available layers are displayed.
@@ -123,7 +124,6 @@ class SaSourceSelect : public QDialog, private Ui::SaSourceSelectBase
void on_btnNew_clicked();
//! Opens a dialog to edit an existing connection
void on_btnEdit_clicked();
void on_btnBuildQuery_clicked();
//! Deletes the selected connection
void on_btnDelete_clicked();
void on_mSearchTableEdit_textChanged( const QString & text );
@@ -183,6 +183,9 @@ class SaSourceSelect : public QDialog, private Ui::SaSourceSelectBase
SaDbTableModel mTableModel;
SaDbFilterProxyModel mProxyModel;

// button for building queries
QPushButton *mBuildQueryButton;

// button for adding layers
QPushButton *mAddButton;
};
@@ -83,16 +83,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBuildQuery">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Build query</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mSearchGroupBox">
<property name="title">

0 comments on commit b183477

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