26 #include <QGraphicsView>
27 #include <QMessageBox>
29 #include <QWheelEvent>
36 QMdiSubWindow(myParent) {
38 _viewer =
new QGraphicsView(
this);
39 _viewer->setRenderHints(QPainter::Antialiasing);
45 setAttribute(Qt::WA_DeleteOnClose,
true);
46 connect(
model(), SIGNAL(fileNameChanged (QString)),
52 connect(
model(), SIGNAL(modified(
bool)), SLOT(
modify(
bool)));
54 SLOT(updateTooltip(QString)));
55 connect(
this, SIGNAL(windowStateChanged(Qt::WindowStates, Qt::WindowStates)),
56 SLOT(
zoomFit(Qt::WindowStates, Qt::WindowStates)));
61 if (fileName.isEmpty() || fileName == QDir::homePath()) {
62 setWindowTitle(tr(
"New file")+
" [*]");
65 QFileInfo info(fileName);
66 setWindowTitle(QString(
"%1 [*]").arg(info.baseName()));
95 setWindowModified(val);
99 if(ev->modifiers() & Qt::ControlModifier) {
107 QMdiSubWindow::wheelEvent(ev);
111 if (isWindowModified() && !
model()->fileName().isEmpty()
112 && QMessageBox::question(
113 this, tr(
"Save modified content?"),
114 tr(
"Content has been modified."
115 "Do you want to save to %1 before closing?")
116 .arg(
model()->fileName()),
117 QMessageBox::Save|QMessageBox::Discard) == QMessageBox::Save)
119 QMdiSubWindow::closeEvent(clEvent);
124 if ((oldStates ^ newStates) == Qt::WindowActive)
This model wraps a ParameterFile instance and provides access to the data interpreted as a (directed)...
virtual void save(const QString &fileName="")
Save model content to a text file.
Declaration of class MainWindow.
Declaration of class GraphModel.
GraphModel * model()
get the current GraphModel
void saveFlowchart()
save flowchart to file
Declaration of class NodeHandler.
QGraphicsScene that handles all drag&drop, node move and connect events.