File tree Expand file tree Collapse file tree
crates/cxx-qt-lib/src/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66use crate :: QPoint ;
77use cxx:: { type_id, ExternType } ;
8+ use std:: fmt;
89
910#[ cxx:: bridge]
1011mod ffi {
@@ -13,6 +14,8 @@ mod ffi {
1314 type QLine = super :: QLine ;
1415 include ! ( "cxx-qt-lib/qpoint.h" ) ;
1516 type QPoint = crate :: QPoint ;
17+ include ! ( "cxx-qt-lib/qstring.h" ) ;
18+ type QString = crate :: QString ;
1619
1720 /// Returns the line's start point.
1821 fn p1 ( self : & QLine ) -> QPoint ;
@@ -79,6 +82,10 @@ mod ffi {
7982 #[ doc( hidden) ]
8083 #[ rust_name = "qline_new" ]
8184 fn construct ( pt1 : QPoint , pt2 : QPoint ) -> QLine ;
85+
86+ #[ doc( hidden) ]
87+ #[ rust_name = "qline_to_qstring" ]
88+ fn toQString ( value : & QLine ) -> QString ;
8289 }
8390}
8491
@@ -104,6 +111,12 @@ impl Default for QLine {
104111 }
105112}
106113
114+ impl fmt:: Display for QLine {
115+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
116+ write ! ( f, "{}" , ffi:: qline_to_qstring( self ) )
117+ }
118+ }
119+
107120// Safety:
108121//
109122// Static checks on the C++ side ensure that QLine is trivial.
Original file line number Diff line number Diff line change 66use crate :: QLine ;
77use crate :: QPointF ;
88use cxx:: { type_id, ExternType } ;
9+ use std:: fmt;
910
1011#[ cxx:: bridge]
1112mod ffi {
@@ -16,6 +17,8 @@ mod ffi {
1617 type QLine = crate :: QLine ;
1718 include ! ( "cxx-qt-lib/qpointf.h" ) ;
1819 type QPointF = crate :: QPointF ;
20+ include ! ( "cxx-qt-lib/qstring.h" ) ;
21+ type QString = crate :: QString ;
1922
2023 /// Returns the angle of the line in degrees.
2124 fn angle ( self : & QLineF ) -> f64 ;
@@ -121,6 +124,10 @@ mod ffi {
121124 #[ doc( hidden) ]
122125 #[ rust_name = "qlinef_from_qline" ]
123126 fn construct ( line : & QLine ) -> QLineF ;
127+
128+ #[ doc( hidden) ]
129+ #[ rust_name = "qlinef_to_qstring" ]
130+ fn toQString ( value : & QLineF ) -> QString ;
124131 }
125132}
126133
@@ -161,6 +168,12 @@ impl From<QLineF> for ffi::QLine {
161168 }
162169}
163170
171+ impl fmt:: Display for QLineF {
172+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
173+ write ! ( f, "{}" , ffi:: qlinef_to_qstring( self ) )
174+ }
175+ }
176+
164177// Safety:
165178//
166179// Static checks on the C++ side ensure that QLineF is trivial.
You can’t perform that action at this time.
0 commit comments