Quantum GIS API Documentation
1.8
|
00001 /*************************************************************************** 00002 qgisexpressionbuilderdialog.h - A genric expression string builder dialog. 00003 -------------------------------------- 00004 Date : 29-May-2011 00005 Copyright : (C) 2011 by Nathan Woodrow 00006 Email : woodrow.nathan 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 #include "qgsexpressionbuilderdialog.h" 00017 #include <QSettings> 00018 00019 QgsExpressionBuilderDialog::QgsExpressionBuilderDialog( QgsVectorLayer* layer, QString startText, QWidget* parent ) 00020 : QDialog( parent ) 00021 { 00022 setupUi( this ); 00023 00024 QPushButton* okButuon = buttonBox->button( QDialogButtonBox::Ok ); 00025 connect( builder, SIGNAL( expressionParsed( bool ) ), okButuon, SLOT( setEnabled( bool ) ) ); 00026 00027 builder->setLayer( layer ); 00028 builder->setExpressionText( startText ); 00029 builder->loadFieldNames(); 00030 00031 QSettings settings; 00032 restoreGeometry( settings.value( "/Windows/ExpressionBuilderDialog/geometry" ).toByteArray() ); 00033 } 00034 00035 QgsExpressionBuilderWidget* QgsExpressionBuilderDialog::expressionBuilder() 00036 { 00037 return builder; 00038 } 00039 00040 void QgsExpressionBuilderDialog::setExpressionText( const QString& text ) 00041 { 00042 builder->setExpressionText( text ); 00043 } 00044 00045 QString QgsExpressionBuilderDialog::expressionText() 00046 { 00047 return builder->expressionText(); 00048 } 00049 00050 void QgsExpressionBuilderDialog::closeEvent( QCloseEvent *event ) 00051 { 00052 QDialog::closeEvent( event ); 00053 00054 // TODO Work out why this is not working yet. 00055 QSettings settings; 00056 settings.setValue( "/Windows/ExpressionBuilderDialog/geometry", saveGeometry() ); 00057 }