Quantum GIS API Documentation
1.8
|
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 00016 #ifndef QGSSEARCHQUERYBUILDER_H 00017 #define QGSSEARCHQUERYBUILDER_H 00018 00019 #include <map> 00020 #include <vector> 00021 #include <QStandardItemModel> 00022 #include <QModelIndex> 00023 00024 #include "ui_qgsquerybuilderbase.h" 00025 #include "qgisgui.h" 00026 #include "qgscontexthelp.h" 00027 00028 class QgsField; 00029 class QgsVectorLayer; 00030 00036 class GUI_EXPORT QgsSearchQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase 00037 { 00038 Q_OBJECT 00039 00040 public: 00042 QgsSearchQueryBuilder( QgsVectorLayer* layer, QWidget *parent = 0, 00043 Qt::WFlags fl = QgisGui::ModalDialogFlags ); 00044 00045 ~QgsSearchQueryBuilder(); 00046 00048 QString searchString(); 00049 00051 void setSearchString( QString searchString ); 00052 00053 public slots: 00054 void on_btnEqual_clicked(); 00055 void on_btnOk_clicked(); 00056 void on_btnLessThan_clicked(); 00057 void on_btnGreaterThan_clicked(); 00058 void on_btnLike_clicked(); 00059 void on_btnILike_clicked(); 00060 void on_btnPct_clicked(); 00061 void on_btnIn_clicked(); 00062 void on_btnNotIn_clicked(); 00063 00064 void on_lstFields_doubleClicked( const QModelIndex &index ); 00065 void on_lstValues_doubleClicked( const QModelIndex &index ); 00066 void on_btnLessEqual_clicked(); 00067 void on_btnGreaterEqual_clicked(); 00068 void on_btnNotEqual_clicked(); 00069 void on_btnAnd_clicked(); 00070 void on_btnNot_clicked(); 00071 void on_btnOr_clicked(); 00072 void on_btnClear_clicked(); 00073 00077 void on_btnTest_clicked(); 00078 00083 void on_btnGetAllValues_clicked(); 00084 00090 void on_btnSampleValues_clicked(); 00091 00092 void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); } 00093 00094 void saveQuery(); 00095 void loadQuery(); 00096 00097 private: 00098 00102 void populateFields(); 00106 void setupListViews(); 00107 00111 long countRecords( QString sql ); 00112 00117 void getFieldValues( int limit ); 00118 00119 private: 00120 00122 QgsVectorLayer* mLayer; 00124 QMap<QString, int> mFieldMap; 00126 QStandardItemModel *mModelFields; 00128 QStandardItemModel *mModelValues; 00129 }; 00130 #endif //QGSSEARCHQUERYBUILDER_H