Skip to content

Commit

Permalink
Merge pull request #42 from rfranke/issues
Browse files Browse the repository at this point in the history
Issues
  • Loading branch information
adeas31 committed Oct 26, 2016
2 parents 05d565c + ead44e7 commit 0eb4175
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
11 changes: 5 additions & 6 deletions OMEdit/OMEditGUI/Component/ComponentProperties.cpp
Expand Up @@ -251,8 +251,8 @@ QString Parameter::getFixedState()
}

/*!
* \brief Parameter::getUnitFromDerivedClass
* Returns the unit value by reading the derived classes.
* \brief Parameter::getModifierValueFromDerivedClass
* Returns the modifier value by reading the derived classes.
* \param pComponent
* \param modifierName
* \return the modifier value.
Expand All @@ -272,14 +272,13 @@ QString Parameter::getModifierValueFromDerivedClass(Component *pComponent, QStri
* pInheritedComponent->getLibraryTreeItem()->getNameStructure() to get the correct name of inherited class.
* Also don't just return after reading from first inherited class. Check recursively.
*/
// if (!pOMCProxy->isBuiltinType(pInheritedComponent->getComponentInfo()->getClassName())) {
// return pOMCProxy->getDerivedClassModifierValue(pInheritedComponent->getComponentInfo()->getClassName(), modifierName);
// }
// return getModifierValueFromDerivedClass(pInheritedComponent, modifierName);
if (pInheritedComponent->getLibraryTreeItem() &&
!pOMCProxy->isBuiltinType(pInheritedComponent->getLibraryTreeItem()->getNameStructure())) {
modifierValue = pOMCProxy->getDerivedClassModifierValue(pInheritedComponent->getLibraryTreeItem()->getNameStructure(),
modifierName);
if (modifierValue.isEmpty()) {
modifierValue = getModifierValueFromDerivedClass(pInheritedComponent, modifierName);
}
if (!modifierValue.isEmpty()) {
return modifierValue;
}
Expand Down
8 changes: 8 additions & 0 deletions OMEdit/OMEditGUI/Plotting/VariablesWidget.cpp
Expand Up @@ -512,6 +512,10 @@ void VariablesTreeModel::insertVariablesItems(QString fileName, QString filePath
QString str = plotVariable;
str.chop((str.lastIndexOf("der(")/4)+1);
variables = StringHandler::makeVariableParts(str.mid(str.lastIndexOf("der(") + 4));
} else if (plotVariable.startsWith("previous(")) {
QString str = plotVariable;
str.chop((str.lastIndexOf("previous(")/9)+1);
variables = StringHandler::makeVariableParts(str.mid(str.lastIndexOf("previous(") + 9));
} else {
variables = StringHandler::makeVariableParts(plotVariable);
}
Expand All @@ -525,6 +529,8 @@ void VariablesTreeModel::insertVariablesItems(QString fileName, QString filePath
/* if last item */
if (variables.size() == count && plotVariable.startsWith("der(")) {
findVariable = parentVariable.isEmpty() ? fileName + ".der(" + variable + ")" : fileName + "." + parentVariable + ".der(" + variable + ")";
} else if (variables.size() == count && plotVariable.startsWith("previous(")) {
findVariable = parentVariable.isEmpty() ? fileName + ".previous(" + variable + ")" : fileName + "." + parentVariable + ".previous(" + variable + ")";
} else {
findVariable = parentVariable.isEmpty() ? fileName + "." + variable : fileName + "." + parentVariable + "." + variable;
}
Expand All @@ -550,6 +556,8 @@ void VariablesTreeModel::insertVariablesItems(QString fileName, QString filePath
/* if last item */
if (variables.size() == count && plotVariable.startsWith("der(")) {
variableData << filePath << fileName << fileName + "." + plotVariable << "der(" + variable + ")";
} else if (variables.size() == count && plotVariable.startsWith("previous(")) {
variableData << filePath << fileName << fileName + "." + plotVariable << "previous(" + variable + ")";
} else {
variableData << filePath << fileName << pParentVariablesTreeItem->getVariableName() + "." + variable << variable;
}
Expand Down
29 changes: 28 additions & 1 deletion OMEdit/OMEditGUI/Simulation/SimulationDialog.cpp
Expand Up @@ -110,6 +110,28 @@ void SimulationDialog::directSimulate(LibraryTreeItem *pLibraryTreeItem, bool la
simulate();
}

/*!
A scroll area with vertical bar and adjustment of width
See: https://forum.qt.io/topic/13374/solved-qscrollarea-vertical-scroll-only
*/
class VerticalScrollArea : public QScrollArea
{
public:
VerticalScrollArea()
{
setWidgetResizable(true);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
}

virtual bool eventFilter(QObject *o, QEvent *e)
{
if (o && o == widget() && e->type() == QEvent::Resize)
setMinimumWidth(widget()->minimumSizeHint().width() + verticalScrollBar()->width());
return QScrollArea::eventFilter(o, e);
}
};

/*!
Creates all the controls and set their layout.
*/
Expand All @@ -124,6 +146,11 @@ void SimulationDialog::setUpForm()
mpSimulationTabWidget = new QTabWidget;
// General Tab
mpGeneralTab = new QWidget;
// General Tab scroll area
mpGeneralTabScrollArea = new VerticalScrollArea;
mpGeneralTabScrollArea->setFrameShape(QFrame::NoFrame);
mpGeneralTabScrollArea->setBackgroundRole(QPalette::Base);
mpGeneralTabScrollArea->setWidget(mpGeneralTab);
// Simulation Interval
mpSimulationIntervalGroupBox = new QGroupBox(tr("Simulation Interval"));
mpStartTimeLabel = new Label(tr("Start Time:"));
Expand Down Expand Up @@ -270,7 +297,7 @@ void SimulationDialog::setUpForm()
pGeneralTabLayout->addWidget(mpLaunchAnimationCheckBox, 7, 0, 1, 3);
mpGeneralTab->setLayout(pGeneralTabLayout);
// add General Tab to Simulation TabWidget
mpSimulationTabWidget->addTab(mpGeneralTab, Helper::general);
mpSimulationTabWidget->addTab(mpGeneralTabScrollArea, Helper::general);
// Output Tab
mpOutputTab = new QWidget;
// Output Format
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/Simulation/SimulationDialog.h
Expand Up @@ -83,6 +83,7 @@ class SimulationDialog : public QDialog
QTabWidget *mpSimulationTabWidget;
// General Tab
QWidget *mpGeneralTab;
QScrollArea *mpGeneralTabScrollArea;
QGroupBox *mpSimulationIntervalGroupBox;
Label *mpStartTimeLabel;
QLineEdit *mpStartTimeTextBox;
Expand Down

0 comments on commit 0eb4175

Please sign in to comment.