Skip to content

Commit deffaaf

Browse files
author
jef
committed
fix #3124
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14386 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 2b611d7 commit deffaaf

File tree

2 files changed

+7
-27
lines changed

2 files changed

+7
-27
lines changed

src/app/qgsquerybuilder.cpp

+6-25
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
// connection to the database
2828
QgsQueryBuilder::QgsQueryBuilder( QgsVectorLayer *layer,
2929
QWidget *parent, Qt::WFlags fl )
30-
: QDialog( parent, fl ), mLayer( layer )
30+
: QDialog( parent, fl )
31+
, mLayer( layer )
3132
{
3233
setupUi( this );
33-
connect( buttonBox, SIGNAL( helpRequested() ), this, SLOT( helpClicked() ) );
3434

3535
QPushButton *pbn = new QPushButton( tr( "&Test" ) );
3636
buttonBox->addButton( pbn, QDialogButtonBox::ActionRole );
@@ -91,17 +91,11 @@ void QgsQueryBuilder::setupGuiViews()
9191
lstValues->setAlternatingRowColors( true );
9292
}
9393

94-
void QgsQueryBuilder::fillValues( int idx, QString subsetString, int limit )
94+
void QgsQueryBuilder::fillValues( int idx, int limit )
9595
{
9696
// clear the model
9797
mModelValues->clear();
9898

99-
if ( !mLayer->setSubsetString( subsetString ) )
100-
{
101-
QMessageBox::information( this, tr( "Invalid Query" ), tr( "Setting the query failed" ) );
102-
return;
103-
}
104-
10599
// determine the field type
106100
QList<QVariant> values;
107101
mLayer->dataProvider()->uniqueValues( idx, values, limit );
@@ -122,7 +116,7 @@ void QgsQueryBuilder::on_btnSampleValues_clicked()
122116
QStandardItemModel *tmp = new QStandardItemModel();
123117
lstValues->setModel( tmp );
124118
//Clear and fill the mModelValues
125-
fillValues( mModelFields->data( lstFields->currentIndex(), Qt::UserRole + 1 ).toInt(), mOrigSubsetString, 25 );
119+
fillValues( mModelFields->data( lstFields->currentIndex(), Qt::UserRole + 1 ).toInt(), 25 );
126120
lstValues->setModel( mModelValues );
127121
lstValues->setCursor( Qt::ArrowCursor );
128122
//delete the tmp
@@ -138,7 +132,7 @@ void QgsQueryBuilder::on_btnGetAllValues_clicked()
138132
QStandardItemModel *tmp = new QStandardItemModel();
139133
lstValues->setModel( tmp );
140134
//Clear and fill the mModelValues
141-
fillValues( mModelFields->data( lstFields->currentIndex(), Qt::UserRole + 1 ).toInt(), mOrigSubsetString, -1 );
135+
fillValues( mModelFields->data( lstFields->currentIndex(), Qt::UserRole + 1 ).toInt(), -1 );
142136
lstValues->setModel( mModelValues );
143137
lstValues->setCursor( Qt::ArrowCursor );
144138
//delete the tmp
@@ -151,14 +145,7 @@ void QgsQueryBuilder::test()
151145
// by counting the number of records that would be
152146
// returned
153147

154-
// if there is no sql, issue a warning
155-
if ( txtSQL->toPlainText().isEmpty() )
156-
{
157-
QMessageBox::information( this,
158-
tr( "No Query" ),
159-
tr( "You must create a query before you can test it" ) );
160-
}
161-
else if ( mLayer->setSubsetString( txtSQL->toPlainText() ) )
148+
if ( mLayer->setSubsetString( txtSQL->toPlainText() ) )
162149
{
163150
QMessageBox::information( this,
164151
tr( "Query Result" ),
@@ -172,12 +159,6 @@ void QgsQueryBuilder::test()
172159
}
173160
}
174161

175-
// Slot for showing help
176-
void QgsQueryBuilder::helpClicked()
177-
{
178-
// QgsContextHelp::run( context_id );
179-
}
180-
181162
void QgsQueryBuilder::accept()
182163
{
183164
// if user hits Ok and there is no query, skip the validation

src/app/qgsquerybuilder.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
6868
public slots:
6969
void accept();
7070
void reject();
71-
void helpClicked();
7271
void clear();
7372
void on_btnEqual_clicked();
7473
void on_btnLessThan_clicked();
@@ -124,7 +123,7 @@ class QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
124123
*/
125124
void setupGuiViews();
126125
void setupLstFieldsModel();
127-
void fillValues( int idx, QString subsetString, int limit );
126+
void fillValues( int idx, int limit );
128127

129128
// private members
130129
//! Model for fields ListView

0 commit comments

Comments
 (0)