1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #ifndef QT_INPUT_GEOMETRY_HPP
- #define QT_INPUT_GEOMETRY_HPP
- #include <iostream>
- #include <fstream>
- #include <QWidget>
- #include <QVBoxLayout>
- #include <QLabel>
- #include <QLineEdit>
- #include <QDoubleValidator>
- #include <QIntValidator>
- #include <QPushButton>
- #include "geometry.hpp"
- static const double def_lX=10;
- static const size_t def_nX=100;
- static const size_t def_depth=1;
- static const size_t def_nZ=100;
- using namespace std;
- class QtInputGeometry:public QWidget{
- Q_OBJECT
- private:
- Geometry* geometry;
- QVBoxLayout* main_layout;
- QLabel* lX_label;
- QLabel* nX_label;
- QLabel* nZ_label;
- QLabel* depth_label;
- QLineEdit* lX_input;
- QLineEdit* nX_input;
- QLineEdit* nZ_input;
- QLineEdit* depth_input;
- QPushButton* refresh_button;
- QDoubleValidator* positive_double_validator;
- QIntValidator* positive_int_validator;
- public:
- QtInputGeometry(Geometry* geometry);
- ~QtInputGeometry();
- QWidget* validate();
- void save(fstream& file);
- void load(fstream& file);
- double get_lX();
- size_t get_nX();
- double get_depth();
- size_t get_nZ_max();
- public slots:
- void emitGeometryChanged();
- signals:
- void geometryChanged();
- };
- inline
- QtInputGeometry::~QtInputGeometry(){
- delete positive_double_validator;
- delete positive_int_validator;
- }
- inline void
- QtInputGeometry::emitGeometryChanged(){
- emit geometryChanged();
- }
- inline double
- QtInputGeometry::get_lX(){
- return lX_input->text().toDouble();
- }
- inline size_t
- QtInputGeometry::get_nX(){
- return nX_input->text().toULong();
- }
- inline double
- QtInputGeometry::get_depth(){
- return depth_input->text().toDouble();
- }
- inline size_t
- QtInputGeometry::get_nZ_max(){
- return nZ_input->text().toULong();
- }
- #endif
|