Skip to content

Commit

Permalink
Fix for ticket #198. The identify results dialog is now deleted when
Browse files Browse the repository at this point in the history
closed by the user (it was previously just hidden).


git-svn-id: http://svn.osgeo.org/qgis/trunk@5646 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Jul 29, 2006
1 parent 5c2d41d commit 05433ca
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/gui/qgsidentifyresults.cpp
Expand Up @@ -57,7 +57,7 @@ QgsIdentifyResults::~QgsIdentifyResults()
void QgsIdentifyResults::close()
{
saveWindowLocation();
hide();
done(0);
}
// Save the current window size/position before closing
// from window menu or X in titlebar
Expand Down
18 changes: 15 additions & 3 deletions src/gui/qgsmaptoolidentify.cpp
Expand Up @@ -31,7 +31,6 @@
#include <QMessageBox>
#include <QCursor>
#include <QPixmap>
#include <QObject>


QgsMapToolIdentify::QgsMapToolIdentify(QgsMapCanvas* canvas)
Expand All @@ -48,7 +47,7 @@ QgsMapToolIdentify::~QgsMapToolIdentify()
{
if (mResults)
{
delete mResults;
mResults->done(0);
}

if (mViewer)
Expand Down Expand Up @@ -129,6 +128,10 @@ void QgsMapToolIdentify::identifyRasterLayer(QgsRasterLayer* layer, const QgsPoi
{
QgsAttributeAction aa;
mResults = new QgsIdentifyResults(aa, mCanvas->window());
mResults->setAttribute(Qt::WA_DeleteOnClose);
// Be informed when the dialog box is closed so that we can stop using it.
connect(mResults, SIGNAL(accepted()), this, SLOT(resultsDialogGone()));
connect(mResults, SIGNAL(rejected()), this, SLOT(resultsDialogGone()));
mResults->restorePosition();
}
else
Expand Down Expand Up @@ -225,7 +228,10 @@ void QgsMapToolIdentify::identifyVectorLayer(QgsVectorLayer* layer, const QgsPoi
if(!mResults)
{
mResults = new QgsIdentifyResults(actions, mCanvas->window());

mResults->setAttribute(Qt::WA_DeleteOnClose);
// Be informed when the dialog box is closed so that we can stop using it.
connect(mResults, SIGNAL(accepted()), this, SLOT(resultsDialogGone()));
connect(mResults, SIGNAL(rejected()), this, SLOT(resultsDialogGone()));
// restore the identify window position and show it
mResults->restorePosition();
}
Expand Down Expand Up @@ -391,4 +397,10 @@ void QgsMapToolIdentify::showError(QgsMapLayer * mapLayer)

}

void QgsMapToolIdentify::resultsDialogGone()
{
std::cerr << "Dialog closed\n";
mResults = 0;
}

// ENDS
11 changes: 10 additions & 1 deletion src/gui/qgsmaptoolidentify.h
Expand Up @@ -20,6 +20,8 @@
#include "qgsmaptool.h"
#include "qgspoint.h"

#include <QObject>

class QgsIdentifyResults;
class QgsMessageViewer;
class QgsMapLayer;
Expand All @@ -34,8 +36,10 @@ class QgsVectorLayer;
- for vector layers shows feature attributes within search radius
(allows to edit values when vector layer is in editing mode)
*/
class QgsMapToolIdentify : public QgsMapTool
class QgsMapToolIdentify : public QObject, public QgsMapTool
{
Q_OBJECT;

public:
QgsMapToolIdentify(QgsMapCanvas* canvas);

Expand Down Expand Up @@ -87,6 +91,11 @@ class QgsMapToolIdentify : public QgsMapTool
//! Pointer to the identify results dialog for WMS XML files
QgsMessageViewer * mViewer;

private slots:
// Let us know when the QgsIdentifyResults dialog box has been closed
void resultsDialogGone();


};

#endif

0 comments on commit 05433ca

Please sign in to comment.