Skip to content
Permalink
Browse files
remove table and graph tabs only if there are no raster layers identi…
…fied (#10376)
  • Loading branch information
etiennesky committed Jun 10, 2014
1 parent f97fa90 commit 7f30ad2d730c8c5957d2021b52b19d2663163da5
Showing with 15 additions and 3 deletions.
  1. +7 −3 src/app/qgsidentifyresultsdialog.cpp
  2. +1 −0 src/app/qgsidentifyresultsdialog.h
  3. +7 −0 src/app/qgsmaptoolidentifyaction.cpp
@@ -1041,6 +1041,7 @@ void QgsIdentifyResultsDialog::expandColumnsToFit()

void QgsIdentifyResultsDialog::clear()
{
QgsDebugMsg( "Entered" );
for ( int i = 0; i < lstResults->topLevelItemCount(); i++ )
{
disconnectLayer( lstResults->topLevelItem( i )->data( 0, Qt::UserRole ).value<QObject *>() );
@@ -1052,9 +1053,6 @@ void QgsIdentifyResultsDialog::clear()
tblResults->clearContents();
tblResults->setRowCount( 0 );

tabWidget->removeTab( 1 );
tabWidget->removeTab( 1 );

mPlot->setVisible( false );
foreach ( QgsIdentifyPlotCurve *curve, mPlotCurves )
delete curve;
@@ -1065,6 +1063,12 @@ void QgsIdentifyResultsDialog::clear()
mPrintToolButton->setDisabled( true );
}

void QgsIdentifyResultsDialog::clearTabs()
{
tabWidget->removeTab( 1 );
tabWidget->removeTab( 1 );
}

void QgsIdentifyResultsDialog::clearHighlights()
{
foreach ( QgsHighlight *h, mHighlights )
@@ -155,6 +155,7 @@ class APP_EXPORT QgsIdentifyResultsDialog: public QDialog, private Ui::QgsIdenti
public slots:
/** Remove results */
void clear();
void clearTabs();

void show();

@@ -95,6 +95,8 @@ void QgsMapToolIdentifyAction::canvasReleaseEvent( QMouseEvent *e )
disconnect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );
disconnect( this, SIGNAL( identifyMessage( QString ) ), QgisApp::instance(), SLOT( showStatusMessage( QString ) ) );

bool identifiedRaster = false;

if ( !results.isEmpty() )
{
// Show the dialog before items are inserted so that items can resize themselves
@@ -106,6 +108,8 @@ void QgsMapToolIdentifyAction::canvasReleaseEvent( QMouseEvent *e )
for ( result = results.begin(); result != results.end(); ++result )
{
resultsDialog()->addFeature( *result );
if ( result->mLayer->type() == QgsMapLayer::RasterLayer )
identifiedRaster = true;
}

// Call QgsIdentifyResultsDialog::show() to adjust with items
@@ -116,6 +120,9 @@ void QgsMapToolIdentifyAction::canvasReleaseEvent( QMouseEvent *e )
resultsDialog()->clear();
QgisApp::instance()->statusBar()->showMessage( tr( "No features at this position found." ) );
}
// remove table and graph tabs if there are no rasters
if ( ! identifiedRaster )
resultsDialog()->clearTabs();
}

void QgsMapToolIdentifyAction::handleChangedRasterResults( QList<IdentifyResult> &results )

0 comments on commit 7f30ad2

Please sign in to comment.