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 automatic implementations of up and downcasting #1159

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BenFordTytherington
Copy link
Collaborator

No description provided.

@BenFordTytherington BenFordTytherington force-pushed the add-up-down-casting branch 4 times, most recently from fb6ec2a to afe4181 Compare January 16, 2025 17:51
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (c8409c7) to head (6b8d457).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1159   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           71        71           
  Lines        11882     11955   +73     
=========================================
+ Hits         11882     11955   +73     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BenFordTytherington BenFordTytherington force-pushed the add-up-down-casting branch 2 times, most recently from f3b9070 to 87b9d5a Compare February 3, 2025 13:54
@BenFordTytherington BenFordTytherington marked this pull request as ready for review February 3, 2025 14:08
extern "C++" {
#[doc(hidden)]
#[namespace=""]
type QObject = cxx_qt::qobject::QObject;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if you have the same type twice in CXX 🤔 as wondering if the developer would ever write type QObject themselves too ...

.cloned()
.unwrap_or(
Name::new(format_ident!("QObject")).with_module(parse_quote! {::cxx_qt::qobject}),
); // TODO! is this default module here causing the issues in the threading examples
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still a problem? or did you solve it?

use std::{fs::File, io::Write, path::Path};

mod connection;
mod connectionguard;
pub mod qobject;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want developers to go cxx_qt::qobject::QObject or cxx_qt::QObject ? At the moment for cxx-qt-lib everything is in the root module, but we wondered if they should be split by core/gui/quick etc, wonder what we do here?

#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
// TODO! Implement QObject wrapper properly
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right and then we reach the QObject::thread() -> QThread method, which @LeonMatthesKDAB might help with that threading idea :-)

- Any bridges with qobjects that have no custom base class will get an upcasting implemention
- Adds a new include with the necessary template function for calling static_cast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants