Skip to content

Commit

Permalink
fix attribute table search and delete table on close even when docked
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9111 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 21, 2008
1 parent 9eb67cc commit 5b26cc2
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/app/qgsattributetabledisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@
#include <QToolButton>
#include <QDockWidget>

class QAttributeTableDock : public QDockWidget
{
public:
QAttributeTableDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 )
: QDockWidget( title, parent, flags )
{
}

virtual void closeEvent ( QCloseEvent * ev )
{
deleteLater();
}
};

QgsAttributeTableDisplay::QgsAttributeTableDisplay(QgsVectorLayer* layer)
: QDialog(0, Qt::Window),
mLayer(layer),
Expand Down Expand Up @@ -107,7 +121,7 @@ QgsAttributeTableDisplay::QgsAttributeTableDisplay(QgsVectorLayer* layer)
bool myDockFlag = mySettings.value("/qgis/dockAttributeTable",false).toBool();
if (myDockFlag )
{
mDock = new QDockWidget(tr("Attribute table - ") + layer->name(), QgisApp::instance());
mDock = new QAttributeTableDock(tr("Attribute table - ") + layer->name(), QgisApp::instance());
mDock->setAllowedAreas(Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea);
mDock->setWidget(this);
QgisApp::instance()->addDockWidget(Qt::BottomDockWidgetArea, mDock);
Expand All @@ -124,9 +138,11 @@ QgsAttributeTableDisplay::~QgsAttributeTableDisplay()

void QgsAttributeTableDisplay::closeEvent(QCloseEvent *ev)
{
saveWindowLocation();
if(mDock==NULL)
saveWindowLocation();

ev->ignore();
delete this;
deleteLater();
}

void QgsAttributeTableDisplay::fillTable()
Expand Down Expand Up @@ -280,7 +296,7 @@ void QgsAttributeTableDisplay::doSearch(QString searchString)

mSearchIds.clear();

mLayer->select(mLayer->pendingAllAttributesList(), true, false);
mLayer->select(mLayer->pendingAllAttributesList(), QgsRect(), false);

QgsFeature f;
while( mLayer->getNextFeature(f) )
Expand Down

0 comments on commit 5b26cc2

Please sign in to comment.