SimCenterCommon
Common functionality used within different SimCenter projects
JsonConfiguredWidget Class Reference

#include <JsonConfiguredWidget.h>

Inheritance diagram for JsonConfiguredWidget:
Collaboration diagram for JsonConfiguredWidget:

Public Member Functions

 JsonConfiguredWidget (RandomVariablesContainer *random_variables, QWidget *parent=nullptr)
 
virtual ~JsonConfiguredWidget ()
 
bool inputFromJSON (QJsonObject &rvObject) override
 
bool outputToJSON (QJsonObject &rvObject) override
 
void chooseConfigFile ()
 
JsonWidget::Type getEnumIndex (const QString &inputString) const
 
- Public Member Functions inherited from SimCenterWidget
 SimCenterWidget (QWidget *parent=0)
 
virtual ~SimCenterWidget ()
 

Protected Member Functions

virtual void initialize (const QString &configFile)
 
QWidget * generateWidgetLayout (const QJsonArray &inputArray, bool set=false) const
 
SimCenterWidgetgenerateComboBox (const QJsonValue &inputValue) const
 
SimCenterWidgetgenerateRVLineEdit (const QJsonValue &inputValue) const
 
SimCenterWidgetgenerateFileInput (const QJsonValue &inputValue) const
 
QJsonArray widgetToJson (QWidget *inputWidget)
 

Protected Attributes

QLineEdit * theConfigFile
 
RandomVariablesContainertheRVInputWidget
 
QWidget * theWidget
 

Additional Inherited Members

- Signals inherited from SimCenterWidget
void sendFatalMessage (QString message)
 sendFatalMessage signal to be emitted when object needs to shut program down More...
 
void sendErrorMessage (QString message)
 sendErrorMessage signal to be emitted when object needs to communicate error with user More...
 
void sendStatusMessage (QString message)
 sendStatusMessage signal to be emitted when object needs to communicate status with user More...
 

Detailed Description

Definition at line 54 of file JsonConfiguredWidget.h.

Constructor & Destructor Documentation

JsonConfiguredWidget::JsonConfiguredWidget ( RandomVariablesContainer random_variables,
QWidget *  parent = nullptr 
)

Create new JsonConfiguredWidget

Parameters
[in,out]random_variablesWidget to store random variables to
[in]configFileString specifying config file location
[in]parentParent widget. Defaults to null pointer

Definition at line 60 of file JsonConfiguredWidget.cpp.

virtual JsonConfiguredWidget::~JsonConfiguredWidget ( )
inlinevirtual

Default destructor

Definition at line 70 of file JsonConfiguredWidget.h.

Member Function Documentation

void JsonConfiguredWidget::chooseConfigFile ( )

Set config file based on user selection

Definition at line 109 of file JsonConfiguredWidget.cpp.

SimCenterWidget * JsonConfiguredWidget::generateComboBox ( const QJsonValue &  inputValue) const
protected

Generate combo box based on input JSON object

Parameters
[in]inputObjectJSON value describing combo box to be generated
Returns
Pointer to generated combo box

Definition at line 206 of file JsonConfiguredWidget.cpp.

SimCenterWidget * JsonConfiguredWidget::generateFileInput ( const QJsonValue &  inputValue) const
protected

Generate line edit for opening input files based on input JSON value

Parameters
[in]inputValueJSON value describing file line edit to be generated
Returns
Pointer to generated file line edit

Definition at line 216 of file JsonConfiguredWidget.cpp.

SimCenterWidget * JsonConfiguredWidget::generateRVLineEdit ( const QJsonValue &  inputValue) const
protected

Generate random variable line edit based on input JSON value

Parameters
[in]inputValueJSON value describing random variable line edit to be generated
Returns
Pointer to generated random variable line edit

Definition at line 211 of file JsonConfiguredWidget.cpp.

QWidget * JsonConfiguredWidget::generateWidgetLayout ( const QJsonArray &  inputArray,
bool  set = false 
) const
protected

Generate widget based on input JSON object

Parameters
[in]inputArrayJSON array describing widget to be generated
[in]setFlag indicating whether to set values of widgets
Returns
Pointer to generated widget

Definition at line 157 of file JsonConfiguredWidget.cpp.

JsonWidget::Type JsonConfiguredWidget::getEnumIndex ( const QString &  inputString) const

Get enum based on input string

Parameters
[in]inputStringString that should be converted to enum
Returns
Enum corresponding to input string

Definition at line 117 of file JsonConfiguredWidget.cpp.

void JsonConfiguredWidget::initialize ( const QString &  configFile)
protectedvirtual

Initialize the widget based on configuration specified in input config file

Parameters
[in]configFileJSON configuration file specifying widget layout

Definition at line 135 of file JsonConfiguredWidget.cpp.

bool JsonConfiguredWidget::inputFromJSON ( QJsonObject &  rvObject)
overridevirtual

Instantiate widget generator from input JSON object

Parameters
[in]rvObjectJSON object containing input information
Returns
Returns true if successful, false otherwise

Reimplemented from SimCenterWidget.

Definition at line 89 of file JsonConfiguredWidget.cpp.

bool JsonConfiguredWidget::outputToJSON ( QJsonObject &  rvObject)
overridevirtual

Write all current class data to JSON required to reconstruct class

Parameters
[in,out]rvObjectJSON object to write output to
Returns
Returns true if successful, false otherwise

Reimplemented from SimCenterWidget.

Definition at line 102 of file JsonConfiguredWidget.cpp.

QJsonArray JsonConfiguredWidget::widgetToJson ( QWidget *  inputWidget)
protected

Write the input widget to JSON. Assumes that widget contains only other widgets or SimCenter widgets

Parameters
[in]inputWidgetInput widget to write to JSON object
Returns
JSON object of widget

Definition at line 221 of file JsonConfiguredWidget.cpp.

Member Data Documentation

QLineEdit* JsonConfiguredWidget::theConfigFile
protected

Path to file specifying widget configuration

Definition at line 144 of file JsonConfiguredWidget.h.

RandomVariablesContainer* JsonConfiguredWidget::theRVInputWidget
protected

Widget for inputting random variables

Definition at line 145 of file JsonConfiguredWidget.h.

QWidget* JsonConfiguredWidget::theWidget
protected

Stacked widget containing inputs specified to JSON config file

Definition at line 147 of file JsonConfiguredWidget.h.


The documentation for this class was generated from the following files: