Skip to content

Commit 29be5dc

Browse files
author
wonder
committed
Advanced attribute search dialog replaced with query builder
based on Postgres' query builder. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5034 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f9257e9 commit 29be5dc

10 files changed

+432
-208
lines changed

src/core/qgssearchstring.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
* *
1717
***************************************************************************/
1818
/* $Id$ */
19-
20-
#include <qstring.h>
19+
20+
#ifndef QGSSEARCHSTRING_H
21+
#define QGSSEARCHSTRING_H
22+
23+
#include <QString>
2124

2225
class QgsSearchTreeNode;
2326

@@ -75,3 +78,4 @@ class QgsSearchString
7578
QString mParserErrorMsg;
7679
};
7780

81+
#endif

src/gui/Makefile.am

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ libqgis_guiHEADERS = \
6969
qgisinterface.h \
7070
qgsabout.h \
7171
qgsaddattrdialog.h \
72-
qgsadvancedattrsearch.h \
7372
qgsattributeaction.h \
7473
qgsattributeactiondialog.h \
7574
qgsattributedialog.h \
@@ -130,6 +129,7 @@ libqgis_guiHEADERS = \
130129
qgsrasterlayerproperties.h \
131130
qgsrubberband.h \
132131
qgsrunprocess.h \
132+
qgssearchquerybuilder.h \
133133
qgsserversourceselect.h \
134134
qgssinglesymboldialog.h \
135135
qgssinglesymbolrenderer.h \
@@ -146,7 +146,6 @@ libqgis_gui_la_MOC = \
146146
qgisinterface.moc.cpp \
147147
qgsabout.moc.cpp \
148148
qgsaddattrdialog.moc.cpp \
149-
qgsadvancedattrsearch.moc.cpp \
150149
qgsattributeactiondialog.moc.cpp \
151150
qgsattributedialog.moc.cpp \
152151
qgsattributetabledisplay.moc.cpp \
@@ -187,6 +186,7 @@ libqgis_gui_la_MOC = \
187186
qgsprojectproperties.moc.cpp \
188187
qgsrasterlayerproperties.moc.cpp \
189188
qgsrunprocess.moc.cpp \
189+
qgssearchquerybuilder.moc.cpp \
190190
qgsserversourceselect.moc.cpp \
191191
qgssinglesymboldialog.moc.cpp \
192192
qgsuniquevaluedialog.moc.cpp \
@@ -199,8 +199,7 @@ libqgis_gui_la_SOURCES = \
199199
qgisinterface.cpp \
200200
qgsabout.cpp \
201201
qgsaddattrdialog.cpp \
202-
qgsadvancedattrsearch.cpp \
203-
qgsattributeaction.cpp \
202+
qgsattributeaction.cpp \
204203
qgsattributeactiondialog.cpp \
205204
qgsattributedialog.cpp \
206205
qgsattributetable.cpp \
@@ -258,6 +257,7 @@ libqgis_gui_la_SOURCES = \
258257
qgsrasterlayerproperties.cpp \
259258
qgsrubberband.cpp \
260259
qgsrunprocess.cpp \
260+
qgssearchquerybuilder.cpp \
261261
qgsserversourceselect.cpp \
262262
qgssinglesymboldialog.cpp \
263263
qgssinglesymbolrenderer.cpp \

src/gui/qgsadvancedattrsearch.cpp

-55
This file was deleted.

src/gui/qgsadvancedattrsearch.h

-40
This file was deleted.

src/gui/qgsattributetabledisplay.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
#include "qgsapplication.h"
2323
#include "qgsaddattrdialog.h"
24-
#include "qgsadvancedattrsearch.h"
2524
#include "qgsdelattrdialog.h"
2625
#include "qgsfeature.h"
26+
#include "qgssearchquerybuilder.h"
2727
#include "qgssearchtreenode.h"
2828
#include "qgsvectorlayer.h"
2929
#include "qgsvectordataprovider.h"
@@ -252,12 +252,12 @@ void QgsAttributeTableDisplay::search()
252252

253253
void QgsAttributeTableDisplay::advancedSearch()
254254
{
255-
QgsAdvancedAttrSearch* searchDlg = new QgsAdvancedAttrSearch(this);
256-
if (searchDlg->exec())
255+
QgsSearchQueryBuilder dlg(mLayer, this);
256+
dlg.setSearchString(mSearchString);
257+
if (dlg.exec())
257258
{
258-
doSearch(searchDlg->searchString());
259+
doSearch(dlg.searchString());
259260
}
260-
delete searchDlg;
261261
}
262262

263263

@@ -287,6 +287,8 @@ void QgsAttributeTableDisplay::searchShowResultsChanged(int item)
287287

288288
void QgsAttributeTableDisplay::doSearch(const QString& searchString)
289289
{
290+
mSearchString = searchString;
291+
290292
// parse search string (and build parsed tree)
291293
QgsSearchString search;
292294
if (!search.setString(searchString))
@@ -314,7 +316,7 @@ void QgsAttributeTableDisplay::doSearch(const QString& searchString)
314316
QgsVectorDataProvider* provider = mLayer->getDataProvider();
315317
provider->reset();
316318
mSearchIds.clear();
317-
while (fet = provider->getNextFeature(true))
319+
while ((fet = provider->getNextFeature(true)))
318320
{
319321
if (searchTree->checkAgainst(fet->attributeMap()))
320322
{

src/gui/qgsattributetabledisplay.h

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ class QgsAttributeTableDisplay:public QDialog, private Ui::QgsAttributeTableBase
6666
private:
6767
/** Set the icon theme for this dialog */
6868
void setTheme();
69+
70+
QString mSearchString;
6971
};
7072

7173
#endif

0 commit comments

Comments
 (0)