Skip to content
Permalink
Browse files
Switch identify results dock to use a toolbar
  • Loading branch information
nyalldawson committed May 31, 2015
1 parent 3104195 commit fb3f95316ffc77b788912b8f3c42fb6439ce853a
Showing with 151 additions and 183 deletions.
  1. +17 −23 src/app/qgsidentifyresultsdialog.cpp
  2. +4 −4 src/app/qgsidentifyresultsdialog.h
  3. +130 −156 src/ui/qgsidentifyresultsbase.ui
@@ -255,13 +255,7 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
{
setupUi( this );

mExpandToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionExpandTree.svg" ) );
mCollapseToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionCollapseTree.svg" ) );
mExpandNewToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionExpandNewTree.svg" ) );
mCopyToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionEditCopy.png" ) );
mPrintToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionFilePrint.png" ) );
mOpenFormButton->setIcon( QgsApplication::getThemeIcon( "/mActionPropertyItem.svg" ) );
mOpenFormButton->setDisabled( true );
mOpenFormAction->setDisabled( true );

QSettings mySettings;
mDock = new QDockWidget( tr( "Identify Results" ), QgisApp::instance() );
@@ -273,8 +267,8 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
else
QgisApp::instance()->panelMenu()->addAction( mDock->toggleViewAction() );

mExpandNewToolButton->setChecked( mySettings.value( "/Map/identifyExpand", false ).toBool() );
mCopyToolButton->setEnabled( false );
mExpandNewAction->setChecked( mySettings.value( "/Map/identifyExpand", false ).toBool() );
mActionCopy->setEnabled( false );
lstResults->setColumnCount( 2 );
lstResults->sortByColumn( -1 );
setColumnText( 0, tr( "Feature" ) );
@@ -327,9 +321,9 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
connect( lstResults, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ),
this, SLOT( itemClicked( QTreeWidgetItem*, int ) ) );

connect( mPrintToolButton, SIGNAL( clicked() ), this, SLOT( printCurrentItem() ) );
connect( mOpenFormButton, SIGNAL( clicked() ), this, SLOT( featureForm() ) );
connect( mClearToolButton, SIGNAL( clicked() ), this, SLOT( clear() ) );
connect( mActionPrint, SIGNAL( triggered( bool ) ), this, SLOT( printCurrentItem() ) );
connect( mOpenFormAction, SIGNAL( triggered( bool ) ), this, SLOT( featureForm() ) );
connect( mClearResultsAction, SIGNAL( triggered( bool ) ), this, SLOT( clear() ) );
connect( mHelpToolButton, SIGNAL( clicked() ), this, SLOT( helpRequested() ) );
}

@@ -826,8 +820,8 @@ void QgsIdentifyResultsDialog::editingToggled()
continue;

QTreeWidgetItem *editItem = actions->child( j );
mOpenFormButton->setToolTip( vlayer->isEditable() ? tr( "Edit feature form" ) : tr( "View feature form" ) );
editItem->setText( 1, mOpenFormButton->toolTip() );
mOpenFormAction->setToolTip( vlayer->isEditable() ? tr( "Edit feature form" ) : tr( "View feature form" ) );
editItem->setText( 1, mOpenFormAction->toolTip() );
}
}

@@ -863,7 +857,7 @@ void QgsIdentifyResultsDialog::show()
}

// expand all if enabled
if ( mExpandNewToolButton->isChecked() )
if ( mExpandNewAction->isChecked() )
{
lstResults->expandAll();
}
@@ -1080,7 +1074,7 @@ void QgsIdentifyResultsDialog::clear()

// keep it visible but disabled, it can switch from disabled/enabled
// after raster format change
mPrintToolButton->setDisabled( true );
mActionPrint->setDisabled( true );
}

void QgsIdentifyResultsDialog::updateViewModes()
@@ -1302,16 +1296,16 @@ void QgsIdentifyResultsDialog::handleCurrentItemChanged( QTreeWidgetItem *curren
{
Q_UNUSED( previous );

mPrintToolButton->setEnabled( false );
mActionPrint->setEnabled( false );

QgsIdentifyResultsFeatureItem *featItem = dynamic_cast<QgsIdentifyResultsFeatureItem *>( featureItem( current ) );
mCopyToolButton->setEnabled( featItem && featItem->feature().isValid() );
mOpenFormButton->setEnabled( featItem && featItem->feature().isValid() );
mActionCopy->setEnabled( featItem && featItem->feature().isValid() );
mOpenFormAction->setEnabled( featItem && featItem->feature().isValid() );

QgsVectorLayer *vlayer = vectorLayer( current );
if ( vlayer )
{
mOpenFormButton->setToolTip( vlayer->isEditable() ? tr( "Edit feature form" ) : tr( "View feature form" ) );
mOpenFormAction->setToolTip( vlayer->isEditable() ? tr( "Edit feature form" ) : tr( "View feature form" ) );
}

if ( !current )
@@ -1326,7 +1320,7 @@ void QgsIdentifyResultsDialog::handleCurrentItemChanged( QTreeWidgetItem *curren
QgsIdentifyResultsWebViewItem *wv = dynamic_cast<QgsIdentifyResultsWebViewItem*>( current->child( i ) );
if ( wv != 0 )
{
mPrintToolButton->setEnabled( true );
mActionPrint->setEnabled( true );
break;
}
}
@@ -1758,13 +1752,13 @@ void QgsIdentifyResultsDialog::on_cbxAutoFeatureForm_toggled( bool checked )
settings.setValue( "/Map/identifyAutoFeatureForm", checked );
}

void QgsIdentifyResultsDialog::on_mExpandNewToolButton_toggled( bool checked )
void QgsIdentifyResultsDialog::on_mExpandNewAction_triggered( bool checked )
{
QSettings settings;
settings.setValue( "/Map/identifyExpand", checked );
}

void QgsIdentifyResultsDialog::on_mCopyToolButton_clicked( bool checked )
void QgsIdentifyResultsDialog::on_mActionCopy_triggered( bool checked )
{
Q_UNUSED( checked );
copyFeature();
@@ -199,14 +199,14 @@ class APP_EXPORT QgsIdentifyResultsDialog: public QDialog, private Ui::QgsIdenti

void on_cmbViewMode_currentIndexChanged( int index );

void on_mExpandNewToolButton_toggled( bool checked );
void on_mExpandNewAction_triggered( bool checked );

void on_cbxAutoFeatureForm_toggled( bool checked );

void on_mExpandToolButton_clicked( bool checked ) { Q_UNUSED( checked ); expandAll(); }
void on_mCollapseToolButton_clicked( bool checked ) { Q_UNUSED( checked ); collapseAll(); }
void on_mExpandAction_triggered( bool checked ) { Q_UNUSED( checked ); expandAll(); }
void on_mCollapseAction_triggered( bool checked ) { Q_UNUSED( checked ); collapseAll(); }

void on_mCopyToolButton_clicked( bool checked );
void on_mActionCopy_triggered( bool checked );

void formatChanged( int index );

0 comments on commit fb3f953

Please sign in to comment.