struct updaterUpdateInfo { QString strProductName; QString strAbout; QString strVersion; QString strFileName; int nFileSize; int nFileId; QString strSHA1; QString strHttpLink;};class UpdaterUpdateData : public TModelItem<UpdaterUpdateData>{public: UpdaterUpdateData(){} QString getProductName() { return m_updateData.strProductName; } void setProductName(const QString & _strProductName) { m_updateData.strProductName = _strProductName; } ... //то же самое для остальных членов структурыprivate: updaterUpdateInfo m_updateData;}
pDataModel->setProductName(strInfoList.at(0));
class GlobalModel : public QObject { Q_OBJECTpublic: GlobalModel() { m_modelItems.resize(IModelItem::getModelItemsCount()); memset(&m_modelItems, 0, IModelItem::getModelItemsCount()); } void registerModelItem(IModelItem * _pModelItem) { m_modelItems[_pModelItem->getItemId()] = _pModelItem; } template<typename TItem> TItem * getModelItem() const { return static_cast<TItem *>(m_modelItems[TItem::ms_itemId]); }private: std::vector<IModelItem *> m_modelItems;};
memset(&m_modelItems[0], 0, IModelItem::getModelItemsCount()*sizeof(IModelItem *));