-
Notifications
You must be signed in to change notification settings - Fork 67
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
WIP: cxx-qt-lib: add serde support for types #425
base: main
Are you sure you want to change the base?
Conversation
bf59c34
to
b27b120
Compare
b27b120
to
f5d6dfc
Compare
crates/cxx-qt-lib/src/core/qdate.rs
Outdated
@@ -48,6 +48,7 @@ mod ffi { | |||
|
|||
/// The QDate class provides date functions. | |||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] | |||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | |||
#[repr(C)] | |||
pub struct QDate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we serialise as a number or the d,m,y dictionary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes gone with this. Although what format should be used? i've used {"year":2023,"month":1,"day":1}
for now but is there a standard? like should it be y,m,d ? (and same for QTime, QTimeZone, QSize eg width or w etc).
0baee32
to
36828d5
Compare
let mut bytes = QByteArray::default(); | ||
bytes.reserve(seq.size_hint().unwrap_or(0) as isize); | ||
|
||
while let Some(value) = seq.next_element::<u8>()? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this the best way to represent QByteArray?
3f740b2
to
81e446c
Compare
Side note whilst skimming this: If so, we can also keep making members of these classes public, as we don't have to worry about their order changing between minor versions. |
Right, I think ones like QPoint are unlikely to change, but as we've also seen while investigating QTimeZone that has changed it's layout in future Qt versions. Eg with |
eeb00e1
to
1a84cbd
Compare
Related to KDAB#55
1a84cbd
to
e101080
Compare
@@ -9,31 +9,247 @@ use std::mem::MaybeUninit; | |||
|
|||
#[cxx::bridge] | |||
mod ffi { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to add serde support for QColor, either with all the formats as well or converting to one of them?
e101080
to
e256740
Compare
Going to pause for 0.5 and consider if we do want to maintain this. As any change in the serde format would break 1.0 release. And if the developer can easily change it to their own types with To/From do we even need to mantain this? |
Related to #292
Requires #416