adding text to the SlideObject

This commit is contained in:
Chris Cochrun 2022-07-13 14:28:51 -05:00
parent 51f8488089
commit 25b07dbab9
5 changed files with 29 additions and 17 deletions

View file

@ -138,12 +138,13 @@ Controls.Page {
presentation.loadVideo() presentation.loadVideo()
} }
print(item.text.length) print("text length: " + item.text.length);
print("text: " + item.text);
if (item.text.length === 0) { if (item.text.length === 0) {
presentation.text = [""]; SlideObject.setText("");
} }
else else
presentation.text = item.text; SlideObject.setText(item.text);
presentation.textIndex = 0; presentation.textIndex = 0;
presentation.changeSlide(); presentation.changeSlide();

View file

@ -135,15 +135,15 @@ Item {
} else { } else {
print("Next slide time"); print("Next slide time");
textIndex = 0; textIndex = 0;
clearText(); /* clearText(); */
nextSlide(); nextSlide();
} }
} else if (itemType === "video") { } else if (itemType === "video") {
clearText(); /* clearText(); */
nextSlide(); nextSlide();
} }
else if (itemType === "image") { else if (itemType === "image") {
clearText(); /* clearText(); */
nextSlide(); nextSlide();
} }
} }
@ -157,7 +157,7 @@ Item {
print(textIndex); print(textIndex);
if (itemType === "song") { if (itemType === "song") {
if (textIndex === 0) { if (textIndex === 0) {
clearText(); /* clearText(); */
nextSlide(); nextSlide();
} else if (textIndex <= root.text.length) { } else if (textIndex <= root.text.length) {
previewSlide.text = root.text[textIndex]; previewSlide.text = root.text[textIndex];
@ -165,11 +165,11 @@ Item {
--textIndex; --textIndex;
} }
} else if (itemType === "video") { } else if (itemType === "video") {
clearText(); /* clearText(); */
previousSlide(); previousSlide();
} }
else if (itemType === "image") { else if (itemType === "image") {
clearText(); /* clearText(); */
previousSlide(); previousSlide();
} }
} }
@ -185,14 +185,14 @@ Item {
print(root.text[textIndex]); print(root.text[textIndex]);
textIndex++; textIndex++;
} else if (itemType === "video") { } else if (itemType === "video") {
clearText(); /* clearText(); */
} }
else if (itemType === "image") { else if (itemType === "image") {
clearText(); /* clearText(); */
} }
} }
function clearText() { /* function clearText() { */
previewSlide.text = ""; /* previewSlide.text = ""; */
} /* } */
} }

View file

@ -28,6 +28,14 @@ Window {
videoSource: SlideObject.videoBackground videoSource: SlideObject.videoBackground
text: SlideObject.text text: SlideObject.text
Component.onCompleted: slideItem = presentationSlide /* Component.onCompleted: slideItem = presentationSlide */
}
function loadVideo() {
presentationSlide.loadVideo();
}
function stopVideo() {
presentationSlide.stopVideo()
} }
} }

View file

@ -63,6 +63,7 @@ void Slide::setText(QString text)
if (m_text == text) if (m_text == text)
return; return;
qDebug() << "####changing text to: " << text;
m_text = text; m_text = text;
emit textChanged(m_text); emit textChanged(m_text);
} }

View file

@ -13,8 +13,10 @@ class Slide : public QObject
Q_PROPERTY(QString audio READ audio WRITE setAudio NOTIFY audioChanged) Q_PROPERTY(QString audio READ audio WRITE setAudio NOTIFY audioChanged)
Q_PROPERTY(QString imageBackground READ imageBackground WRITE setImageBackground NOTIFY imageBackgroundChanged) Q_PROPERTY(QString imageBackground READ imageBackground WRITE setImageBackground NOTIFY imageBackgroundChanged)
Q_PROPERTY(QString videoBackground READ videoBackground WRITE setVideoBackground NOTIFY videoBackgroundChanged) Q_PROPERTY(QString videoBackground READ videoBackground WRITE setVideoBackground NOTIFY videoBackgroundChanged)
Q_PROPERTY(QString horizontalTextAlignment READ horizontalTextAlignment WRITE setHorizontalTextAlignment NOTIFY horizontalTextAlignmentChanged) Q_PROPERTY(QString horizontalTextAlignment READ horizontalTextAlignment
Q_PROPERTY(QString verticalTextAlignment READ verticalTextAlignment WRITE setVerticalTextAlignment NOTIFY verticalTextAlignmentChanged) WRITE setHorizontalTextAlignment NOTIFY horizontalTextAlignmentChanged)
Q_PROPERTY(QString verticalTextAlignment READ verticalTextAlignment
WRITE setVerticalTextAlignment NOTIFY verticalTextAlignmentChanged)
Q_PROPERTY(QString font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(QString font READ font WRITE setFont NOTIFY fontChanged)
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged) Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
// QML_ELEMENT // QML_ELEMENT