void MainWindow::minimizeSubWindows(SubWindow::Type type) { QList<QMdiSubWindow *> subList = _mdiArea->subWindowList(); for (int i = 0; i < subList.size(); ++i) { SubWindow *subWindow = dynamic_cast<SubWindow*>(subList[i]); if (subWindow && subWindow->type() == type) subWindow->showMinimized(); } }
PlotWidget* MainWindow::createPlotWidget(QString title) { SubWindow *subWindow = new SubWindow(_mdiArea, title, SubWindow::SimulationOutput); QwtPlot *plot = new QwtPlot(subWindow); subWindow->setWidget(plot); return new PlotWidget(plot, subWindow); }
void Menu::about() { SubWindow sb; sb.init(sf::Vector2i(446, 446), sf::Vector2i(62, 62)); sb.add(Sprite::instance()->getSprite("About_Info"), sf::Vector2i(0, 446)); sb.show(); }
PlotWidget* MainWindow::createPlotWidget(QString title) { SubWindow *subWindow = new SubWindow(_mdiArea, title); subWindow->setType(SubWindow::Output); QwtPlot *plot = new QwtPlot(_mdiArea); subWindow->setWidget(plot); return new PlotWidget(plot, subWindow); }
QList<SubWindow*> MainWindow::subWindowList(SubWindow::Type type) { QList<QMdiSubWindow *> candidates = _mdiArea->subWindowList(); QList<SubWindow*> result; for (int i = 0; i < candidates.size(); ++i) { SubWindow *win = dynamic_cast<SubWindow*>(candidates[i]); if (win && win->type() == type) result << win; } return result; }
void OutputDestinationMakerQwt::createDestination(Output *output) { SubWindow *subWindow = new SubWindow(_mdiArea, output->title()); subWindow->setType(SubWindow::Output); QwtPlot *plot = new QwtPlot(_mdiArea); subWindow->setWidget(plot); OutputDestination *destination = new OutputDestinationQwt(plot, subWindow, output); output->connectVariables(destination); }
void ToolFrame::bindClient(SubWindow &client_) { guardDead(); client=&client_; client_ac=client_.getAliveControl(); }
void MainWindow::doWindowsSaveGraphics() { QString path = FileLocations::location(FileLocationInfo::Output).absolutePath(); QList<QMdiSubWindow *> windows = _mdiArea->subWindowList(); int fileNo = 0; try { for (int i = 0; i < windows.size(); ++i) { SubWindow *subWindow = dynamic_cast<SubWindow*>(windows[i]); if (!subWindow) continue; if (subWindow->type() == SubWindow::SimulationOutput) { QPixmap pixmap = windows[i]->widget()->grab(); if (pixmap.isNull()) throw Exception("Could not grab graphics for saving"); QString filePath = QString("%1/%2-graphics-%3.png").arg(path).arg(++fileNo).arg(rinse(windows[i]->windowTitle())); bool ok = pixmap.save(filePath); if (!ok) throw Exception("Could not save graphics file to:\n" + filePath); } else if (subWindow->type() == SubWindow::ModelView) { QString sourceFilePath = liveSim->graphFilePath(); QString destFilePath = QString("%1/%2-model diagram.png").arg(path).arg(++fileNo); QFile::remove(destFilePath); bool ok = QFile::copy(sourceFilePath, destFilePath); if (!ok) throw Exception("Could not write file with model diagram to:\n" + destFilePath); } } } catch (UniSim::Exception &ex) { showErrorMessage(ex); } if (fileNo == 0) showErrorMessage("No graphics found on screen for saving"); else showErrorMessage(QString("%1 file(s) written to folder %2").arg(fileNo).arg(path)); }
void MainWindow::viewModel() { // if (!viewModelSubWindow) SubWindow *viewModelSubWindow = new SubWindow(_mdiArea, "Model view", SubWindow::ModelView); imageLabel = new QLabel; imageLabel->setBackgroundRole(QPalette::Base); imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); imageLabel->setScaledContents(true); scrollArea = new QScrollArea; scrollArea->setBackgroundRole(QPalette::Dark); scrollArea->setWidget(imageLabel); viewModelSubWindow->setWidget(scrollArea); QImage image(liveSim->graphFilePath()); imageLabel->setPixmap(QPixmap::fromImage(image)); scaleFactor = 1.0; scrollArea->setWidgetResizable(true); viewModelSubWindow->adjustSize(); viewModelSubWindow->showMaximized(); }
void FileLocationsWidget::doClose() { SubWindow *window = dynamic_cast<SubWindow*>(parent()); Q_ASSERT(window); window->close(); }