17#include "ui_qgsattributesforminitcode.h"
36 mInitFileWidget->setDefaultRoot( settings.
value( QStringLiteral(
"style/lastInitFilePathDir" ),
"." ).toString() );
37 mInitFileWidget->setDialogTitle( tr(
"Select Python File" ) );
38 mInitFileWidget->setFilter( tr(
"Python files (*.py *.PY)" ) );
40 connect( mInitCodeSourceComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsAttributesFormInitCode::mInitCodeSourceComboBox_currentIndexChanged );
41 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsAttributesFormInitCode::showHelp );
46 mInitCodeSourceComboBox->setCurrentIndex( mInitCodeSourceComboBox->findData( QVariant::fromValue( initCodeSource ) ) );
47 mInitCodeSourceComboBox_currentIndexChanged( mInitCodeSourceComboBox->currentIndex() );
60 mInitCodeEditorPython->setText(
initCode );
70 return mInitFunctionLineEdit->text();
74 return mInitFileWidget->filePath();
78 return mInitCodeEditorPython->text();
81void QgsAttributesFormInitCode::mInitCodeSourceComboBox_currentIndexChanged(
int )
90void QgsAttributesFormInitCode::showHelp()
92 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.