17#include "moc_qgsattributesforminitcode.cpp"
18#include "ui_qgsattributesforminitcode.h"
37 mInitFileWidget->setDefaultRoot( settings.
value( QStringLiteral(
"style/lastInitFilePathDir" ),
"." ).toString() );
38 mInitFileWidget->setDialogTitle( tr(
"Select Python File" ) );
39 mInitFileWidget->setFilter( tr(
"Python files (*.py *.PY)" ) );
41 connect( mInitCodeSourceComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAttributesFormInitCode::mInitCodeSourceComboBox_currentIndexChanged );
42 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsAttributesFormInitCode::showHelp );
47 mInitCodeSourceComboBox->setCurrentIndex( mInitCodeSourceComboBox->findData( QVariant::fromValue( initCodeSource ) ) );
48 mInitCodeSourceComboBox_currentIndexChanged( mInitCodeSourceComboBox->currentIndex() );
61 mInitCodeEditorPython->setText(
initCode );
71 return mInitFunctionLineEdit->text();
75 return mInitFileWidget->filePath();
79 return mInitCodeEditorPython->text();
82void QgsAttributesFormInitCode::mInitCodeSourceComboBox_currentIndexChanged(
int )
91void QgsAttributesFormInitCode::showHelp()
93 QgsHelp::openHelp( QStringLiteral(
"working_with_vector/vector_properties.html#enhance-your-form-with-custom-functions" ) );
AttributeFormPythonInitCodeSource
The Python init code source for attribute forms.
@ File
Load the Python code from an external file.
@ Environment
Use the Python code available in the Python environment.
@ NoSource
Do not use Python code at all.
@ Dialog
Use the Python code provided in the dialog.
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.