QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsexpressionbuilderdialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgisexpressionbuilderdialog.h - A genric expression string builder dialog.
3  --------------------------------------
4  Date : 29-May-2011
5  Copyright : (C) 2011 by Nathan Woodrow
6  Email : woodrow.nathan at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
17 #include <QSettings>
18 
19 QgsExpressionBuilderDialog::QgsExpressionBuilderDialog( QgsVectorLayer* layer, QString startText, QWidget* parent )
20  : QDialog( parent )
21 {
22  setupUi( this );
23 
24  QPushButton* okButton = buttonBox->button( QDialogButtonBox::Ok );
25  connect( builder, SIGNAL( expressionParsed( bool ) ), okButton, SLOT( setEnabled( bool ) ) );
26 
27  builder->setLayer( layer );
28  builder->setExpressionText( startText );
29  builder->loadFieldNames();
30 
31  QSettings settings;
32  restoreGeometry( settings.value( "/Windows/ExpressionBuilderDialog/geometry" ).toByteArray() );
33 }
34 
36 {
37  return builder;
38 }
39 
41 {
42  builder->setExpressionText( text );
43 }
44 
46 {
47  return builder->expressionText();
48 }
49 
51 {
52  QDialog::done( r );
53 
54  QSettings settings;
55  settings.setValue( "/Windows/ExpressionBuilderDialog/geometry", saveGeometry() );
56 }
57 
59 {
60  // Store in child widget only.
61  builder->setGeomCalculator( da );
62 }