Skip to content

Commit

Permalink
ticket:4369 Use the proper bracket
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Feb 6, 2018
1 parent 8f5caa0 commit 1d1f811
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/Plotting/PlotWindowContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ void PlotWindowContainer::addParametricPlotWindow()
pPlotWindow->setAutoScale(OptionsDialog::instance()->getPlottingPage()->getAutoScaleCheckBox()->isChecked());
pPlotWindow->installEventFilter(this);
QMdiSubWindow *pSubWindow = addSubWindow(pPlotWindow);

addCloseActionsToSubWindowSystemMenu(pSubWindow);
pSubWindow->setWindowIcon(QIcon(":/Resources/icons/parametric-plot-window.svg"));
pPlotWindow->show();
Expand Down Expand Up @@ -276,6 +275,7 @@ void PlotWindowContainer::addArrayPlotWindow(bool maximized)
pPlotWindow->setXLabel(QString("index"));
pPlotWindow->installEventFilter(this);
QMdiSubWindow *pSubWindow = addSubWindow(pPlotWindow);
addCloseActionsToSubWindowSystemMenu(pSubWindow);
pSubWindow->setWindowIcon(QIcon(":/Resources/icons/array-plot-window.svg"));
pPlotWindow->show();
if (maximized) {
Expand Down
42 changes: 21 additions & 21 deletions OMEdit/OMEditGUI/Plotting/VariablesWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1551,13 +1551,13 @@ void VariablesWidget::plotVariables(const QModelIndex &index, qreal curveThickne
if (xUnit.isEmpty()) {
pPlotWindow->setXLabel(xVariable);
} else {
pPlotWindow->setXLabel(xVariable + " [" + xUnit + "]");
pPlotWindow->setXLabel(xVariable + " (" + xUnit + ")");
}

if (yUnit.isEmpty()) {
pPlotWindow->setYLabel(yVariable);
} else {
pPlotWindow->setYLabel(yVariable + " [" + yUnit + "]");
pPlotWindow->setYLabel(yVariable + " (" + yUnit + ")");
}
}
if (pPlotWindow->getAutoScaleButton()->isChecked()) {
Expand Down Expand Up @@ -1620,13 +1620,13 @@ void VariablesWidget::plotVariables(const QModelIndex &index, qreal curveThickne
if (xUnit.isEmpty()) {
pPlotWindow->setXLabel(xVariable);
} else {
pPlotWindow->setXLabel(xVariable + " [" + xUnit + "]");
pPlotWindow->setXLabel(xVariable + " (" + xUnit + ")");
}

if (yUnit.isEmpty()) {
pPlotWindow->setYLabel(yVariable);
} else {
pPlotWindow->setYLabel(yVariable + " [" + yUnit + "]");
pPlotWindow->setYLabel(yVariable + " (" + yUnit + ")");
}
} else {
pPlotWindow->setXLabel("");
Expand Down Expand Up @@ -1859,32 +1859,32 @@ void VariablesWidget::selectInteractivePlotWindow(VariablesTreeItem *pVariablesT
*/
void VariablesWidget::timeUnitChanged(QString unit)
{
if (unit.isEmpty()) {
return;
}
try {
OMPlot::PlotWindow *pPlotWindow = MainWindow::instance()->getPlotWindowContainer()->getCurrentWindow();
// if still pPlotWindow is 0 then return.
if (!pPlotWindow) {
return;
}
if (pPlotWindow->getPlotType()==PlotWindow::PLOTARRAY ||
pPlotWindow->getPlotType()==PlotWindow::PLOTARRAYPARAMETRIC)
{
pPlotWindow->setTimeUnit(unit);
pPlotWindow->updateTimeText(unit);
}
else
{
OMCInterface::convertUnits_res convertUnit = MainWindow::instance()->getOMCProxy()->convertUnits(pPlotWindow->getTimeUnit(), unit);
if (convertUnit.unitsCompatible) {
foreach (PlotCurve *pPlotCurve, pPlotWindow->getPlot()->getPlotCurvesList()) {
for (int i = 0 ; i < pPlotCurve->mXAxisVector.size() ; i++) {
pPlotCurve->updateXAxisValue(i, Utilities::convertUnit(pPlotCurve->mXAxisVector.at(i), convertUnit.offset, convertUnit.scaleFactor));
}
pPlotCurve->setData(pPlotCurve->getXAxisVector(), pPlotCurve->getYAxisVector(), pPlotCurve->getSize());
pPlotWindow->getPlotType()==PlotWindow::PLOTARRAYPARAMETRIC) {
pPlotWindow->setTimeUnit(unit);
pPlotWindow->updateTimeText(unit);
} else {
OMCInterface::convertUnits_res convertUnit = MainWindow::instance()->getOMCProxy()->convertUnits(pPlotWindow->getTimeUnit(), unit);
if (convertUnit.unitsCompatible) {
foreach (PlotCurve *pPlotCurve, pPlotWindow->getPlot()->getPlotCurvesList()) {
for (int i = 0 ; i < pPlotCurve->mXAxisVector.size() ; i++) {
pPlotCurve->updateXAxisValue(i, Utilities::convertUnit(pPlotCurve->mXAxisVector.at(i), convertUnit.offset, convertUnit.scaleFactor));
}
pPlotWindow->setXLabel(QString("time [%1]").arg(unit));
pPlotWindow->setTimeUnit(unit);
pPlotWindow->getPlot()->replot();
pPlotCurve->setData(pPlotCurve->getXAxisVector(), pPlotCurve->getYAxisVector(), pPlotCurve->getSize());
}
pPlotWindow->setXLabel(QString("time (%1)").arg(unit));
pPlotWindow->setTimeUnit(unit);
pPlotWindow->getPlot()->replot();
}
}
} catch (PlotException &e) {
QMessageBox::critical(this, QString(Helper::applicationName).append(" - ").append(Helper::error), e.what(), Helper::ok);
Expand Down

0 comments on commit 1d1f811

Please sign in to comment.