trying to add slide class as master controller for the slide

This commit is contained in:
Chris Cochrun 2022-07-11 09:36:18 -05:00
parent 99afdd0b0f
commit 12a5b0bcf1
8 changed files with 220 additions and 4 deletions

71
src/slide.h Normal file
View file

@ -0,0 +1,71 @@
#ifndef SLIDE_H
#define SLIDE_H
#include <qobjectdefs.h>
#include <qqml.h>
#include <QObject>
#include <qobject.h>
class Slide : public QObject
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
Q_PROPERTY(QString audio READ audio WRITE setAudio NOTIFY audioChanged)
Q_PROPERTY(QString imageBackground READ imageBackground WRITE setImageBackground NOTIFY imageBackgroundChanged)
Q_PROPERTY(QString videoBackground READ videoBackground WRITE setVideoBackground NOTIFY videoBackgroundChanged)
Q_PROPERTY(QString horizontalTextAlignment READ horizontalTextAlignment 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(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
QML_ELEMENT
public:
explicit Slide(QObject *parent = nullptr);
Slide(const QString &text, const QString &audio, const QString &imageBackground, const QString &videoBackground,
const QString &horizontalTextAlignment, const QString &verticalTextAlignment,
const QString &font, const int &fontSize, QObject * parent = nullptr);
QString text() const;
QString audio() const;
QString imageBackground() const;
QString videoBackground() const;
QString horizontalTextAlignment() const;
QString verticalTextAlignment() const;
QString font() const;
int fontSize() const;
Q_INVOKABLE void setText(QString text);
Q_INVOKABLE void setAudio(QString audio);
Q_INVOKABLE void setImageBackground(QString imageBackground);
Q_INVOKABLE void setVideoBackground(QString videoBackground);
Q_INVOKABLE void setHorizontalTextAlignment(QString horizontalTextAlignment);
Q_INVOKABLE void setVerticalTextAlignment(QString verticalTextAlignment);
Q_INVOKABLE void setFont(QString font);
Q_INVOKABLE void setFontSize(int fontSize);
// Q_INVOKABLE void changeSlide(int index);
// Q_INVOKABLE void nextSlide();
signals:
Q_INVOKABLE void textChanged(QString text);
Q_INVOKABLE void audioChanged(QString audio);
Q_INVOKABLE void imageBackgroundChanged(QString imageBackground);
Q_INVOKABLE void videoBackgroundChanged(QString videoBackground);
Q_INVOKABLE void horizontalTextAlignmentChanged(QString horizontalTextAlignment);
Q_INVOKABLE void verticalTextAlignmentChanged(QString verticalTextAlignment);
Q_INVOKABLE void fontChanged(QString font);
Q_INVOKABLE void fontSizeChanged(int fontSize);
private:
int m_id;
QString m_text;
QString m_audio;
QString m_imageBackground;
QString m_videoBackground;
QString m_horizontalTextAlignment;
QString m_verticalTextAlignment;
QString m_font;
int m_fontSize;
};
#endif //SLIDE_H