Quantum GIS API Documentation  1.7.4
src/gui/qgssearchquerybuilder.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgssearchquerybuilder.h  - Query builder for search strings
00003     ----------------------
00004     begin                : March 2006
00005     copyright            : (C) 2006 by Martin Dobias
00006     email                : wonder.sk at gmail dot com
00007  ***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 /* $Id$ */
00016 
00017 #ifndef QGSSEARCHQUERYBUILDER_H
00018 #define QGSSEARCHQUERYBUILDER_H
00019 
00020 #include <map>
00021 #include <vector>
00022 #include <QStandardItemModel>
00023 #include <QModelIndex>
00024 
00025 #include "ui_qgsquerybuilderbase.h"
00026 #include "qgisgui.h"
00027 #include "qgscontexthelp.h"
00028 
00029 class QgsField;
00030 class QgsVectorLayer;
00031 
00037 class GUI_EXPORT QgsSearchQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
00038 {
00039     Q_OBJECT
00040 
00041   public:
00043     QgsSearchQueryBuilder( QgsVectorLayer* layer, QWidget *parent = 0,
00044                            Qt::WFlags fl = QgisGui::ModalDialogFlags );
00045 
00046     ~QgsSearchQueryBuilder();
00047 
00049     QString searchString();
00050 
00052     void setSearchString( QString searchString );
00053 
00054   public slots:
00055     void on_btnEqual_clicked();
00056     void on_btnOk_clicked();
00057     void on_btnLessThan_clicked();
00058     void on_btnGreaterThan_clicked();
00059     void on_btnLike_clicked();
00060     void on_btnILike_clicked();
00061     void on_btnPct_clicked();
00062     void on_btnIn_clicked();
00063     void on_btnNotIn_clicked();
00064 
00065     void on_lstFields_doubleClicked( const QModelIndex &index );
00066     void on_lstValues_doubleClicked( const QModelIndex &index );
00067     void on_btnLessEqual_clicked();
00068     void on_btnGreaterEqual_clicked();
00069     void on_btnNotEqual_clicked();
00070     void on_btnAnd_clicked();
00071     void on_btnNot_clicked();
00072     void on_btnOr_clicked();
00073     void on_btnClear_clicked();
00074 
00078     void on_btnTest_clicked();
00079 
00084     void on_btnGetAllValues_clicked();
00085 
00091     void on_btnSampleValues_clicked();
00092 
00093     void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
00094 
00095     void saveQuery();
00096     void loadQuery();
00097 
00098   private:
00099 
00103     void populateFields();
00107     void setupListViews();
00108 
00112     long countRecords( QString sql );
00113 
00118     void getFieldValues( int limit );
00119 
00120   private:
00121 
00123     QgsVectorLayer* mLayer;
00125     QMap<QString, int> mFieldMap;
00127     QStandardItemModel *mModelFields;
00129     QStandardItemModel *mModelValues;
00130 };
00131 #endif //QGSSEARCHQUERYBUILDER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines