adding the ability to set font in song by editable field

This commit is contained in:
Chris Cochrun 2023-10-23 14:40:54 -05:00
parent 88801c23c0
commit c97a98a3a7
2 changed files with 10 additions and 7 deletions

View file

@ -34,6 +34,7 @@ Item {
hoverEnabled: true hoverEnabled: true
/* flat: true */ /* flat: true */
onActivated: updateFont(currentText) onActivated: updateFont(currentText)
onAccepted: updateFont(currentText)
background: Presenter.TextBackground { background: Presenter.TextBackground {
control: fontBox control: fontBox
} }
@ -445,8 +446,8 @@ Item {
Presenter.SongEditorSlideList { Presenter.SongEditorSlideList {
id: songList id: songList
imageBackground: songEditorModel.backgroundType === "image" ? songEditor.background : "" imageBackground: songEditorModel.backgroundType === "image" ? song.background : ""
videoBackground: songEditorModel.backgroundType === "video" ? songEditor.background : "" videoBackground: songEditorModel.backgroundType === "video" ? song.background : ""
font: songEditorModel.font font: songEditorModel.font
fontSize: songEditorModel.fontSize fontSize: songEditorModel.fontSize
/* hTextAlignment: songEditorModel.horizontalTextAlignment */ /* hTextAlignment: songEditorModel.horizontalTextAlignment */
@ -543,6 +544,7 @@ Item {
function updateTitle(title) { function updateTitle(title) {
songProxyModel.songModel.updateTitle(songIndex, title) songProxyModel.songModel.updateTitle(songIndex, title)
song.title = title;
} }
function updateAuthor(author) { function updateAuthor(author) {
@ -590,6 +592,7 @@ Item {
} }
function updateFont(font) { function updateFont(font) {
showPassiveNotification(font);
changeSlideFont(font, false); changeSlideFont(font, false);
songProxyModel.songModel.updateFont(songIndex, font); songProxyModel.songModel.updateFont(songIndex, font);
song.font = font; song.font = font;

View file

@ -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 CxxSongs = crate::songs::song_model::qobject::SongModel; // type CxxSongs = crate::songs::song_model::qobject::SongModel;
} }
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
@ -49,8 +49,8 @@ pub mod song_editor {
font: QString, font: QString,
#[qproperty] #[qproperty]
font_size: i32, font_size: i32,
#[qproperty] // #[qproperty]
song_model: *mut CxxSongs, // song_model: *mut CxxSongs,
} }
impl Default for SongEditor { impl Default for SongEditor {
@ -69,7 +69,7 @@ pub mod song_editor {
vertical_text_alignment: QString::default(), vertical_text_alignment: QString::default(),
font: QString::default(), font: QString::default(),
font_size: 50, font_size: 50,
song_model: std::ptr::null_mut(), // song_model: std::ptr::null_mut(),
} }
} }
} }