making serviceItem aware of how many slides are in an item
This commit is contained in:
parent
278afe7989
commit
6271df91fc
4 changed files with 53 additions and 0 deletions
|
@ -49,6 +49,16 @@ ServiceItem::ServiceItem(const QString &name, const QString &type, const QString
|
|||
|
||||
}
|
||||
|
||||
ServiceItem::ServiceItem(const QString &name, const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text,
|
||||
const QString &audio, const QString &font, const int &fontSize,
|
||||
const int &slideNumber, QObject *parent)
|
||||
: QObject(parent),m_name(name),m_type(type),m_background(background),
|
||||
m_backgroundType(backgroundType),m_text(text),m_audio(audio),m_font(font),m_fontSize(fontSize),m_slideNumber(slideNumber)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString ServiceItem::name() const {
|
||||
return m_name;
|
||||
}
|
||||
|
@ -84,6 +94,10 @@ int ServiceItem::fontSize() const {
|
|||
return m_fontSize;
|
||||
}
|
||||
|
||||
int ServiceItem::slideNumber() const {
|
||||
return m_slideNumber;
|
||||
}
|
||||
|
||||
bool ServiceItem::active() const {
|
||||
return m_active;
|
||||
}
|
||||
|
@ -165,6 +179,15 @@ void ServiceItem::setFontSize(int fontSize)
|
|||
emit fontSizeChanged(m_fontSize);
|
||||
}
|
||||
|
||||
void ServiceItem::setSlideNumber(int slideNumber)
|
||||
{
|
||||
if (m_slideNumber == slideNumber)
|
||||
return;
|
||||
|
||||
m_slideNumber = slideNumber;
|
||||
emit slideNumberChanged(m_slideNumber);
|
||||
}
|
||||
|
||||
void ServiceItem::setActive(bool active)
|
||||
{
|
||||
qDebug() << "::::::::::::::::::::";
|
||||
|
|
|
@ -18,6 +18,7 @@ class ServiceItem : public QObject
|
|||
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
|
||||
Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
|
||||
Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectedChanged)
|
||||
Q_PROPERTY(int slideNumber READ slideNumber WRITE setSlideNumber NOTIFY slideNumberChanged)
|
||||
// Q_PROPERTY(Thumbnail thumbnail READ thumbnail WRITE setThumbnail NOTIFY thumbnailChanged)
|
||||
|
||||
public:
|
||||
|
@ -34,6 +35,10 @@ public:
|
|||
ServiceItem(const QString &name, const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text, const QString &audio,
|
||||
const QString &font, const int &fontSize, QObject * parent = nullptr);
|
||||
ServiceItem(const QString &name, const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text, const QString &audio,
|
||||
const QString &font, const int &fontSize, const int &slideNumber,
|
||||
QObject * parent = nullptr);
|
||||
|
||||
QString name() const;
|
||||
QString type() const;
|
||||
|
@ -45,6 +50,7 @@ public:
|
|||
int fontSize() const;
|
||||
bool active() const;
|
||||
bool selected() const;
|
||||
int slideNumber() const;
|
||||
// Thumbnail thumbnail() const;
|
||||
|
||||
void setName(QString name);
|
||||
|
@ -55,6 +61,7 @@ public:
|
|||
void setAudio(QString audio);
|
||||
void setFont(QString font);
|
||||
void setFontSize(int fontSize);
|
||||
void setSlideNumber(int slideNumber);
|
||||
void setActive(bool active);
|
||||
void setSelected(bool selected);
|
||||
|
||||
|
@ -67,6 +74,7 @@ signals:
|
|||
void audioChanged(QString audio);
|
||||
void fontChanged(QString font);
|
||||
void fontSizeChanged(int fontSize);
|
||||
void slideNumberChanged(int slideNumber);
|
||||
void activeChanged(bool active);
|
||||
void selectedChanged(bool selected);
|
||||
|
||||
|
@ -79,6 +87,7 @@ private:
|
|||
QString m_audio;
|
||||
QString m_font;
|
||||
int m_fontSize;
|
||||
int m_slideNumber;
|
||||
bool m_active;
|
||||
bool m_selected;
|
||||
};
|
||||
|
|
|
@ -316,6 +316,21 @@ void ServiceItemModel::insertItem(const int &index, const QString &name,
|
|||
qDebug() << "#################################";
|
||||
}
|
||||
|
||||
void ServiceItemModel::insertItem(const int &index, const QString &name,
|
||||
const QString &type,const QString &background,
|
||||
const QString &backgroundType,const QStringList &text,
|
||||
const QString &audio, const QString &font,
|
||||
const int &fontSize, const int &slideNumber) {
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
text, audio, font, fontSize, slideNumber);
|
||||
item->setSelected(false);
|
||||
item->setActive(false);
|
||||
insertItem(index, item);
|
||||
qDebug() << "#################################";
|
||||
qDebug() << name << type << font << fontSize << slideNumber;
|
||||
qDebug() << "#################################";
|
||||
}
|
||||
|
||||
void ServiceItemModel::removeItem(int index) {
|
||||
beginRemoveRows(QModelIndex(), index, index);
|
||||
m_items.removeAt(index);
|
||||
|
|
|
@ -23,6 +23,7 @@ public:
|
|||
AudioRole,
|
||||
FontRole,
|
||||
FontSizeRole,
|
||||
SlideNumberRole,
|
||||
ActiveRole,
|
||||
SelectedRole
|
||||
};
|
||||
|
@ -81,6 +82,11 @@ public:
|
|||
const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text,
|
||||
const QString &audio, const QString &font, const int &fontSize);
|
||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text,
|
||||
const QString &audio, const QString &font,
|
||||
const int &fontSize, const int &slideNumber);
|
||||
Q_INVOKABLE void removeItem(int index);
|
||||
Q_INVOKABLE bool moveRows(int sourceIndex, int destIndex, int count);
|
||||
Q_INVOKABLE bool moveDown(int index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue