Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PartialEq #84

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions crates/cxx-qt-lib/src/gui/qfont.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ mod ffi {
#[doc(hidden)]
#[rust_name = "qfont_clone"]
fn construct(font: &QFont) -> QFont;

#[doc(hidden)]
#[rust_name = "qfont_eq"]
fn operatorEq(a: &QFont, b: &QFont) -> bool;
}
}

Expand Down Expand Up @@ -291,6 +295,14 @@ impl Clone for QFont {
}
}

impl PartialEq for QFont {
fn eq(&self, other: &Self) -> bool {
ffi::qfont_eq(self, other)
}
}

impl Eq for QFont {}

impl QFont {
/// Returns the bounding rectangle of the current clip if there is a clip;
/// otherwise returns `None`. Note that the clip region is given in logical coordinates.
Expand Down
12 changes: 12 additions & 0 deletions crates/cxx-qt-lib/src/gui/qimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ mod ffi {
#[doc(hidden)]
#[rust_name = "qimage_cache_key"]
fn qimageCacheKey(image: &QImage) -> i64;

#[doc(hidden)]
#[rust_name = "qimage_eq"]
fn operatorEq(a: &QImage, b: &QImage) -> bool;
}
}

Expand Down Expand Up @@ -270,6 +274,14 @@ impl Default for QImage {
}
}

impl PartialEq for QImage {
fn eq(&self, other: &Self) -> bool {
ffi::qimage_eq(self, other)
}
}

impl Eq for QImage {}

// Safety:
//
// Static checks on the C++ side to ensure the size & alignment is the same.
Expand Down
12 changes: 12 additions & 0 deletions crates/cxx-qt-lib/src/gui/qpainterpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ mod ffi {
#[doc(hidden)]
#[rust_name = "qpainterpath_drop"]
fn drop(painterPath: &mut QPainterPath);

#[doc(hidden)]
#[rust_name = "qpainterpath_eq"]
fn operatorEq(a: &QPainterPath, b: &QPainterPath) -> bool;
}
}

Expand Down Expand Up @@ -222,6 +226,14 @@ impl From<&QPointF> for QPainterPath {
}
}

impl PartialEq for QPainterPath {
fn eq(&self, other: &Self) -> bool {
ffi::qpainterpath_eq(self, other)
}
}

impl Eq for QPainterPath {}

// Safety:
//
// Static checks on the C++ side to ensure the size is the same.
Expand Down
12 changes: 12 additions & 0 deletions crates/cxx-qt-lib/src/gui/qpen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ mod ffi {
#[doc(hidden)]
#[rust_name = "qpen_clone"]
fn construct(pen: &QPen) -> QPen;

#[doc(hidden)]
#[rust_name = "qpen_eq"]
fn operatorEq(a: &QPen, b: &QPen) -> bool;
}
}

Expand Down Expand Up @@ -143,6 +147,14 @@ impl Clone for QPen {
}
}

impl PartialEq for QPen {
fn eq(&self, other: &Self) -> bool {
ffi::qpen_eq(self, other)
}
}

impl Eq for QPen {}

impl From<&ffi::QColor> for QPen {
fn from(color: &ffi::QColor) -> Self {
ffi::qpen_init_from_qcolor(color)
Expand Down
12 changes: 12 additions & 0 deletions crates/cxx-qt-lib/src/gui/qpolygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ mod ffi {
#[doc(hidden)]
#[rust_name = "qpolygon_clone"]
fn construct(p: &QPolygon) -> QPolygon;

#[doc(hidden)]
#[rust_name = "qpolygon_eq"]
fn operatorEq(a: &QPolygon, b: &QPolygon) -> bool;
}
}

Expand Down Expand Up @@ -107,6 +111,14 @@ impl Clone for QPolygon {
}
}

impl PartialEq for QPolygon {
fn eq(&self, other: &Self) -> bool {
ffi::qpolygon_eq(self, other)
}
}

impl Eq for QPolygon {}

// Safety:
//
// Static checks on the C++ side to ensure the size is the same.
Expand Down
12 changes: 12 additions & 0 deletions crates/cxx-qt-lib/src/gui/qpolygonf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ mod ffi {
#[doc(hidden)]
#[rust_name = "qpolygonf_clone"]
fn construct(p: &QPolygonF) -> QPolygonF;

#[doc(hidden)]
#[rust_name = "qpolygonf_eq"]
fn operatorEq(a: &QPolygonF, b: &QPolygonF) -> bool;
}
}

Expand Down Expand Up @@ -110,6 +114,14 @@ impl Clone for QPolygonF {
}
}

impl PartialEq for QPolygonF {
fn eq(&self, other: &Self) -> bool {
ffi::qpolygonf_eq(self, other)
}
}

impl Eq for QPolygonF {}

// Safety:
//
// Static checks on the C++ side to ensure the size is the same.
Expand Down
Loading