24 template<Relativity R>
40 explicit Pos (qreal x, qreal y)
47 template<
typename Self>
51 return Self { 0, self.P_.y () };
54 template<
typename Self>
58 return Self { self.P_.x (), 0 };
61 template<
typename Self>
63 Self
Shifted (
this const Self& self, qreal dx, qreal dy)
65 return Self { self.P_ +
Type { dx, dy } };
73 template<
typename Self>
76 return Self { p1.P_ + p2.P_ };
79 template<
typename Self>
82 return Self { p1.P_ - p2.P_ };
85 template<
typename Self>
88 return Self { p.P_ * factor };
91 template<
typename Self>
94 return Self { p.P_ / factor };
99 return P_.x () >= p.
P_.x () &&
P_.y () >= p.
P_.y ();
104 return P_.x () <= p.
P_.x () &&
P_.y () <= p.
P_.y ();
108 template<Relativity R>
125 :
R_ { topLeft.ToPointF (), bottomRight.ToPointF () }
132 requires (P::Relativity == R)
135 return P {
R_.topLeft () };
139 requires (P::Relativity == R)
142 return P {
R_.bottomRight () };
162 return R_.isEmpty ();
165 template<
typename Self>
168 return Self { r1.R_ | r2.R_ };
171 template<
typename Self>
174 return Self { r1.R_ & r2.R_ };
178 struct PageRelativePosBase;
179 struct PageAbsolutePosBase;
224 template<
typename Target,
typename SrcPos,
typename TargetPos,
typename Source,
typename Ctx>
225 Target
Convert (TargetPos (SrcPos::*posConvert) (Ctx)
const,
const Source& src,
const auto& context)
229 (src.template TopLeft<SrcPos> ().*posConvert) (context),
230 (src.template BottomRight<SrcPos> ().*posConvert) (context)
246template<LC::Monocle::Relativity R>
247class QTypeInfo<
LC::Monocle::Pos<R>> :
public QTypeInfo<QPointF> {};
249template<LC::Monocle::Relativity R>
250class QTypeInfo<
LC::Monocle::Rect<R>> :
public QTypeInfo<QRectF> {};
253class QTypeInfo<
LC::Monocle::PageRelativePosBase> :
public QTypeInfo<QPointF> {};
255class QTypeInfo<
LC::Monocle::PageAbsolutePosBase> :
public QTypeInfo<QPointF> {};
258class QTypeInfo<
LC::Monocle::PageRelativeRectBase> :
public QTypeInfo<QRectF> {};
260class QTypeInfo<
LC::Monocle::PageAbsoluteRectBase> :
public QTypeInfo<QRectF> {};
Target Convert(TargetPos(SrcPos::*posConvert)(Ctx) const, const Source &src, const auto &context)
PageRelativePosBase ToPageRelative(QSizeF) const
PageRelativeRectBase ToPageRelative(QSizeF) const
PageAbsolutePosBase ToPageAbsolute(QSizeF) const
PageAbsoluteRectBase ToPageAbsolute(QSizeF) const
bool BothGeqThan(Pos p) const
bool BothLeqThan(Pos p) const
auto ClearedY(this const Self &self)
auto ClearedX(this const Self &self)
Self operator/(this Self p, qreal factor)
Self operator-(this Self p1, Self p2)
Self operator+(this Self p1, Self p2)
Self operator*(this Self p, qreal factor)
auto operator<=>(const Pos &) const =default
static constexpr auto Relativity
Self Shifted(this const Self &self, qreal dx, qreal dy)
static constexpr auto Relativity
Rect(Pos< R > topLeft, Pos< R > bottomRight)
auto operator<=>(const Rect &) const =default
Self operator|(this const Self &r1, const Self &r2)
Self operator&(this const Self &r1, const Self &r2)