mirror of https://github.com/CGAL/cgal
Add the necessary to allow persistence between calls
This commit is contained in:
parent
6212a25eac
commit
7ad693501b
|
|
@ -296,7 +296,7 @@ MainWindow::MainWindow()
|
||||||
//
|
//
|
||||||
// Manual handling of actions
|
// Manual handling of actions
|
||||||
//
|
//
|
||||||
QObject::connect(this->actionExit, SIGNAL(triggered()),
|
QObject::connect(this->actionQuit, SIGNAL(triggered()),
|
||||||
this, SLOT(close()));
|
this, SLOT(close()));
|
||||||
|
|
||||||
// We put mutually exclusive actions in an QActionGroup
|
// We put mutually exclusive actions in an QActionGroup
|
||||||
|
|
@ -329,7 +329,7 @@ MainWindow::MainWindow()
|
||||||
this->addAboutDemo(":/cgal/help/about_Constrained_Delaunay_triangulation_2.html");
|
this->addAboutDemo(":/cgal/help/about_Constrained_Delaunay_triangulation_2.html");
|
||||||
this->addAboutCGAL();
|
this->addAboutCGAL();
|
||||||
|
|
||||||
this->addRecentFiles(this->menuFile, this->actionExit);
|
this->addRecentFiles(this->menuFile, this->actionQuit);
|
||||||
connect(this, SIGNAL(openRecentFile(QString)),
|
connect(this, SIGNAL(openRecentFile(QString)),
|
||||||
this, SLOT(open(QString)));
|
this, SLOT(open(QString)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>29</height>
|
<height>19</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile" >
|
<widget class="QMenu" name="menuFile" >
|
||||||
|
|
@ -90,7 +90,7 @@
|
||||||
<addaction name="actionLoadConstraints" />
|
<addaction name="actionLoadConstraints" />
|
||||||
<addaction name="actionSaveConstraints" />
|
<addaction name="actionSaveConstraints" />
|
||||||
<addaction name="separator" />
|
<addaction name="separator" />
|
||||||
<addaction name="actionExit" />
|
<addaction name="actionQuit" />
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuEdit" >
|
<widget class="QMenu" name="menuEdit" >
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
|
|
@ -130,7 +130,7 @@
|
||||||
<string>About &CGAL</string>
|
<string>About &CGAL</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionExit" >
|
<action name="actionQuit" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>&Quit</string>
|
<string>&Quit</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ public slots:
|
||||||
|
|
||||||
void on_actionRecenter_triggered();
|
void on_actionRecenter_triggered();
|
||||||
|
|
||||||
|
void open(const QString& fileName);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
|
|
@ -140,7 +141,8 @@ MainWindow::MainWindow()
|
||||||
//
|
//
|
||||||
// Manual handling of actions
|
// Manual handling of actions
|
||||||
//
|
//
|
||||||
QObject::connect(this->actionExit, SIGNAL(triggered()),
|
|
||||||
|
QObject::connect(this->actionQuit, SIGNAL(triggered()),
|
||||||
this, SLOT(close()));
|
this, SLOT(close()));
|
||||||
|
|
||||||
// We put mutually exclusive actions in an QActionGroup
|
// We put mutually exclusive actions in an QActionGroup
|
||||||
|
|
@ -173,6 +175,10 @@ MainWindow::MainWindow()
|
||||||
this->setupOptionsMenu();
|
this->setupOptionsMenu();
|
||||||
this->addAboutDemo(":/cgal/help/about_Delaunay_triangulation_2.html");
|
this->addAboutDemo(":/cgal/help/about_Delaunay_triangulation_2.html");
|
||||||
this->addAboutCGAL();
|
this->addAboutCGAL();
|
||||||
|
|
||||||
|
this->addRecentFiles(this->menuFile, this->actionQuit);
|
||||||
|
connect(this, SIGNAL(openRecentFile(QString)),
|
||||||
|
this, SLOT(open(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -310,6 +316,16 @@ MainWindow::on_actionLoadPoints_triggered()
|
||||||
tr("Open Points file"),
|
tr("Open Points file"),
|
||||||
".");
|
".");
|
||||||
if(! fileName.isEmpty()){
|
if(! fileName.isEmpty()){
|
||||||
|
open(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MainWindow::open(const QString& fileName)
|
||||||
|
{
|
||||||
|
// wait cursor
|
||||||
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
std::ifstream ifs(qPrintable(fileName));
|
std::ifstream ifs(qPrintable(fileName));
|
||||||
|
|
||||||
K::Point_2 p;
|
K::Point_2 p;
|
||||||
|
|
@ -319,11 +335,13 @@ MainWindow::on_actionLoadPoints_triggered()
|
||||||
}
|
}
|
||||||
dt.insert(points.begin(), points.end());
|
dt.insert(points.begin(), points.end());
|
||||||
|
|
||||||
|
// default cursor
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
this->addToRecentFiles(fileName);
|
||||||
actionRecenter->trigger();
|
actionRecenter->trigger();
|
||||||
emit(changed());
|
emit(changed());
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::on_actionSavePoints_triggered()
|
MainWindow::on_actionSavePoints_triggered()
|
||||||
|
|
@ -358,6 +376,10 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
app.setOrganizationDomain("geometryfactory.com");
|
||||||
|
app.setOrganizationName("GeometryFactory");
|
||||||
|
app.setApplicationName("Delaunay_triangulation_2 demo");
|
||||||
|
|
||||||
// Import resources from libCGALQt4.
|
// Import resources from libCGALQt4.
|
||||||
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
|
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
|
||||||
Q_INIT_RESOURCE(File);
|
Q_INIT_RESOURCE(File);
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>29</height>
|
<height>19</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile" >
|
<widget class="QMenu" name="menuFile" >
|
||||||
|
|
@ -90,7 +90,7 @@
|
||||||
<addaction name="actionLoadPoints" />
|
<addaction name="actionLoadPoints" />
|
||||||
<addaction name="actionSavePoints" />
|
<addaction name="actionSavePoints" />
|
||||||
<addaction name="separator" />
|
<addaction name="separator" />
|
||||||
<addaction name="actionExit" />
|
<addaction name="actionQuit" />
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuEdit" >
|
<widget class="QMenu" name="menuEdit" >
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
<string>About &CGAL</string>
|
<string>About &CGAL</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionExit" >
|
<action name="actionQuit" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>&Quit</string>
|
<string>&Quit</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ MainWindow::MainWindow()
|
||||||
QObject::connect(this, SIGNAL(changed()),
|
QObject::connect(this, SIGNAL(changed()),
|
||||||
dgi, SLOT(modelChanged()));
|
dgi, SLOT(modelChanged()));
|
||||||
|
|
||||||
dgi->setVerticesPen(QPen(Qt::red, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
dgi->setVerticesPen(QPen(Qt::red, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
scene.addItem(dgi);
|
scene.addItem(dgi);
|
||||||
|
|
||||||
// Add a GraphicItem for the Powerdiagram diagram
|
// Add a GraphicItem for the Powerdiagram diagram
|
||||||
|
|
@ -290,6 +290,10 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
app.setOrganizationDomain("geometryfactory.com");
|
||||||
|
app.setOrganizationName("GeometryFactory");
|
||||||
|
app.setApplicationName("Regular_triangulation_2 demo");
|
||||||
|
|
||||||
// Import resources from libCGALQt4.
|
// Import resources from libCGALQt4.
|
||||||
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
|
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
|
||||||
Q_INIT_RESOURCE(File);
|
Q_INIT_RESOURCE(File);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue