19class EditorSettings :
public QObject
23 Q_PROPERTY (
double x READ getX WRITE setX NOTIFY xChanged)
24 Q_PROPERTY (
double y READ getY WRITE setY NOTIFY yChanged)
26 double horizontalZoomLevel READ getHorizontalZoomLevel WRITE
27 setHorizontalZoomLevel NOTIFY horizontalZoomLevelChanged)
30 EditorSettings (QObject * parent =
nullptr) : QObject (parent) { }
36 double getX ()
const {
return scroll_start_x_; }
38 Q_SIGNAL
void xChanged (
double x);
40 double getY ()
const {
return scroll_start_y_; }
42 Q_SIGNAL
void yChanged (
double y);
44 double getHorizontalZoomLevel ()
const {
return hzoom_level_; }
45 void setHorizontalZoomLevel (
double hzoom_level);
46 Q_SIGNAL
void horizontalZoomLevelChanged (
double hzoom_level);
50 double clamp_scroll_start_x (
double x);
52 double clamp_scroll_start_y (
double y);
60 friend void init_from (
62 const EditorSettings &other,
65 obj.scroll_start_x_ = other.scroll_start_x_;
66 obj.scroll_start_y_ = other.scroll_start_y_;
67 obj.hzoom_level_ = other.hzoom_level_;
71 static constexpr auto kScrollStartXKey =
"scrollStartX"sv;
72 static constexpr auto kScrollStartYKey =
"scrollStartY"sv;
73 static constexpr auto kHZoomLevelKey =
"hZoomLevel"sv;
74 friend void to_json (nlohmann::json &j,
const EditorSettings &settings);
75 friend void from_json (
const nlohmann::json &j,
EditorSettings &settings);
79 double scroll_start_x_ = 0;
82 double scroll_start_y_ = 0;
85 double hzoom_level_ = 1.0;