Skip to content

Commit 1e0b9c2

Browse files
committed
expression builder widget: hide sample buttons and context menu, when no layer is set (fixes #6802)
wfs source select: rename slots to avoid autoconnect warning attribute table: remove stale connect
1 parent f76c9d0 commit 1e0b9c2

7 files changed

+25
-18
lines changed

resources/function_help/Field

+5
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
Double click to add field name to expression string.
33
<br><br>
44
Right-Click on field name to open context menu sample value loading options.
5+
6+
<p><h4>Note:</h4>
7+
Loading field values from WFS layers isn't supported, before the layer is
8+
actually inserted, ie. when building queries.
9+
</p>

resources/function_help/Fields and Values

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ Contains a list of fields from the layer. Sample values can also be accessed vi
33
<br><br>
44
Select the field name from the list then right-click to access context menu with options to load sample values from the selected field.
55

6+
<p><h4>Note:</h4>
7+
Loading field values from WFS layers isn't supported, before the layer is
8+
actually inserted, ie. when building queries.
9+
</p>

src/app/qgsattributetabledialog.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
119119
// info from table to application
120120
connect( this, SIGNAL( saveEdits( QgsMapLayer * ) ), QgisApp::instance(), SLOT( saveEdits( QgsMapLayer * ) ) );
121121

122-
connect( mMainView, SIGNAL( currentChanged( int ) ), mMainViewButtonGroup, SLOT( currentChanged( int ) ) );
123-
124122
bool myDockFlag = settings.value( "/qgis/dockAttributeTable", false ).toBool();
125123
if ( myDockFlag )
126124
{

src/gui/qgsexpressionbuilderdialog.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ QgsExpressionBuilderDialog::QgsExpressionBuilderDialog( QgsVectorLayer* layer, Q
2121
{
2222
setupUi( this );
2323

24-
QPushButton* okButuon = buttonBox->button( QDialogButtonBox::Ok );
25-
connect( builder, SIGNAL( expressionParsed( bool ) ), okButuon, SLOT( setEnabled( bool ) ) );
24+
QPushButton* okButton = buttonBox->button( QDialogButtonBox::Ok );
25+
connect( builder, SIGNAL( expressionParsed( bool ) ), okButton, SLOT( setEnabled( bool ) ) );
2626

2727
builder->setLayer( layer );
2828
builder->setExpressionText( startText );

src/gui/qgsexpressionbuilderwidget.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,17 @@ void QgsExpressionBuilderWidget::currentChanged( const QModelIndex &index, const
125125
// Get the item
126126
QModelIndex idx = mProxyModel->mapToSource( index );
127127
QgsExpressionItem* item = dynamic_cast<QgsExpressionItem*>( mModel->itemFromIndex( idx ) );
128-
if ( item == 0 )
128+
if ( !item )
129129
return;
130130

131131
if ( item->getItemType() != QgsExpressionItem::Field )
132132
{
133133
mValueListWidget->clear();
134134
}
135135

136-
btnLoadAll->setVisible( item->getItemType() == QgsExpressionItem::Field );
137-
btnLoadSample->setVisible( item->getItemType() == QgsExpressionItem::Field );
138-
mValueGroupBox->setVisible( item->getItemType() == QgsExpressionItem::Field );
136+
btnLoadAll->setVisible( item->getItemType() == QgsExpressionItem::Field && mLayer );
137+
btnLoadSample->setVisible( item->getItemType() == QgsExpressionItem::Field && mLayer );
138+
mValueGroupBox->setVisible( item->getItemType() == QgsExpressionItem::Field && mLayer );
139139

140140
// Show the help for the current item.
141141
QString help = loadFunctionHelp( item );
@@ -369,7 +369,7 @@ void QgsExpressionBuilderWidget::showContextMenu( const QPoint & pt )
369369
if ( !item )
370370
return;
371371

372-
if ( item->getItemType() == QgsExpressionItem::Field )
372+
if ( item->getItemType() == QgsExpressionItem::Field && mLayer )
373373
{
374374
QMenu* menu = new QMenu( this );
375375
menu->addAction( tr( "Load top 10 unique values" ), this, SLOT( loadSampleValues() ) );

src/providers/wfs/qgswfssourceselect.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget* parent, Qt::WFlags fl, bool emb
6161
connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addLayer() ) );
6262

6363
buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole );
64-
connect( mBuildQueryButton, SIGNAL( clicked() ), this, SLOT( on_mBuildQueryButton_clicked() ) );
64+
connect( mBuildQueryButton, SIGNAL( clicked() ), this, SLOT( buildQueryButtonClicked() ) );
6565

6666
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
6767
connect( btnNew, SIGNAL( clicked() ), this, SLOT( addEntryToServerList() ) );
@@ -94,8 +94,8 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget* parent, Qt::WFlags fl, bool emb
9494
mModelProxy->setSortCaseSensitivity( Qt::CaseInsensitive );
9595
treeView->setModel( mModelProxy );
9696

97-
connect( treeView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( on_treeWidget_itemDoubleClicked( const QModelIndex& ) ) );
98-
connect( treeView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ), this, SLOT( on_treeWidget_currentRowChanged( const QModelIndex&, const QModelIndex& ) ) );
97+
connect( treeView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( treeWidgetItemDoubleClicked( const QModelIndex& ) ) );
98+
connect( treeView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ), this, SLOT( treeWidgetCurrentRowChanged( const QModelIndex&, const QModelIndex& ) ) );
9999
}
100100

101101
QgsWFSSourceSelect::~QgsWFSSourceSelect()
@@ -519,13 +519,13 @@ void QgsWFSSourceSelect::on_btnLoad_clicked()
519519
emit connectionsChanged();
520520
}
521521

522-
void QgsWFSSourceSelect::on_treeWidget_itemDoubleClicked( const QModelIndex& index )
522+
void QgsWFSSourceSelect::treeWidgetItemDoubleClicked( const QModelIndex& index )
523523
{
524524
QgsDebugMsg( "double click called" );
525525
buildQuery( index );
526526
}
527527

528-
void QgsWFSSourceSelect::on_treeWidget_currentRowChanged( const QModelIndex & current, const QModelIndex & previous )
528+
void QgsWFSSourceSelect::treeWidgetCurrentRowChanged( const QModelIndex & current, const QModelIndex & previous )
529529
{
530530
Q_UNUSED( previous )
531531
QgsDebugMsg( "treeWidget_currentRowChanged called" );
@@ -534,7 +534,7 @@ void QgsWFSSourceSelect::on_treeWidget_currentRowChanged( const QModelIndex & cu
534534
mAddButton->setEnabled( current.isValid() );
535535
}
536536

537-
void QgsWFSSourceSelect::on_mBuildQueryButton_clicked()
537+
void QgsWFSSourceSelect::buildQueryButtonClicked()
538538
{
539539
QgsDebugMsg( "mBuildQueryButton click called" );
540540
buildQuery( treeView->selectionModel()->currentIndex() );

src/providers/wfs/qgswfssourceselect.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ class QgsWFSSourceSelect: public QDialog, private Ui::QgsWFSSourceSelectBase
9191
void capabilitiesReplyFinished();
9292
void on_btnSave_clicked();
9393
void on_btnLoad_clicked();
94-
void on_treeWidget_itemDoubleClicked( const QModelIndex & index );
95-
void on_treeWidget_currentRowChanged( const QModelIndex & current, const QModelIndex & previous );
96-
void on_mBuildQueryButton_clicked();
94+
void treeWidgetItemDoubleClicked( const QModelIndex & index );
95+
void treeWidgetCurrentRowChanged( const QModelIndex & current, const QModelIndex & previous );
96+
void buildQueryButtonClicked();
9797
void filterChanged( QString text );
9898

9999
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }

0 commit comments

Comments
 (0)