QmlDesigner: Always show all items in section model

Change-Id: Iad0ee5e39553c9cb778bfd5673378af84063f4af
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
Marco Bubke
2014-06-23 16:01:48 +02:00
parent ed03cfecf6
commit ed8677b391

View File

@@ -46,24 +46,23 @@ ItemLibrarySectionModel::~ItemLibrarySectionModel()
int ItemLibrarySectionModel::rowCount(const QModelIndex &) const int ItemLibrarySectionModel::rowCount(const QModelIndex &) const
{ {
return visibleItemCount(); return m_itemList.count();
} }
QVariant ItemLibrarySectionModel::data(const QModelIndex &index, int role) const QVariant ItemLibrarySectionModel::data(const QModelIndex &index, int role) const
{ {
if (!index.isValid() || index.row() + 1 > visibleItemCount()) { if (!index.isValid() || index.row() + 1 > m_itemList.count()) {
qDebug() << Q_FUNC_INFO << "invalid index requested"; qDebug() << Q_FUNC_INFO << "invalid index requested";
return QVariant(); return QVariant();
} }
if (m_roleNames.contains(role)) { if (m_roleNames.contains(role)) {
QList<ItemLibraryItem *> visibleItemList = visibleItems(); QVariant value = m_itemList.at(index.row())->property(m_roleNames.value(role));
QVariant value = visibleItemList.at(index.row())->property(m_roleNames.value(role));
if (ItemLibrarySectionModel* model = qobject_cast<ItemLibrarySectionModel *>(value.value<QObject*>())) if (ItemLibrarySectionModel* model = qobject_cast<ItemLibrarySectionModel *>(value.value<QObject*>()))
return QVariant::fromValue(model); return QVariant::fromValue(model);
return visibleItemList.at(index.row())->property(m_roleNames.value(role)); return m_itemList.at(index.row())->property(m_roleNames.value(role));
} }
qWarning() << Q_FUNC_INFO << "invalid role requested"; qWarning() << Q_FUNC_INFO << "invalid role requested";