forked from qt-creator/qt-creator
QmlOutline: Show id/name/property values only if filter is active
This commit is contained in:
@@ -40,6 +40,18 @@ bool QmlJSOutlineFilterModel::filterAcceptsRow(int sourceRow,
|
||||
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
|
||||
}
|
||||
|
||||
QVariant QmlJSOutlineFilterModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role == QmlOutlineModel::AnnotationRole) {
|
||||
// Don't show element id etc behind element if the property is also visible
|
||||
if (!filterBindings()
|
||||
&& index.data(QmlOutlineModel::ItemTypeRole) == QmlOutlineModel::ElementType) {
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
return QSortFilterProxyModel::data(index, role);
|
||||
}
|
||||
|
||||
bool QmlJSOutlineFilterModel::filterBindings() const
|
||||
{
|
||||
return m_filterBindings;
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
// QSortFilterProxyModel
|
||||
bool filterAcceptsRow(int sourceRow,
|
||||
const QModelIndex &sourceParent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
|
||||
bool filterBindings() const;
|
||||
void setFilterBindings(bool filterBindings);
|
||||
|
||||
@@ -26,7 +26,7 @@ class QmlOutlineItem : public QStandardItem
|
||||
public:
|
||||
QmlOutlineItem(QmlOutlineModel *model);
|
||||
|
||||
//QStandardItem
|
||||
// QStandardItem
|
||||
QVariant data(int role = Qt::UserRole + 1) const;
|
||||
int type() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user