Skip to content

Commit

Permalink
expression builder widget: hide sample buttons and context menu, when…
Browse files Browse the repository at this point in the history
… no layer is set (fixes #6802)

wfs source select: rename slots to avoid autoconnect warning
attribute table: remove stale connect
  • Loading branch information
jef-n committed Jun 30, 2013
1 parent f76c9d0 commit 1e0b9c2
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 18 deletions.
5 changes: 5 additions & 0 deletions resources/function_help/Field
Expand Up @@ -2,3 +2,8 @@
Double click to add field name to expression string.
<br><br>
Right-Click on field name to open context menu sample value loading options.

<p><h4>Note:</h4>
Loading field values from WFS layers isn't supported, before the layer is
actually inserted, ie. when building queries.
</p>
4 changes: 4 additions & 0 deletions resources/function_help/Fields and Values
Expand Up @@ -3,3 +3,7 @@ Contains a list of fields from the layer. Sample values can also be accessed vi
<br><br>
Select the field name from the list then right-click to access context menu with options to load sample values from the selected field.

<p><h4>Note:</h4>
Loading field values from WFS layers isn't supported, before the layer is
actually inserted, ie. when building queries.
</p>
2 changes: 0 additions & 2 deletions src/app/qgsattributetabledialog.cpp
Expand Up @@ -119,8 +119,6 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
// info from table to application
connect( this, SIGNAL( saveEdits( QgsMapLayer * ) ), QgisApp::instance(), SLOT( saveEdits( QgsMapLayer * ) ) );

connect( mMainView, SIGNAL( currentChanged( int ) ), mMainViewButtonGroup, SLOT( currentChanged( int ) ) );

bool myDockFlag = settings.value( "/qgis/dockAttributeTable", false ).toBool();
if ( myDockFlag )
{
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsexpressionbuilderdialog.cpp
Expand Up @@ -21,8 +21,8 @@ QgsExpressionBuilderDialog::QgsExpressionBuilderDialog( QgsVectorLayer* layer, Q
{
setupUi( this );

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

builder->setLayer( layer );
builder->setExpressionText( startText );
Expand Down
10 changes: 5 additions & 5 deletions src/gui/qgsexpressionbuilderwidget.cpp
Expand Up @@ -125,17 +125,17 @@ void QgsExpressionBuilderWidget::currentChanged( const QModelIndex &index, const
// Get the item
QModelIndex idx = mProxyModel->mapToSource( index );
QgsExpressionItem* item = dynamic_cast<QgsExpressionItem*>( mModel->itemFromIndex( idx ) );
if ( item == 0 )
if ( !item )
return;

if ( item->getItemType() != QgsExpressionItem::Field )
{
mValueListWidget->clear();
}

btnLoadAll->setVisible( item->getItemType() == QgsExpressionItem::Field );
btnLoadSample->setVisible( item->getItemType() == QgsExpressionItem::Field );
mValueGroupBox->setVisible( item->getItemType() == QgsExpressionItem::Field );
btnLoadAll->setVisible( item->getItemType() == QgsExpressionItem::Field && mLayer );
btnLoadSample->setVisible( item->getItemType() == QgsExpressionItem::Field && mLayer );
mValueGroupBox->setVisible( item->getItemType() == QgsExpressionItem::Field && mLayer );

// Show the help for the current item.
QString help = loadFunctionHelp( item );
Expand Down Expand Up @@ -369,7 +369,7 @@ void QgsExpressionBuilderWidget::showContextMenu( const QPoint & pt )
if ( !item )
return;

if ( item->getItemType() == QgsExpressionItem::Field )
if ( item->getItemType() == QgsExpressionItem::Field && mLayer )
{
QMenu* menu = new QMenu( this );
menu->addAction( tr( "Load top 10 unique values" ), this, SLOT( loadSampleValues() ) );
Expand Down
12 changes: 6 additions & 6 deletions src/providers/wfs/qgswfssourceselect.cpp
Expand Up @@ -61,7 +61,7 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget* parent, Qt::WFlags fl, bool emb
connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addLayer() ) );

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

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

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

QgsWFSSourceSelect::~QgsWFSSourceSelect()
Expand Down Expand Up @@ -519,13 +519,13 @@ void QgsWFSSourceSelect::on_btnLoad_clicked()
emit connectionsChanged();
}

void QgsWFSSourceSelect::on_treeWidget_itemDoubleClicked( const QModelIndex& index )
void QgsWFSSourceSelect::treeWidgetItemDoubleClicked( const QModelIndex& index )
{
QgsDebugMsg( "double click called" );
buildQuery( index );
}

void QgsWFSSourceSelect::on_treeWidget_currentRowChanged( const QModelIndex & current, const QModelIndex & previous )
void QgsWFSSourceSelect::treeWidgetCurrentRowChanged( const QModelIndex & current, const QModelIndex & previous )
{
Q_UNUSED( previous )
QgsDebugMsg( "treeWidget_currentRowChanged called" );
Expand All @@ -534,7 +534,7 @@ void QgsWFSSourceSelect::on_treeWidget_currentRowChanged( const QModelIndex & cu
mAddButton->setEnabled( current.isValid() );
}

void QgsWFSSourceSelect::on_mBuildQueryButton_clicked()
void QgsWFSSourceSelect::buildQueryButtonClicked()
{
QgsDebugMsg( "mBuildQueryButton click called" );
buildQuery( treeView->selectionModel()->currentIndex() );
Expand Down
6 changes: 3 additions & 3 deletions src/providers/wfs/qgswfssourceselect.h
Expand Up @@ -91,9 +91,9 @@ class QgsWFSSourceSelect: public QDialog, private Ui::QgsWFSSourceSelectBase
void capabilitiesReplyFinished();
void on_btnSave_clicked();
void on_btnLoad_clicked();
void on_treeWidget_itemDoubleClicked( const QModelIndex & index );
void on_treeWidget_currentRowChanged( const QModelIndex & current, const QModelIndex & previous );
void on_mBuildQueryButton_clicked();
void treeWidgetItemDoubleClicked( const QModelIndex & index );
void treeWidgetCurrentRowChanged( const QModelIndex & current, const QModelIndex & previous );
void buildQueryButtonClicked();
void filterChanged( QString text );

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

0 comments on commit 1e0b9c2

Please sign in to comment.