Skip to content

Commit

Permalink
identify results: hide highlights on deactivation and hide table/plot…
Browse files Browse the repository at this point in the history
… tab meant

for rasters when there are only vector features (fixes #10376)
  • Loading branch information
jef-n committed Jun 9, 2014
1 parent 4a890b9 commit 4ff233e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
46 changes: 27 additions & 19 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -300,6 +300,9 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
cmbIdentifyMode->setCurrentIndex( cmbIdentifyMode->findData( identifyMode ) );
cbxAutoFeatureForm->setChecked( mySettings.value( "/Map/identifyAutoFeatureForm", false ).toBool() );

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

// graph
mPlot->setVisible( false );
mPlot->setAutoFillBackground( false );
Expand Down Expand Up @@ -652,6 +655,12 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,

QgsRaster::IdentifyFormat currentFormat = QgsRasterDataProvider::identifyFormatFromName( layer->customProperty( "identify/format" ).toString() );

if ( tabWidget->indexOf( tableTab ) < 0 )
{
tabWidget->addTab( tableTab, tr( "Table" ) );
tabWidget->addTab( plotTab, tr( "Graph" ) );
}

if ( layItem == 0 )
{
layItem = new QTreeWidgetItem( QStringList() << QString::number( lstResults->topLevelItemCount() ) << layer->name() );
Expand Down Expand Up @@ -885,7 +894,7 @@ void QgsIdentifyResultsDialog::contextMenuEvent( QContextMenuEvent* event )
QgsDebugMsg( "Entered" );

// only handle context menu event if showing tree widget
if ( tabWidget->currentIndex() != 0 )
if ( tabWidget->currentWidget() != treeTab )
return;

QTreeWidgetItem *item = lstResults->itemAt( lstResults->viewport()->mapFrom( this, event->pos() ) );
Expand Down Expand Up @@ -1030,16 +1039,6 @@ void QgsIdentifyResultsDialog::expandColumnsToFit()
lstResults->resizeColumnToContents( 1 );
}

void QgsIdentifyResultsDialog::clearHighlights()
{
foreach ( QgsHighlight *h, mHighlights )
{
delete h;
}

mHighlights.clear();
}

void QgsIdentifyResultsDialog::clear()
{
for ( int i = 0; i < lstResults->topLevelItemCount(); i++ )
Expand All @@ -1053,6 +1052,9 @@ void QgsIdentifyResultsDialog::clear()
tblResults->clearContents();
tblResults->setRowCount( 0 );

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

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

void QgsIdentifyResultsDialog::clearHighlights()
{
foreach ( QgsHighlight *h, mHighlights )
{
delete h;
}

mHighlights.clear();
}

void QgsIdentifyResultsDialog::activate()
{
#if 0
foreach ( QgsRubberBand *rb, mRubberBands )
foreach ( QgsHighlight *h, mHighlights )
{
rb->show();
h->show();
}
#endif

if ( lstResults->topLevelItemCount() > 0 )
{
Expand All @@ -1081,12 +1091,10 @@ void QgsIdentifyResultsDialog::activate()

void QgsIdentifyResultsDialog::deactivate()
{
#if 0
foreach ( QgsRubberBand *rb, mRubberBands )
foreach ( QgsHighlight *h, mHighlights )
{
rb->hide();
h->hide();
}
#endif
}

void QgsIdentifyResultsDialog::doAction( QTreeWidgetItem *item, int action )
Expand Down
6 changes: 3 additions & 3 deletions src/ui/qgsidentifyresultsbase.ui
Expand Up @@ -22,7 +22,7 @@
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="treeTab">
<attribute name="title">
<string>Tree</string>
</attribute>
Expand Down Expand Up @@ -53,7 +53,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<widget class="QWidget" name="tableTab">
<attribute name="title">
<string>Table</string>
</attribute>
Expand Down Expand Up @@ -96,7 +96,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<widget class="QWidget" name="plotTab">
<attribute name="title">
<string>Graph</string>
</attribute>
Expand Down

0 comments on commit 4ff233e

Please sign in to comment.