Skip to content

Commit ddaab77

Browse files
author
jef
committedAug 21, 2008
fix attribute table search and delete table on close even when docked
git-svn-id: http://svn.osgeo.org/qgis/trunk@9111 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 3599fa2 commit ddaab77

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed
 

‎src/app/qgsattributetabledisplay.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@
3939
#include <QToolButton>
4040
#include <QDockWidget>
4141

42+
class QAttributeTableDock : public QDockWidget
43+
{
44+
public:
45+
QAttributeTableDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 )
46+
: QDockWidget( title, parent, flags )
47+
{
48+
}
49+
50+
virtual void closeEvent ( QCloseEvent * ev )
51+
{
52+
deleteLater();
53+
}
54+
};
55+
4256
QgsAttributeTableDisplay::QgsAttributeTableDisplay(QgsVectorLayer* layer)
4357
: QDialog(0, Qt::Window),
4458
mLayer(layer),
@@ -107,7 +121,7 @@ QgsAttributeTableDisplay::QgsAttributeTableDisplay(QgsVectorLayer* layer)
107121
bool myDockFlag = mySettings.value("/qgis/dockAttributeTable",false).toBool();
108122
if (myDockFlag )
109123
{
110-
mDock = new QDockWidget(tr("Attribute table - ") + layer->name(), QgisApp::instance());
124+
mDock = new QAttributeTableDock(tr("Attribute table - ") + layer->name(), QgisApp::instance());
111125
mDock->setAllowedAreas(Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea);
112126
mDock->setWidget(this);
113127
QgisApp::instance()->addDockWidget(Qt::BottomDockWidgetArea, mDock);
@@ -124,9 +138,11 @@ QgsAttributeTableDisplay::~QgsAttributeTableDisplay()
124138

125139
void QgsAttributeTableDisplay::closeEvent(QCloseEvent *ev)
126140
{
127-
saveWindowLocation();
141+
if(mDock==NULL)
142+
saveWindowLocation();
143+
128144
ev->ignore();
129-
delete this;
145+
deleteLater();
130146
}
131147

132148
void QgsAttributeTableDisplay::fillTable()
@@ -280,7 +296,7 @@ void QgsAttributeTableDisplay::doSearch(QString searchString)
280296

281297
mSearchIds.clear();
282298

283-
mLayer->select(mLayer->pendingAllAttributesList(), true, false);
299+
mLayer->select(mLayer->pendingAllAttributesList(), QgsRect(), false);
284300

285301
QgsFeature f;
286302
while( mLayer->getNextFeature(f) )

0 commit comments

Comments
 (0)
Please sign in to comment.