Avogadro::QtGui::JsonWidget#
-
class JsonWidget : public QWidget#
The JsonWidget class provides a user interface for running external scripts.
<avogadro/qtgui/jsonwidget.h>
The
JsonWidget creates a GUI to represent the options given by an script, turning JSON from the script into a form and passing the results back to the script via command-line.See also
It’s used by a range of different scripts, including:
Commands
InterfaceGenerators
Subclassed by InputGeneratorWidget, InterfaceWidget
Unnamed Group
-
virtual void updateOptions()#
Used to construct the script-specific GUI.
-
void buildOptionGui()#
Used to construct the script-specific GUI.
-
void combinedOptionRow(const QString &label1, const QString &label2, const QString &tr1, const QString &tr2, QJsonObject &options, bool bothLabels = false)#
Used to construct the script-specific GUI.
-
void addOptionRow(const QString &key, const QString &label, const QJsonValue &option)#
Used to construct the script-specific GUI.
-
QWidget *createOptionWidget(const QJsonValue &option)#
Used to construct the script-specific GUI.
-
QWidget *createStringListWidget(const QJsonObject &obj)#
Used to construct the script-specific GUI.
-
QWidget *createStringWidget(const QJsonObject &obj)#
Used to construct the script-specific GUI.
-
QWidget *createFilePathWidget(const QJsonObject &obj)#
Used to construct the script-specific GUI.
-
QWidget *createIntegerWidget(const QJsonObject &obj)#
Used to construct the script-specific GUI.
-
QWidget *createFloatWidget(const QJsonObject &obj)#
Used to construct the script-specific GUI.
-
QWidget *createBooleanWidget(const QJsonObject &obj)#
Used to construct the script-specific GUI.
-
QWidget *createTextWidget(const QJsonObject &obj)#
Used to construct the script-specific GUI.
-
QWidget *createTableWidget(const QJsonObject &obj)#
Used to construct the script-specific GUI.
Unnamed Group
-
void setOptionDefaults()#
Set the simulation settings to their default values.
-
void setOption(const QString &name, const QJsonValue &defaultValue)#
Set the simulation settings to their default values.
-
void setStringListOption(const QString &name, const QJsonValue &value)#
Set the simulation settings to their default values.
-
void setStringOption(const QString &name, const QJsonValue &value)#
Set the simulation settings to their default values.
-
void setFilePathOption(const QString &name, const QJsonValue &value)#
Set the simulation settings to their default values.
-
void setIntegerOption(const QString &name, const QJsonValue &value)#
Set the simulation settings to their default values.
-
void setFloatOption(const QString &name, const QJsonValue &value)#
Set the simulation settings to their default values.
-
void setBooleanOption(const QString &name, const QJsonValue &value)#
Set the simulation settings to their default values.
-
void setTextOption(const QString &name, const QJsonValue &value)#
Set the simulation settings to their default values.
-
void setTableOption(const QString &name, const QJsonValue &value)#
Set the simulation settings to their default values.
Public Functions
-
explicit JsonWidget(QWidget *parent_ = nullptr)#
Construct a widget that dynamically generates a GUI
-
~JsonWidget() override#
-
QJsonObject collectOptions() const#
Collect all of the user-specified options into a JSON object, to be sent to the generator script.
-
void applyOptions(const QJsonObject &opts)#
Apply the options in the passed QJsonObject to the GUI. Any widgets changed by this method will have their signals blocked while modifying their values.
-
inline bool isEmpty() const#
Protected Functions
-
QString lookupOptionType(const QString &name) const#
Given the name of a user-option in m_options, return the type string. If an error occurs, an empty string will be returned.
-
bool optionString(const QString &option, QString &value) const#
Search for an option named option and convert its value to a string.
- Parameters:
option – The name of the option.
value – String to overwrite with option value.
- Returns:
True if value is overwritten, false if the option is not found or cannot be converted to a string.
-
QString generateJobTitle() const#
Update the autogenerated job title in the GUI.