16#include "ui_qgsattributesforminitcode.h"
26#include "moc_qgsattributesforminitcode.cpp"
28using namespace Qt::StringLiterals;
42 mInitFileWidget->setDefaultRoot( settings.
value( u
"style/lastInitFilePathDir"_s,
"." ).toString() );
43 mInitFileWidget->setDialogTitle( tr(
"Select Python File" ) );
44 mInitFileWidget->setFilter( tr(
"Python files (*.py *.PY)" ) );
46 connect( mInitCodeSourceComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAttributesFormInitCode::mInitCodeSourceComboBox_currentIndexChanged );
47 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsAttributesFormInitCode::showHelp );
52 mInitCodeSourceComboBox->setCurrentIndex( mInitCodeSourceComboBox->findData( QVariant::fromValue( initCodeSource ) ) );
53 mInitCodeSourceComboBox_currentIndexChanged( mInitCodeSourceComboBox->currentIndex() );
65 mInitCodeEditorPython->setText(
initCode );
75 return mInitFunctionLineEdit->text();
79 return mInitFileWidget->filePath();
83 return mInitCodeEditorPython->text();
86void QgsAttributesFormInitCode::mInitCodeSourceComboBox_currentIndexChanged(
int )
95void QgsAttributesFormInitCode::showHelp()
97 QgsHelp::openHelp( u
"working_with_vector/vector_properties.html#enhance-your-form-with-custom-functions"_s );
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.
Stores settings for use within QGIS.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.