Class: Ruber::ProjectBrowser::ToolWidget::FilterModel
- Inherits:
-
KDE::DirSortFilterProxyModel
- Object
- KDE::DirSortFilterProxyModel
- Ruber::ProjectBrowser::ToolWidget::FilterModel
- Defined in:
- plugins/project_browser/project_browser.rb
Overview
currently, directories containing only non-project files are still shown. This
Filter used by the tree view to hide non-project files. It also allow to turn off filtering, which is used when the user choose to display all files.
is because of how the filtering is done: filtering the parent object is done before filtering child objects, so there’s no direct way to remove empty items. See whether something can be done about it
Instance Method Summary (collapse)
-
- (Boolean) do_filtering(val)
Tells whether to exclude files not belonging to the project or to accept all items.
-
- (Boolean) filterAcceptsRow(row, parent)
Override of
KDE::DirSortFilterProxyModel#filterAcceptsRow
which rejects all files not belonging to the project, unless filtering has been turned off. -
- (FilterModel) initialize(parent = nil)
constructor
A new instance of FilterModel.
-
- (nil) invalidate_filter
Override of
KDE::DirSortFilterProxyModel#filterAcceptsRow
which works as the parent method but is public. -
- (nil) project(prj)
Changes the project to use for filtering and invalidates the filter items will be accepted).
Constructor Details
- (FilterModel) initialize(parent = nil)
A new instance of FilterModel
55 56 57 58 59 60 |
# File 'plugins/project_browser/project_browser.rb', line 55 def initialize parent = nil super @project = nil @do_filtering = true self.dynamic_sort_filter = true end |
Instance Method Details
- (Boolean) do_filtering=(val)
Tells whether to exclude files not belonging to the project or to accept all items
96 97 98 99 |
# File 'plugins/project_browser/project_browser.rb', line 96 def do_filtering= val @do_filtering = val invalidate_filter end |
- (Boolean) filterAcceptsRow(row, parent)
Override of KDE::DirSortFilterProxyModel#filterAcceptsRow
which rejects all files
not belonging to the project, unless filtering has been turned off.
been set, otherwise true if row corresponds to a directory or to a file belonging to the project and false otherwise
73 74 75 76 77 78 |
# File 'plugins/project_browser/project_browser.rb', line 73 def filterAcceptsRow row, parent return true if @project.nil? or !@do_filtering it = source_model.item_for_index source_model.index(row,0,parent) return true if it.dir? @project.file_in_project? it.local_path end |
- (nil) invalidate_filter
Override of KDE::DirSortFilterProxyModel#filterAcceptsRow
which works as the
parent method but is public
106 107 108 |
# File 'plugins/project_browser/project_browser.rb', line 106 def invalidate_filter super end |
- (nil) project=(prj)
Changes the project to use for filtering and invalidates the filter items will be accepted)
86 87 88 89 |
# File 'plugins/project_browser/project_browser.rb', line 86 def project= prj @project = prj invalidate_filter end |