diff --git a/Polyhedron/demo/Polyhedron/include/QMultipleInputDialog.h b/Polyhedron/demo/Polyhedron/include/QMultipleInputDialog.h new file mode 100644 index 00000000000..17147651f29 --- /dev/null +++ b/Polyhedron/demo/Polyhedron/include/QMultipleInputDialog.h @@ -0,0 +1,53 @@ +// Note: this structure is inspired from the QInputDialog that allows +// the user to easily create a dialog to get one value (integer, +// double or string). This structure allows the user to easily create +// a form inside a QDialog to get as manu values as needed. + +#ifndef CGAL_QMULTIPLEINPUTDIALOG_H +#define CGAL_QMULTIPLEINPUTDIALOG_H + +#include +#include +#include + +class QMultipleInputDialog +{ + QDialog* dialog; + QFormLayout* form; +public: + QMultipleInputDialog (const char* name, QWidget* parent) + { + dialog = new QDialog (parent); + dialog->setWindowTitle (name); + form = new QFormLayout(dialog); + } + ~QMultipleInputDialog () + { + delete dialog; + } + + template + QObjectType* add (const char* name) + { + QObjectType* out = new QObjectType (dialog); + form->addRow (QString(name), out); + return out; + } + + int exec() + { + QDialogButtonBox* oknotok = new QDialogButtonBox + (QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, dialog); + + form->addRow (oknotok); + QObject::connect (oknotok, SIGNAL(accepted()), dialog, SLOT(accept())); + QObject::connect (oknotok, SIGNAL(rejected()), dialog, SLOT(reject())); + + return dialog->exec(); + } +}; + + + +#endif // CGAL_QMULTIPLEINPUTDIALOG_H