Skip to content
Permalink
Browse files

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
  • Loading branch information
jef-n committed Jun 30, 2013
1 parent f76c9d0 commit 1e0b9c217d007cee05e405d145b057206f58f4fb
@@ -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>
@@ -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>
@@ -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 )
{
@@ -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 );
@@ -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 );
@@ -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() ) );
@@ -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() ) );
@@ -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()
@@ -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" );
@@ -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() );
@@ -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() ); }

0 comments on commit 1e0b9c2

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