17 #include "ui_qgsattributesforminitcode.h"
21 #include <QFileDialog>
29 mInitCodeSourceComboBox->addItem( QString() );
30 mInitCodeSourceComboBox->addItem( tr(
"Load from External File" ) );
31 mInitCodeSourceComboBox->addItem( tr(
"Provide Code in this Dialog" ) );
32 mInitCodeSourceComboBox->addItem( tr(
"Load from the Environment" ) );
35 mInitFileWidget->setDefaultRoot( settings.
value( QStringLiteral(
"style/lastInitFilePathDir" ),
"." ).toString() );
36 mInitFileWidget->setDialogTitle( tr(
"Select Python File" ) );
37 mInitFileWidget->setFilter( tr(
"Python files (*.py *.PY)" ) );
39 connect( mInitCodeSourceComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAttributesFormInitCode::mInitCodeSourceComboBox_currentIndexChanged );
40 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsAttributesFormInitCode::showHelp );
45 mInitCodeSourceComboBox->setCurrentIndex( initCodeSource );
46 mInitCodeSourceComboBox_currentIndexChanged( mInitCodeSourceComboBox->currentIndex() );
51 mInitFunctionLineEdit->setText( initFunction );
55 mInitFileWidget->setFilePath( initFilePath );
59 mInitCodeEditorPython->setText( initCode );
69 return mInitFunctionLineEdit->text();
73 return mInitFileWidget->filePath();
77 return mInitCodeEditorPython->text();
80 void QgsAttributesFormInitCode::mInitCodeSourceComboBox_currentIndexChanged(
int codeSource )
88 void QgsAttributesFormInitCode::showHelp()
90 QgsHelp::openHelp( QStringLiteral(
"working_with_vector/vector_properties.html#enhance-your-form-with-custom-functions" ) );