not adding song_model to song_editor

This will need to wait until I can clearly say that I've figured out
how nested qobjects is supposed to work
This commit is contained in:
Chris Cochrun 2024-01-17 10:43:48 -06:00
parent 69f053ffd3
commit b589cb2490

View file

@ -1,4 +1,4 @@
use crate::songs::song_model::song_model::SongModel; // use crate::songs::song_model::song_model::SongModel;
#[cxx_qt::bridge] #[cxx_qt::bridge]
pub mod song_editor { pub mod song_editor {
@ -16,8 +16,8 @@ pub mod song_editor {
type QStringList = cxx_qt_lib::QStringList; type QStringList = cxx_qt_lib::QStringList;
include!("cxx-qt-lib/qlist.h"); include!("cxx-qt-lib/qlist.h");
type QList_QString = cxx_qt_lib::QList<QString>; type QList_QString = cxx_qt_lib::QList<QString>;
#[cxx_name = "SongModel"] // #[cxx_name = "SongModel"]
type SongModel = crate::songs::song_model::qobject::SongModel; // type SongModel = crate::songs::song_model::qobject::SongModel;
} }
unsafe extern "RustQt" { unsafe extern "RustQt" {
@ -38,7 +38,7 @@ pub mod song_editor {
#[qproperty(i32, font_size)] #[qproperty(i32, font_size)]
#[qproperty(bool, background_exists)] #[qproperty(bool, background_exists)]
#[qproperty(bool, audio_exists)] #[qproperty(bool, audio_exists)]
#[qproperty(*mut SongModel, song_model)] // #[qproperty(*mut SongModel, song_model)]
type SongEditor = super::SongEditorRust; type SongEditor = super::SongEditorRust;
#[qinvokable] #[qinvokable]
@ -69,7 +69,7 @@ pub struct SongEditorRust {
font_size: i32, font_size: i32,
background_exists: bool, background_exists: bool,
audio_exists: bool, audio_exists: bool,
song_model: *mut SongModel, // song_model: *mut SongModel,
} }
impl Default for SongEditorRust { impl Default for SongEditorRust {
@ -90,17 +90,18 @@ impl Default for SongEditorRust {
font_size: 50, font_size: 50,
background_exists: true, background_exists: true,
audio_exists: true, audio_exists: true,
song_model: std::ptr::null_mut(), // song_model: std::ptr::null_mut(),
} }
} }
} }
impl song_editor::SongEditor { impl song_editor::SongEditor {
fn idk(mut self: Pin<&mut Self>) { fn idk(mut self: Pin<&mut Self>) {
if let Some(model) = unsafe { self.song_model().as_mut() } { // if let Some(model) = unsafe { self.song_model().as_mut() } {
let pinned_model = unsafe { Pin::new_unchecked(model) }; // let pinned_model = unsafe { Pin::new_unchecked(model) };
pinned_model.update_ccli(0, QString::from("idk")); // pinned_model.update_ccli(0, QString::from("idk"));
} // }
todo!();
} }
pub fn check_verse_order(mut self: Pin<&mut Self>) { pub fn check_verse_order(mut self: Pin<&mut Self>) {