mirror of https://github.com/CGAL/cgal
Make the cancel button of the "insert random points" dialog work.
This commit is contained in:
parent
c25131529f
commit
451268657e
|
|
@ -588,10 +588,20 @@ MainWindow::on_actionInsertRandomPoints_triggered()
|
||||||
CGAL::Qt::Converter<K> convert;
|
CGAL::Qt::Converter<K> convert;
|
||||||
Iso_rectangle_2 isor = convert(rect);
|
Iso_rectangle_2 isor = convert(rect);
|
||||||
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg(isor.min(), isor.max());
|
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg(isor.min(), isor.max());
|
||||||
|
bool ok = false;
|
||||||
const int number_of_points =
|
const int number_of_points =
|
||||||
QInputDialog::getInteger(this,
|
QInputDialog::getInteger(this,
|
||||||
tr("Number of random points"),
|
tr("Number of random points"),
|
||||||
tr("Enter number of random points"), 100, 0);
|
tr("Enter number of random points"),
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
std::numeric_limits<int>::max(),
|
||||||
|
1,
|
||||||
|
&ok);
|
||||||
|
|
||||||
|
if(!ok) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// wait cursor
|
// wait cursor
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
|
|
||||||
|
|
@ -267,25 +267,24 @@ MainWindow::on_actionClear_triggered()
|
||||||
void
|
void
|
||||||
MainWindow::on_actionInsertRandomPoints_triggered()
|
MainWindow::on_actionInsertRandomPoints_triggered()
|
||||||
{
|
{
|
||||||
CGAL::Qt::Converter<K> convert;
|
QRectF rect = CGAL::Qt::viewportsBbox(&scene);
|
||||||
QRectF rect;
|
CGAL::Qt::Converter<K> convert;
|
||||||
QList<QGraphicsView *> views = scene.views();
|
|
||||||
for (int i = 0; i < views.size(); ++i) {
|
|
||||||
QGraphicsView *view = views.at(i);
|
|
||||||
QRect vprect = view->viewport()->rect();
|
|
||||||
QPoint tl = vprect.topLeft();
|
|
||||||
QPoint br = vprect.bottomRight();
|
|
||||||
QPointF tlf = view->mapToScene(tl);
|
|
||||||
QPointF brf = view->mapToScene(br);
|
|
||||||
rect |= QRectF(tlf, brf);
|
|
||||||
}
|
|
||||||
|
|
||||||
Iso_rectangle_2 isor = convert(rect);
|
Iso_rectangle_2 isor = convert(rect);
|
||||||
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg(isor.min(), isor.max());
|
CGAL::Random_points_in_iso_rectangle_2<Point_2> pg(isor.min(), isor.max());
|
||||||
|
bool ok = false;
|
||||||
const int number_of_points =
|
const int number_of_points =
|
||||||
QInputDialog::getInteger(this,
|
QInputDialog::getInteger(this,
|
||||||
tr("Number of random points"),
|
tr("Number of random points"),
|
||||||
tr("Enter number of random points"), 100, 0);
|
tr("Enter number of random points"),
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
std::numeric_limits<int>::max(),
|
||||||
|
1,
|
||||||
|
&ok);
|
||||||
|
|
||||||
|
if(!ok) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// wait cursor
|
// wait cursor
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue