Refactorings to improve code, started to refactor secion content

This commit is contained in:
Uwe Kindler
2017-02-22 22:33:48 +01:00
parent 938afb7357
commit ad49745b18
22 changed files with 301 additions and 140 deletions
@@ -13,18 +13,12 @@ SectionContentListModel::~SectionContentListModel()
{
}
void SectionContentListModel::init(ADS_NS::MainContainerWidget* cw)
void SectionContentListModel::init(ADS_NS::CMainContainerWidget* cw)
{
#if QT_VERSION >= 0x050000
beginResetModel();
_cw = cw;
_contents = _cw->contents();
endResetModel();
#else
_cw = cw;
_contents = _cw->contents();
reset();
#endif
}
int SectionContentListModel::columnCount(const QModelIndex& parent) const
@@ -9,7 +9,7 @@
#include "ads/API.h"
#include "ads/SectionContent.h"
ADS_NAMESPACE_BEGIN
class MainContainerWidget;
class CMainContainerWidget;
ADS_NAMESPACE_END
class SectionContentListModel : public QAbstractTableModel
@@ -27,7 +27,7 @@ public:
SectionContentListModel(QObject* parent);
virtual ~SectionContentListModel();
void init(ADS_NS::MainContainerWidget* cw);
void init(ADS_NS::CMainContainerWidget* cw);
virtual int columnCount(const QModelIndex &parent) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
@@ -40,7 +40,7 @@ public:
private:
QHash<int, QString> _headers;
ADS_NS::MainContainerWidget* _cw;
ADS_NS::CMainContainerWidget* _cw;
QList<ADS_NS::SectionContent::RefPtr> _contents;
};
@@ -16,7 +16,7 @@ public:
class Values
{
public:
ADS_NS::MainContainerWidget* cw;
ADS_NS::CMainContainerWidget* cw;
};
SectionContentListWidget(QWidget* parent);