diff --git a/crates/cxx-qt-lib/src/gui/qpen.rs b/crates/cxx-qt-lib/src/gui/qpen.rs index 1ddc6fc8d..131707d8e 100644 --- a/crates/cxx-qt-lib/src/gui/qpen.rs +++ b/crates/cxx-qt-lib/src/gui/qpen.rs @@ -3,6 +3,7 @@ // // SPDX-License-Identifier: MIT OR Apache-2.0 use cxx::{type_id, ExternType}; +use std::fmt; use std::mem::MaybeUninit; #[cxx::bridge] @@ -20,6 +21,8 @@ mod ffi { type QPen = super::QPen; include!("cxx-qt-lib/qcolor.h"); type QColor = crate::QColor; + include!("cxx-qt-lib/qstring.h"); + type QString = crate::QString; /// Returns the pen's cap style. #[rust_name = "cap_style"] @@ -117,6 +120,10 @@ mod ffi { #[doc(hidden)] #[rust_name = "qpen_eq"] fn operatorEq(a: &QPen, b: &QPen) -> bool; + + #[doc(hidden)] + #[rust_name = "qpen_to_qstring"] + fn toQString(value: &QPen) -> QString; } } @@ -167,6 +174,12 @@ impl From<&ffi::PenStyle> for QPen { } } +impl fmt::Display for QPen { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", ffi::qpen_to_qstring(self)) + } +} + // Safety: // // Static checks on the C++ side to ensure the size is the same.