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
This commit is contained in:
Juergen E. Fischer 2013-06-30 14:37:05 +02:00
parent f76c9d053c
commit 1e0b9c217d
7 changed files with 25 additions and 18 deletions

View File

@ -2,3 +2,8 @@
Double click to add field name to expression string. Double click to add field name to expression string.
<br><br> <br><br>
Right-Click on field name to open context menu sample value loading options. 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>

View File

@ -3,3 +3,7 @@ Contains a list of fields from the layer. Sample values can also be accessed vi
<br><br> <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. 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>

View File

@ -119,8 +119,6 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
// info from table to application // info from table to application
connect( this, SIGNAL( saveEdits( QgsMapLayer * ) ), QgisApp::instance(), SLOT( saveEdits( QgsMapLayer * ) ) ); 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(); bool myDockFlag = settings.value( "/qgis/dockAttributeTable", false ).toBool();
if ( myDockFlag ) if ( myDockFlag )
{ {

View File

@ -21,8 +21,8 @@ QgsExpressionBuilderDialog::QgsExpressionBuilderDialog( QgsVectorLayer* layer, Q
{ {
setupUi( this ); setupUi( this );
QPushButton* okButuon = buttonBox->button( QDialogButtonBox::Ok ); QPushButton* okButton = buttonBox->button( QDialogButtonBox::Ok );
connect( builder, SIGNAL( expressionParsed( bool ) ), okButuon, SLOT( setEnabled( bool ) ) ); connect( builder, SIGNAL( expressionParsed( bool ) ), okButton, SLOT( setEnabled( bool ) ) );
builder->setLayer( layer ); builder->setLayer( layer );
builder->setExpressionText( startText ); builder->setExpressionText( startText );

View File

@ -125,7 +125,7 @@ void QgsExpressionBuilderWidget::currentChanged( const QModelIndex &index, const
// Get the item // Get the item
QModelIndex idx = mProxyModel->mapToSource( index ); QModelIndex idx = mProxyModel->mapToSource( index );
QgsExpressionItem* item = dynamic_cast<QgsExpressionItem*>( mModel->itemFromIndex( idx ) ); QgsExpressionItem* item = dynamic_cast<QgsExpressionItem*>( mModel->itemFromIndex( idx ) );
if ( item == 0 ) if ( !item )
return; return;
if ( item->getItemType() != QgsExpressionItem::Field ) if ( item->getItemType() != QgsExpressionItem::Field )
@ -133,9 +133,9 @@ void QgsExpressionBuilderWidget::currentChanged( const QModelIndex &index, const
mValueListWidget->clear(); mValueListWidget->clear();
} }
btnLoadAll->setVisible( item->getItemType() == QgsExpressionItem::Field ); btnLoadAll->setVisible( item->getItemType() == QgsExpressionItem::Field && mLayer );
btnLoadSample->setVisible( item->getItemType() == QgsExpressionItem::Field ); btnLoadSample->setVisible( item->getItemType() == QgsExpressionItem::Field && mLayer );
mValueGroupBox->setVisible( item->getItemType() == QgsExpressionItem::Field ); mValueGroupBox->setVisible( item->getItemType() == QgsExpressionItem::Field && mLayer );
// Show the help for the current item. // Show the help for the current item.
QString help = loadFunctionHelp( item ); QString help = loadFunctionHelp( item );
@ -369,7 +369,7 @@ void QgsExpressionBuilderWidget::showContextMenu( const QPoint & pt )
if ( !item ) if ( !item )
return; return;
if ( item->getItemType() == QgsExpressionItem::Field ) if ( item->getItemType() == QgsExpressionItem::Field && mLayer )
{ {
QMenu* menu = new QMenu( this ); QMenu* menu = new QMenu( this );
menu->addAction( tr( "Load top 10 unique values" ), this, SLOT( loadSampleValues() ) ); menu->addAction( tr( "Load top 10 unique values" ), this, SLOT( loadSampleValues() ) );

View File

@ -61,7 +61,7 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget* parent, Qt::WFlags fl, bool emb
connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addLayer() ) ); connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addLayer() ) );
buttonBox->addButton( mBuildQueryButton, QDialogButtonBox::ActionRole ); 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( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
connect( btnNew, SIGNAL( clicked() ), this, SLOT( addEntryToServerList() ) ); connect( btnNew, SIGNAL( clicked() ), this, SLOT( addEntryToServerList() ) );
@ -94,8 +94,8 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget* parent, Qt::WFlags fl, bool emb
mModelProxy->setSortCaseSensitivity( Qt::CaseInsensitive ); mModelProxy->setSortCaseSensitivity( Qt::CaseInsensitive );
treeView->setModel( mModelProxy ); treeView->setModel( mModelProxy );
connect( treeView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( on_treeWidget_itemDoubleClicked( const QModelIndex& ) ) ); connect( treeView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( treeWidgetItemDoubleClicked( const QModelIndex& ) ) );
connect( treeView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ), this, SLOT( on_treeWidget_currentRowChanged( const QModelIndex&, const QModelIndex& ) ) ); connect( treeView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ), this, SLOT( treeWidgetCurrentRowChanged( const QModelIndex&, const QModelIndex& ) ) );
} }
QgsWFSSourceSelect::~QgsWFSSourceSelect() QgsWFSSourceSelect::~QgsWFSSourceSelect()
@ -519,13 +519,13 @@ void QgsWFSSourceSelect::on_btnLoad_clicked()
emit connectionsChanged(); emit connectionsChanged();
} }
void QgsWFSSourceSelect::on_treeWidget_itemDoubleClicked( const QModelIndex& index ) void QgsWFSSourceSelect::treeWidgetItemDoubleClicked( const QModelIndex& index )
{ {
QgsDebugMsg( "double click called" ); QgsDebugMsg( "double click called" );
buildQuery( index ); 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 ) Q_UNUSED( previous )
QgsDebugMsg( "treeWidget_currentRowChanged called" ); QgsDebugMsg( "treeWidget_currentRowChanged called" );
@ -534,7 +534,7 @@ void QgsWFSSourceSelect::on_treeWidget_currentRowChanged( const QModelIndex & cu
mAddButton->setEnabled( current.isValid() ); mAddButton->setEnabled( current.isValid() );
} }
void QgsWFSSourceSelect::on_mBuildQueryButton_clicked() void QgsWFSSourceSelect::buildQueryButtonClicked()
{ {
QgsDebugMsg( "mBuildQueryButton click called" ); QgsDebugMsg( "mBuildQueryButton click called" );
buildQuery( treeView->selectionModel()->currentIndex() ); buildQuery( treeView->selectionModel()->currentIndex() );

View File

@ -91,9 +91,9 @@ class QgsWFSSourceSelect: public QDialog, private Ui::QgsWFSSourceSelectBase
void capabilitiesReplyFinished(); void capabilitiesReplyFinished();
void on_btnSave_clicked(); void on_btnSave_clicked();
void on_btnLoad_clicked(); void on_btnLoad_clicked();
void on_treeWidget_itemDoubleClicked( const QModelIndex & index ); void treeWidgetItemDoubleClicked( const QModelIndex & index );
void on_treeWidget_currentRowChanged( const QModelIndex & current, const QModelIndex & previous ); void treeWidgetCurrentRowChanged( const QModelIndex & current, const QModelIndex & previous );
void on_mBuildQueryButton_clicked(); void buildQueryButtonClicked();
void filterChanged( QString text ); void filterChanged( QString text );
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); } void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }