Skip to content

Commit 7f30ad2

Browse files
committedJun 10, 2014
remove table and graph tabs only if there are no raster layers identified (#10376)
1 parent f97fa90 commit 7f30ad2

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed
 

‎src/app/qgsidentifyresultsdialog.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,7 @@ void QgsIdentifyResultsDialog::expandColumnsToFit()
10411041

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

1055-
tabWidget->removeTab( 1 );
1056-
tabWidget->removeTab( 1 );
1057-
10581056
mPlot->setVisible( false );
10591057
foreach ( QgsIdentifyPlotCurve *curve, mPlotCurves )
10601058
delete curve;
@@ -1065,6 +1063,12 @@ void QgsIdentifyResultsDialog::clear()
10651063
mPrintToolButton->setDisabled( true );
10661064
}
10671065

1066+
void QgsIdentifyResultsDialog::clearTabs()
1067+
{
1068+
tabWidget->removeTab( 1 );
1069+
tabWidget->removeTab( 1 );
1070+
}
1071+
10681072
void QgsIdentifyResultsDialog::clearHighlights()
10691073
{
10701074
foreach ( QgsHighlight *h, mHighlights )

‎src/app/qgsidentifyresultsdialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class APP_EXPORT QgsIdentifyResultsDialog: public QDialog, private Ui::QgsIdenti
155155
public slots:
156156
/** Remove results */
157157
void clear();
158+
void clearTabs();
158159

159160
void show();
160161

‎src/app/qgsmaptoolidentifyaction.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ void QgsMapToolIdentifyAction::canvasReleaseEvent( QMouseEvent *e )
9595
disconnect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );
9696
disconnect( this, SIGNAL( identifyMessage( QString ) ), QgisApp::instance(), SLOT( showStatusMessage( QString ) ) );
9797

98+
bool identifiedRaster = false;
99+
98100
if ( !results.isEmpty() )
99101
{
100102
// Show the dialog before items are inserted so that items can resize themselves
@@ -106,6 +108,8 @@ void QgsMapToolIdentifyAction::canvasReleaseEvent( QMouseEvent *e )
106108
for ( result = results.begin(); result != results.end(); ++result )
107109
{
108110
resultsDialog()->addFeature( *result );
111+
if ( result->mLayer->type() == QgsMapLayer::RasterLayer )
112+
identifiedRaster = true;
109113
}
110114

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.