Class: Ruber::ProjectBrowser::ToolWidget::View

Inherits:
Qt::TreeView
  • Object
show all
Defined in:
plugins/project_browser/project_browser.rb

Overview

The view used by the plugin

The only scope of this class is to provide the context menu

Instance Method Summary (collapse)

Signal Summary

Constructor Details

- (View) initialize(parent = nil)

A new instance of View

Parameters:

  • parent (Qt::Widget, nil) (defaults to: nil)

    the parent widget



129
130
131
132
133
134
135
136
# File 'plugins/project_browser/project_browser.rb', line 129

def initialize parent = nil
  super
  @menu = Qt::Menu.new self
  @toggle_filter_action = KDE::ToggleAction.new 'Show only project files', @menu
  @toggle_filter_action.checked = true
  @menu.add_action @toggle_filter_action
  connect @toggle_filter_action, SIGNAL('toggled(bool)'), self, SIGNAL('only_project_files_triggered(bool)')
end

Instance Method Details

- (Object) contextMenuEvent(e)

Override of Qt::AbstractScrollArea#contextMenuEvent which displays a menu containing the action

Parameters:

  • e (Qt::ContextMenuEvent)

    the event object



143
144
145
# File 'plugins/project_browser/project_browser.rb', line 143

def contextMenuEvent e
  @menu.popup e.global_pos
end

Signal Details

- only_project_files_triggered(bool *true*)

Signal emitted whenever the user toggles the “Show only project files” action it

Parameters:

  • *true* (Boolean)

    if the user checked the action and false if he unchecked