AvogadroLibs 1.97.0
|
The JsonWidget class provides a user interface for running external scripts. More...
#include <jsonwidget.h>
Public Member Functions | |
JsonWidget (QWidget *parent_=nullptr) | |
virtual void | setMolecule (QtGui::Molecule *mol) |
QJsonObject | collectOptions () const |
void | applyOptions (const QJsonObject &opts) |
bool | isEmpty () const |
Protected Member Functions | |
QString | lookupOptionType (const QString &name) const |
bool | optionString (const QString &option, QString &value) const |
Search for an option named option and convert its value to a string. More... | |
QString | generateJobTitle () const |
virtual void | updateOptions () |
void | buildOptionGui () |
void | combinedOptionRow (const QString &label1, const QString &label2, const QString &tr1, const QString &tr2, QJsonObject &options) |
void | addOptionRow (const QString &key, const QString &label, const QJsonValue &option) |
QWidget * | createOptionWidget (const QJsonValue &option) |
QWidget * | createStringListWidget (const QJsonObject &obj) |
QWidget * | createStringWidget (const QJsonObject &obj) |
QWidget * | createFilePathWidget (const QJsonObject &obj) |
QWidget * | createIntegerWidget (const QJsonObject &obj) |
QWidget * | createFloatWidget (const QJsonObject &obj) |
QWidget * | createBooleanWidget (const QJsonObject &obj) |
void | setOptionDefaults () |
void | setOption (const QString &name, const QJsonValue &defaultValue) |
void | setStringListOption (const QString &name, const QJsonValue &value) |
void | setStringOption (const QString &name, const QJsonValue &value) |
void | setFilePathOption (const QString &name, const QJsonValue &value) |
void | setIntegerOption (const QString &name, const QJsonValue &value) |
void | setFloatOption (const QString &name, const QJsonValue &value) |
void | setBooleanOption (const QString &name, const QJsonValue &value) |
Protected Attributes | |
QtGui::Molecule * | m_molecule |
QJsonObject | m_options |
QJsonObject | m_optionCache |
QList< QTextEdit * > | m_dirtyTextEdits |
bool | m_empty |
bool | m_batchMode |
QFormLayout * | m_currentLayout |
QWidget * | m_centralWidget |
QMap< QString, QWidget * > | m_widgets |
QMap< QString, QTextEdit * > | m_textEdits |
<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.
It's used by a range of different scripts, including:
|
explicit |
Construct a widget that dynamically generates a GUI
|
virtual |
Set the molecule used in the simulation.
Reimplemented in InputGeneratorWidget.
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.
|
protected |
Given the name of a user-option in m_options, return the type string. If an error occurs, an empty string will be returned.
|
protectedvirtual |
Used to construct the script-specific GUI.
Reimplemented in InputGeneratorWidget.
|
protected |
Used to construct the script-specific GUI.
|
protected |
Used to construct the script-specific GUI.
|
protected |
Used to construct the script-specific GUI.
|
protected |
Used to construct the script-specific GUI.
|
protected |
Used to construct the script-specific GUI.
|
protected |
Used to construct the script-specific GUI.
|
protected |
Used to construct the script-specific GUI.
|
protected |
Used to construct the script-specific GUI.
|
protected |
Used to construct the script-specific GUI.
|
protected |
Used to construct the script-specific GUI.
|
protected |
Set the simulation settings to their default values.
|
protected |
Set the simulation settings to their default values.
|
protected |
Set the simulation settings to their default values.
|
protected |
Set the simulation settings to their default values.
|
protected |
Set the simulation settings to their default values.
|
protected |
Set the simulation settings to their default values.
|
protected |
Set the simulation settings to their default values.
|
protected |
Set the simulation settings to their default values.
|
protected |
option | The name of the option. |
value | String to overwrite with option value. |
|
protected |
Update the autogenerated job title in the GUI.