COPASI API
4.16.103
|
#include <CQExpressionWidget.h>
Public Types | |
enum | ExpressionType { InitialExpression, TransientExpression, ObjectiveFunctions } |
Public Slots | |
void | slotSelectObject () |
void | slotTextChanged () |
Signals | |
void | valid (bool valid) |
Public Member Functions | |
CQExpressionWidget (QWidget *parent=0, const char *name=0) | |
std::string | getExpression () const |
std::string | getFunction () const |
CQValidator< QTextEdit > * | getValidator () |
bool | isValid () |
void | setBoolean (bool isBoolean) |
void | setExpression (const std::string &expression) |
void | setExpressionType (const ExpressionType &expressionType) |
void | setFunction (const std::string &function) |
void | writeMathML (std::ostream &out) const |
~CQExpressionWidget () | |
Static Public Attributes | |
static const char | DisplayPattern [] = "\\{(([^\\\\\\}]|\\\\.)*)\\}" |
static const char | InfixPattern [] = "<(CN=([^\\\>]|\\\\.)*)>" |
Protected Member Functions | |
virtual void | dropEvent (QDropEvent *e) |
virtual void | keyPressEvent (QKeyEvent *e) |
virtual void | mouseReleaseEvent (QMouseEvent *e) |
bool | objectBoundaries (const int &position, int &left, int &right) const |
Protected Attributes | |
QColor | mChangedColor |
CQSimpleSelectionTree::ObjectClasses | mObjectClasses |
std::map< std::string, const CCopasiObject * > | mParseList |
const CCopasiObject * | mpCurrentObject |
QColor | mSavedColor |
Private Attributes | |
QTextCursor | mCursor |
CQExpressionHighlighter * | mpExpressionHighlighter |
CQValidatorExpression * | mpValidatorExpression |
CQValidatorFunction * | mpValidatorFunction |
The class for writing/editing a mathematical expression
Definition at line 117 of file CQExpressionWidget.h.
Enumeration of expression type
Enumerator | |
---|---|
InitialExpression | |
TransientExpression | |
ObjectiveFunctions |
Definition at line 180 of file CQExpressionWidget.h.
CQExpressionWidget::CQExpressionWidget | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
Definition at line 194 of file CQExpressionWidget.cpp.
References mChangedColor, mpExpressionHighlighter, mSavedColor, and slotTextChanged().
CQExpressionWidget::~CQExpressionWidget | ( | ) |
Definition at line 219 of file CQExpressionWidget.cpp.
|
protectedvirtual |
Function to handle drag leave events.
Definition at line 295 of file CQExpressionWidget.cpp.
References mCursor, and objectBoundaries().
std::string CQExpressionWidget::getExpression | ( | ) | const |
Retrieve the expression from the widget in string format
Definition at line 779 of file CQExpressionWidget.cpp.
References DisplayPattern, findObjectByDisplayName(), FROM_UTF8, CCopasiRootContainer::getConfiguration(), CCopasiRootContainer::getDatamodelList(), CCopasiObject::getObjectDataModel(), mParseList, mpCurrentObject, TO_UTF8, and CConfigurationFile::useAdvancedEditing().
Referenced by CQValidatorExpression::validate().
std::string CQExpressionWidget::getFunction | ( | ) | const |
Retrieve the function from the widget in string format
Definition at line 550 of file CQExpressionWidget.cpp.
References TO_UTF8.
Referenced by CQValidatorFunction::validate(), and writeMathML().
CQValidator< QTextEdit > * CQExpressionWidget::getValidator | ( | ) |
Definition at line 222 of file CQExpressionWidget.cpp.
References mpValidatorExpression, and mpValidatorFunction.
bool CQExpressionWidget::isValid | ( | ) |
Check validity of expression
Definition at line 885 of file CQExpressionWidget.cpp.
References mpValidatorExpression, mpValidatorFunction, and CQValidator< Type >::revalidate().
|
protectedvirtual |
Function to handle key press events.
Definition at line 331 of file CQExpressionWidget.cpp.
References CCopasiRootContainer::getConfiguration(), mCursor, objectBoundaries(), and CConfigurationFile::useAdvancedEditing().
|
protectedvirtual |
Function to handle mouse release events.
Definition at line 267 of file CQExpressionWidget.cpp.
References mCursor, and objectBoundaries().
|
protected |
Function to check whether the given cursor position is in an object. If the position is within an object left and right mark the boundaries.
const | int & position |
int | & left |
int | & right |
Definition at line 504 of file CQExpressionWidget.cpp.
References DisplayPattern.
Referenced by dropEvent(), keyPressEvent(), and mouseReleaseEvent().
void CQExpressionWidget::setBoolean | ( | bool | isBoolean | ) |
Set the boolean
bool | isBoolean |
Definition at line 874 of file CQExpressionWidget.cpp.
References mpValidatorExpression, CQValidator< Type >::revalidate(), and CQValidatorExpression::setBooleanRequired().
void CQExpressionWidget::setExpression | ( | const std::string & | expression | ) |
Set the expression for the widget
const | std::string & expression |
Definition at line 555 of file CQExpressionWidget.cpp.
References FROM_UTF8, CCopasiRootContainer::getDatamodelList(), CCopasiRootContainer::getFunctionList(), CCopasiObject::getObjectDisplayName(), InfixPattern, mCursor, mParseList, mpValidatorExpression, CCopasiDataModel::ObjectFromName(), CQValidator< Type >::revalidate(), CQValidator< Type >::saved(), and TO_UTF8.
void CQExpressionWidget::setExpressionType | ( | const ExpressionType & | expressionType | ) |
Set the type of the current expression
const | ExpressionType & expressionType |
Definition at line 869 of file CQExpressionWidget.cpp.
References mObjectClasses.
void CQExpressionWidget::setFunction | ( | const std::string & | function | ) |
Set the function for the widget
const | std::string & function |
Definition at line 530 of file CQExpressionWidget.cpp.
References FROM_UTF8, mCursor, mpValidatorFunction, and CQValidator< Type >::revalidate().
|
slot |
Slot for selecting an object
Definition at line 895 of file CQExpressionWidget.cpp.
References CQMessageBox::critical(), CQSimpleSelectionTree::filter(), FROM_UTF8, CCopasiObject::getObjectDisplayName(), CCopasiSelectionDialog::getObjectSingle(), mObjectClasses, CQExpressionHighlighter::mObjectDisplayFormat, mParseList, and mpExpressionHighlighter.
|
slot |
Slot for being activated whenever the text on Expression Widget is changed
This slot checks any characters that are newly typed on Expression Widget.
Definition at line 487 of file CQExpressionWidget.cpp.
References mpValidatorExpression, mpValidatorFunction, valid(), and CQValidator< Type >::validate().
Referenced by CQExpressionWidget().
|
signal |
Signal for being sent whenever the expression is valid
Referenced by slotTextChanged().
void CQExpressionWidget::writeMathML | ( | std::ostream & | out | ) | const |
Write display mathml of the expression into the ostream "out"
Definition at line 232 of file CQExpressionWidget.cpp.
References CFunction::createListOfParametersForMathML(), CQValidatorExpression::getExpression(), CQValidatorFunction::getFunction(), getFunction(), CMassAction::Infix, mpValidatorExpression, mpValidatorFunction, TriFalse, TriTrue, CMassAction::writeMathML(), CExpression::writeMathML(), and CFunction::writeMathML().
|
static |
Definition at line 122 of file CQExpressionWidget.h.
Referenced by getExpression(), and objectBoundaries().
|
static |
Definition at line 121 of file CQExpressionWidget.h.
Referenced by setExpression().
|
protected |
Definition at line 149 of file CQExpressionWidget.h.
Referenced by CQExpressionWidget().
|
private |
Definition at line 261 of file CQExpressionWidget.h.
Referenced by dropEvent(), keyPressEvent(), mouseReleaseEvent(), setExpression(), and setFunction().
|
protected |
Function to indicate whether we are dealing with an INITIAL or TRANSIENT expression
Definition at line 144 of file CQExpressionWidget.h.
Referenced by setExpressionType(), and slotSelectObject().
|
protected |
Definition at line 146 of file CQExpressionWidget.h.
Referenced by getExpression(), setExpression(), and slotSelectObject().
|
protected |
Definition at line 147 of file CQExpressionWidget.h.
Referenced by getExpression().
|
private |
Definition at line 260 of file CQExpressionWidget.h.
Referenced by CQExpressionWidget(), and slotSelectObject().
|
private |
Definition at line 136 of file CQExpressionWidget.h.
Referenced by getValidator(), isValid(), setBoolean(), setExpression(), slotTextChanged(), and writeMathML().
|
private |
Definition at line 138 of file CQExpressionWidget.h.
Referenced by getValidator(), isValid(), setFunction(), slotTextChanged(), and writeMathML().
|
protected |
Definition at line 148 of file CQExpressionWidget.h.
Referenced by CQExpressionWidget().