Skip to content
Permalink
Browse files

qgsquerybuilderbase.ui: rename txtSQL to mTxtSql

  • Loading branch information
rouault committed Nov 14, 2020
1 parent b878ac9 commit 1526bdd40c9d491defae2bf2809138d2558fe9ce
Showing with 74 additions and 74 deletions.
  1. +47 −47 src/gui/qgsquerybuilder.cpp
  2. +1 −1 src/gui/qgsquerybuilder.h
  3. +25 −25 src/gui/qgssearchquerybuilder.cpp
  4. +1 −1 src/ui/qgsquerybuilderbase.ui
@@ -89,7 +89,7 @@ QgsQueryBuilder::QgsQueryBuilder( QgsVectorLayer *layer,
layerSubsetStringChanged();

lblDataUri->setText( tr( "Set provider filter on %1" ).arg( layer->name() ) );
txtSQL->setText( mOrigSubsetString );
mTxtSql->setText( mOrigSubsetString );

mFilterLineEdit->setShowSearchIcon( true );
mFilterLineEdit->setPlaceholderText( tr( "Search…" ) );
@@ -100,14 +100,14 @@ QgsQueryBuilder::QgsQueryBuilder( QgsVectorLayer *layer,

void QgsQueryBuilder::showEvent( QShowEvent *event )
{
txtSQL->setFocus();
mTxtSql->setFocus();
QDialog::showEvent( event );
}

void QgsQueryBuilder::populateFields()
{
const QgsFields &fields = mLayer->fields();
txtSQL->setFields( fields );
mTxtSql->setFields( fields );
for ( int idx = 0; idx < fields.count(); ++idx )
{
if ( fields.fieldOrigin( idx ) != QgsFields::OriginProvider )
@@ -235,7 +235,7 @@ void QgsQueryBuilder::test()
// by counting the number of records that would be
// returned

if ( mLayer->setSubsetString( txtSQL->text() ) )
if ( mLayer->setSubsetString( mTxtSql->text() ) )
{
const long featureCount { mLayer->featureCount() };
// Check for errors
@@ -270,9 +270,9 @@ void QgsQueryBuilder::test()

void QgsQueryBuilder::accept()
{
if ( txtSQL->text() != mOrigSubsetString )
if ( mTxtSql->text() != mOrigSubsetString )
{
if ( !mLayer->setSubsetString( txtSQL->text() ) )
if ( !mLayer->setSubsetString( mTxtSql->text() ) )
{
//error in query - show the problem
if ( mLayer->dataProvider()->hasErrors() )
@@ -305,54 +305,54 @@ void QgsQueryBuilder::reject()

void QgsQueryBuilder::btnEqual_clicked()
{
txtSQL->insertText( QStringLiteral( " = " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " = " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnLessThan_clicked()
{
txtSQL->insertText( QStringLiteral( " < " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " < " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnGreaterThan_clicked()
{
txtSQL->insertText( QStringLiteral( " > " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " > " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnPct_clicked()
{
txtSQL->insertText( QStringLiteral( "%" ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( "%" ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnIn_clicked()
{
txtSQL->insertText( QStringLiteral( " IN " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " IN " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnNotIn_clicked()
{
txtSQL->insertText( QStringLiteral( " NOT IN " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " NOT IN " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnLike_clicked()
{
txtSQL->insertText( QStringLiteral( " LIKE " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " LIKE " ) );
mTxtSql->setFocus();
}

QString QgsQueryBuilder::sql()
{
return txtSQL->text();
return mTxtSql->text();
}

void QgsQueryBuilder::setSql( const QString &sqlStatement )
{
txtSQL->setText( sqlStatement );
mTxtSql->setText( sqlStatement );
}

void QgsQueryBuilder::lstFields_clicked( const QModelIndex &index )
@@ -371,59 +371,59 @@ void QgsQueryBuilder::lstFields_clicked( const QModelIndex &index )

void QgsQueryBuilder::lstFields_doubleClicked( const QModelIndex &index )
{
txtSQL->insertText( '\"' + mLayer->fields().at( mModelFields->data( index, Qt::UserRole + 1 ).toInt() ).name() + '\"' );
txtSQL->setFocus();
mTxtSql->insertText( '\"' + mLayer->fields().at( mModelFields->data( index, Qt::UserRole + 1 ).toInt() ).name() + '\"' );
mTxtSql->setFocus();
}

void QgsQueryBuilder::lstValues_doubleClicked( const QModelIndex &index )
{
QVariant value = index.data( Qt::UserRole + 1 );
if ( value.isNull() )
txtSQL->insertText( QStringLiteral( "NULL" ) );
mTxtSql->insertText( QStringLiteral( "NULL" ) );
else if ( value.type() == QVariant::Date && mLayer->providerType() == QLatin1String( "ogr" ) && mLayer->storageType() == QLatin1String( "ESRI Shapefile" ) )
txtSQL->insertText( '\'' + value.toDate().toString( QStringLiteral( "yyyy/MM/dd" ) ) + '\'' );
mTxtSql->insertText( '\'' + value.toDate().toString( QStringLiteral( "yyyy/MM/dd" ) ) + '\'' );
else if ( value.type() == QVariant::Int || value.type() == QVariant::Double || value.type() == QVariant::LongLong || value.type() == QVariant::Bool )
txtSQL->insertText( value.toString() );
mTxtSql->insertText( value.toString() );
else
txtSQL->insertText( '\'' + value.toString().replace( '\'', QLatin1String( "''" ) ) + '\'' );
mTxtSql->insertText( '\'' + value.toString().replace( '\'', QLatin1String( "''" ) ) + '\'' );

txtSQL->setFocus();
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnLessEqual_clicked()
{
txtSQL->insertText( QStringLiteral( " <= " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " <= " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnGreaterEqual_clicked()
{
txtSQL->insertText( QStringLiteral( " >= " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " >= " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnNotEqual_clicked()
{
txtSQL->insertText( QStringLiteral( " != " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " != " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnAnd_clicked()
{
txtSQL->insertText( QStringLiteral( " AND " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " AND " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnNot_clicked()
{
txtSQL->insertText( QStringLiteral( " NOT " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " NOT " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::btnOr_clicked()
{
txtSQL->insertText( QStringLiteral( " OR " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " OR " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::onTextChanged( const QString &text )
@@ -434,14 +434,14 @@ void QgsQueryBuilder::onTextChanged( const QString &text )

void QgsQueryBuilder::clear()
{
txtSQL->clear();
mTxtSql->clear();
mLayer->setSubsetString( QString() );
}

void QgsQueryBuilder::btnILike_clicked()
{
txtSQL->insertText( QStringLiteral( " ILIKE " ) );
txtSQL->setFocus();
mTxtSql->insertText( QStringLiteral( " ILIKE " ) );
mTxtSql->setFocus();
}

void QgsQueryBuilder::setDatasourceDescription( const QString &uri )
@@ -479,7 +479,7 @@ void QgsQueryBuilder::saveQuery()

QDomDocument xmlDoc;
QDomElement queryElem = xmlDoc.createElement( QStringLiteral( "Query" ) );
QDomText queryTextNode = xmlDoc.createTextNode( txtSQL->text() );
QDomText queryTextNode = xmlDoc.createTextNode( mTxtSql->text() );
queryElem.appendChild( queryTextNode );
xmlDoc.appendChild( queryElem );

@@ -531,8 +531,8 @@ void QgsQueryBuilder::loadQuery()
return;
}

txtSQL->clear();
txtSQL->insertText( query );
mTxtSql->clear();
mTxtSql->insertText( query );
}

void QgsQueryBuilder::layerSubsetStringChanged()
@@ -83,7 +83,7 @@ class GUI_EXPORT QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBa
* Returns the code editor widget for the SQL.
* \since QGIS 3.18
*/
QgsCodeEditor *codeEditorWidget() const { return txtSQL; }
QgsCodeEditor *codeEditorWidget() const { return mTxtSql; }
#endif

public slots:

0 comments on commit 1526bdd

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