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