12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #include "smthemeitemmodel.h"
- SmilesThemeItemModel::SmilesThemeItemModel(const QString &_themeSmName,
- const QString &_themeSmFile,
- const QString &_themeSmAuthor,
- const QString &_themeSmPicture,
- QObject *parent) :
- ListItem(parent),
- m_name(_themeSmName),
- m_file(_themeSmFile),
- m_author(_themeSmAuthor),
- m_picture(_themeSmPicture)
- {
- }
- void SmilesThemeItemModel::setName(const QString &_smileThemeName)
- {
- if(m_name != _smileThemeName) {
- m_name = _smileThemeName;
- emit dataChanged();
- }
- }
- void SmilesThemeItemModel::setFile(const QString &_smileThemeFile)
- {
- if(m_file != _smileThemeFile) {
- m_file = _smileThemeFile;
- emit dataChanged();
- }
- }
- void SmilesThemeItemModel::setAuthor(const QString &_smileThemeAuthor)
- {
- if(m_author != _smileThemeAuthor) {
- m_author = _smileThemeAuthor;
- emit dataChanged();
- }
- }
- void SmilesThemeItemModel::setPicture(const QString &_smileThemePicture)
- {
- if(m_picture != _smileThemePicture) {
- m_picture = _smileThemePicture;
- emit dataChanged();
- }
- }
- QHash<int, QByteArray> SmilesThemeItemModel::roleNames() const
- {
- QHash<int, QByteArray> names;
- names[smName] = "smileThemeName";
- names[smFile] = "smileThemeFile";
- names[smAuthor] = "smileThemeAuthor";
- names[smPicture] = "smileThemePicture";
- return names;
- }
- QVariant SmilesThemeItemModel::data(int role) const
- {
- switch(role) {
- case smName:
- return name();
- case smFile:
- return file();
- case smAuthor:
- return author();
- case smPicture:
- return picture();
- default:
- return QVariant();
- }
- }
|