point_value_editor.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* point_value_editor.h - 2d point editor widget
  2. * Copyright (C) 2017 caryoscelus
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef STUDIO_WIDGETS_POINT_VALUE_EDITOR_H_488DD101_6F7C_5EDC_A6C7_E8DFB0A1BC20
  18. #define STUDIO_WIDGETS_POINT_VALUE_EDITOR_H_488DD101_6F7C_5EDC_A6C7_E8DFB0A1BC20
  19. #include <core/std/memory.h>
  20. #include <QDoubleSpinBox>
  21. #include <2geom/point.h>
  22. namespace rainynite::studio {
  23. class PointValueEditor : public QWidget {
  24. Q_OBJECT
  25. public:
  26. PointValueEditor(QWidget* parent = nullptr);
  27. public:
  28. inline Geom::Point value() const {
  29. return _value;
  30. }
  31. void setReadOnly(bool ro);
  32. Q_SIGNALS:
  33. void editingFinished();
  34. protected:
  35. void update_value(Geom::Point value_);
  36. private Q_SLOTS:
  37. void write_x();
  38. void write_y();
  39. private:
  40. QDoubleSpinBox* x_input;
  41. QDoubleSpinBox* y_input;
  42. Geom::Point _value;
  43. };
  44. } // namespace rainynite::studio
  45. #endif