mirror of
https://github.com/qgis/QGIS.git
synced 2025-06-19 00:02:48 -04:00
fix #3124
git-svn-id: http://svn.osgeo.org/qgis/trunk@14386 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
bb0bcd2bde
commit
be8ab616b9
@ -27,10 +27,10 @@
|
||||
// connection to the database
|
||||
QgsQueryBuilder::QgsQueryBuilder( QgsVectorLayer *layer,
|
||||
QWidget *parent, Qt::WFlags fl )
|
||||
: QDialog( parent, fl ), mLayer( layer )
|
||||
: QDialog( parent, fl )
|
||||
, mLayer( layer )
|
||||
{
|
||||
setupUi( this );
|
||||
connect( buttonBox, SIGNAL( helpRequested() ), this, SLOT( helpClicked() ) );
|
||||
|
||||
QPushButton *pbn = new QPushButton( tr( "&Test" ) );
|
||||
buttonBox->addButton( pbn, QDialogButtonBox::ActionRole );
|
||||
@ -91,17 +91,11 @@ void QgsQueryBuilder::setupGuiViews()
|
||||
lstValues->setAlternatingRowColors( true );
|
||||
}
|
||||
|
||||
void QgsQueryBuilder::fillValues( int idx, QString subsetString, int limit )
|
||||
void QgsQueryBuilder::fillValues( int idx, int limit )
|
||||
{
|
||||
// clear the model
|
||||
mModelValues->clear();
|
||||
|
||||
if ( !mLayer->setSubsetString( subsetString ) )
|
||||
{
|
||||
QMessageBox::information( this, tr( "Invalid Query" ), tr( "Setting the query failed" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// determine the field type
|
||||
QList<QVariant> values;
|
||||
mLayer->dataProvider()->uniqueValues( idx, values, limit );
|
||||
@ -122,7 +116,7 @@ void QgsQueryBuilder::on_btnSampleValues_clicked()
|
||||
QStandardItemModel *tmp = new QStandardItemModel();
|
||||
lstValues->setModel( tmp );
|
||||
//Clear and fill the mModelValues
|
||||
fillValues( mModelFields->data( lstFields->currentIndex(), Qt::UserRole + 1 ).toInt(), mOrigSubsetString, 25 );
|
||||
fillValues( mModelFields->data( lstFields->currentIndex(), Qt::UserRole + 1 ).toInt(), 25 );
|
||||
lstValues->setModel( mModelValues );
|
||||
lstValues->setCursor( Qt::ArrowCursor );
|
||||
//delete the tmp
|
||||
@ -138,7 +132,7 @@ void QgsQueryBuilder::on_btnGetAllValues_clicked()
|
||||
QStandardItemModel *tmp = new QStandardItemModel();
|
||||
lstValues->setModel( tmp );
|
||||
//Clear and fill the mModelValues
|
||||
fillValues( mModelFields->data( lstFields->currentIndex(), Qt::UserRole + 1 ).toInt(), mOrigSubsetString, -1 );
|
||||
fillValues( mModelFields->data( lstFields->currentIndex(), Qt::UserRole + 1 ).toInt(), -1 );
|
||||
lstValues->setModel( mModelValues );
|
||||
lstValues->setCursor( Qt::ArrowCursor );
|
||||
//delete the tmp
|
||||
@ -151,14 +145,7 @@ void QgsQueryBuilder::test()
|
||||
// by counting the number of records that would be
|
||||
// returned
|
||||
|
||||
// if there is no sql, issue a warning
|
||||
if ( txtSQL->toPlainText().isEmpty() )
|
||||
{
|
||||
QMessageBox::information( this,
|
||||
tr( "No Query" ),
|
||||
tr( "You must create a query before you can test it" ) );
|
||||
}
|
||||
else if ( mLayer->setSubsetString( txtSQL->toPlainText() ) )
|
||||
if ( mLayer->setSubsetString( txtSQL->toPlainText() ) )
|
||||
{
|
||||
QMessageBox::information( this,
|
||||
tr( "Query Result" ),
|
||||
@ -172,12 +159,6 @@ void QgsQueryBuilder::test()
|
||||
}
|
||||
}
|
||||
|
||||
// Slot for showing help
|
||||
void QgsQueryBuilder::helpClicked()
|
||||
{
|
||||
// QgsContextHelp::run( context_id );
|
||||
}
|
||||
|
||||
void QgsQueryBuilder::accept()
|
||||
{
|
||||
// if user hits Ok and there is no query, skip the validation
|
||||
|
@ -68,7 +68,6 @@ class QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
|
||||
public slots:
|
||||
void accept();
|
||||
void reject();
|
||||
void helpClicked();
|
||||
void clear();
|
||||
void on_btnEqual_clicked();
|
||||
void on_btnLessThan_clicked();
|
||||
@ -124,7 +123,7 @@ class QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
|
||||
*/
|
||||
void setupGuiViews();
|
||||
void setupLstFieldsModel();
|
||||
void fillValues( int idx, QString subsetString, int limit );
|
||||
void fillValues( int idx, int limit );
|
||||
|
||||
// private members
|
||||
//! Model for fields ListView
|
||||
|
Loading…
x
Reference in New Issue
Block a user