forked from qt-creator/qt-creator
QmlOutline: Add filter for hiding bindings (properties)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <texteditor/ioutlinewidget.h>
|
||||
|
||||
#include <QtGui/QTreeView>
|
||||
#include <QtGui/QSortFilterProxyModel>
|
||||
|
||||
namespace Core {
|
||||
class IEditor;
|
||||
@@ -25,6 +26,21 @@ public:
|
||||
QmlJSOutlineTreeView(QWidget *parent = 0);
|
||||
};
|
||||
|
||||
class QmlJSOutlineFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QmlJSOutlineFilterModel(QObject *parent);
|
||||
// QSortFilterProxyModel
|
||||
bool filterAcceptsRow(int sourceRow,
|
||||
const QModelIndex &sourceParent) const;
|
||||
|
||||
bool filterBindings() const;
|
||||
void setFilterBindings(bool filterBindings);
|
||||
private:
|
||||
bool m_filterBindings;
|
||||
};
|
||||
|
||||
class QmlJSOutlineWidget : public TextEditor::IOutlineWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -34,20 +50,25 @@ public:
|
||||
void setEditor(QmlJSTextEditor *editor);
|
||||
|
||||
// IOutlineWidget
|
||||
virtual QList<QAction*> filterMenuActions() const;
|
||||
virtual void setCursorSynchronization(bool syncWithCursor);
|
||||
|
||||
private slots:
|
||||
void modelUpdated();
|
||||
void updateSelectionInTree(const QModelIndex &index);
|
||||
void updateSelectionInText(const QItemSelection &selection);
|
||||
void setShowBindings(bool showBindings);
|
||||
|
||||
private:
|
||||
bool syncCursor();
|
||||
|
||||
private:
|
||||
QmlJSOutlineTreeView *m_treeView;
|
||||
QmlJSOutlineFilterModel *m_filterModel;
|
||||
QWeakPointer<QmlJSTextEditor> m_editor;
|
||||
|
||||
QAction *m_showBindingsAction;
|
||||
|
||||
bool m_enableCursorSync;
|
||||
bool m_blockCursorSync;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user