Skip to content

Commit

Permalink
[FEATURE] Added an option for docking the identify query results rath…
Browse files Browse the repository at this point in the history
…er than having them float over the app. Default behaviour is not docked, but it can be enabled in the options panel

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11617 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Sep 10, 2009
1 parent ef5a14c commit f89afbd
Show file tree
Hide file tree
Showing 4 changed files with 556 additions and 449 deletions.
28 changes: 27 additions & 1 deletion src/app/qgsidentifyresults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,24 @@
#include <QSettings>
#include <QMenu>
#include <QClipboard>
#include <QDockWidget>

#include "qgslogger.h"

class QgsIdentifyResultsDock : public QDockWidget
{
public:
QgsIdentifyResultsDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 )
: QDockWidget( title, parent, flags )
{
setObjectName( "IdentifyResultsTableDock" ); // set object name so the position can be saved
}

virtual void closeEvent( QCloseEvent * ev )
{
deleteLater();
}
};
// Tree hierachy
//
// layer [userrole: QgsMapLayer]
Expand All @@ -57,9 +72,20 @@ QgsIdentifyResults::QgsIdentifyResults( QgsMapCanvas *canvas, QWidget *parent, Q
: QDialog( parent, f ),
mActionPopup( 0 ),
mRubberBand( 0 ),
mCanvas( canvas )
mCanvas( canvas ),
mDock( NULL )
{
setupUi( this );
QSettings mySettings;
bool myDockFlag = mySettings.value( "/qgis/dockIdentifyResults", false ).toBool();
if ( myDockFlag )
{
mDock = new QgsIdentifyResultsDock( tr( "Identify Results" ) , QgisApp::instance() );
mDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
mDock->setWidget( this );
QgisApp::instance()->addDockWidget( Qt::LeftDockWidgetArea, mDock );
buttonCancel->hide();
}
lstResults->setColumnCount( 2 );
setColumnText( 0, tr( "Feature" ) );
setColumnText( 1, tr( "Value" ) );
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsidentifyresults.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class QgsMapLayer;
class QgsVectorLayer;
class QgsRubberBand;
class QgsMapCanvas;
class QDockWidget;

/**
*@author Gary E.Sherman
Expand Down Expand Up @@ -117,6 +118,8 @@ class QgsIdentifyResults: public QDialog, private Ui::QgsIdentifyResultsBase
void editFeature( QTreeWidgetItem *item );

void doAction( QTreeWidgetItem *item, int action );

QDockWidget *mDock;
};

#endif
2 changes: 2 additions & 0 deletions src/app/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
cbxLegendClassifiers->setChecked( settings.value( "/qgis/showLegendClassifiers", false ).toBool() );
cbxHideSplash->setChecked( settings.value( "/qgis/hideSplash", false ).toBool() );
cbxAttributeTableDocked->setChecked( settings.value( "/qgis/dockAttributeTable", false ).toBool() );
cbxIdentifyResultsDocked->setChecked( settings.value( "/qgis/dockIdentifyResults", false ).toBool() );
cbxAddPostgisDC->setChecked( settings.value( "/qgis/addPostgisDC", false ).toBool() );

//set the colour for selections
Expand Down Expand Up @@ -360,6 +361,7 @@ void QgsOptions::saveOptions()
settings.setValue( "/qgis/showLegendClassifiers", cbxLegendClassifiers->isChecked() );
settings.setValue( "/qgis/hideSplash", cbxHideSplash->isChecked() );
settings.setValue( "/qgis/dockAttributeTable", cbxAttributeTableDocked->isChecked() );
settings.setValue( "/qgis/dockIdentifyResults", cbxIdentifyResultsDocked->isChecked() );
settings.setValue( "/qgis/addPostgisDC", cbxAddPostgisDC->isChecked() );
settings.setValue( "/qgis/new_layers_visible", chkAddedVisibility->isChecked() );
settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() );
Expand Down
Loading

0 comments on commit f89afbd

Please sign in to comment.