123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include "smilesitemmodel.h"
- SmilesItemModel::SmilesItemModel(const QString &_smilePicture,
- const QString &_smileText,
- QObject *parent) :
- ListItem(parent),
- m_picture(_smilePicture),
- m_text(_smileText)
- {
- }
- void SmilesItemModel::setPicture( const QString &_smilePicture )
- {
- if(m_picture != _smilePicture) {
- m_picture = _smilePicture;
- emit dataChanged();
- }
- }
- void SmilesItemModel::setText( const QString &_smileText)
- {
- if(m_text != _smileText) {
- m_text = _smileText;
- emit dataChanged();
- }
- }
- QHash<int, QByteArray> SmilesItemModel::roleNames() const
- {
- QHash<int, QByteArray> names;
- names[smPicture] = "smilePicture";
- names[smText] = "smileText";
- return names;
- }
- QVariant SmilesItemModel::data(int role) const
- {
- switch(role) {
- case smPicture:
- return picture();
- case smText:
- return text();
- default:
- return QVariant();
- }
- }
- void SmilesItemModel::copy( const SmilesItemModel *item )
- {
- m_picture = item->picture();
- m_text = item->text();
- }
|