Class: Ruber::FindInFiles::FindReplaceInFilesDlg::Completer

Inherits:
Qt::Completer
  • Object
show all
Defined in:
plugins/find_in_files/find_in_files_dlg.rb

Overview

A specialized completer for use with the line edits in the dialog.

The only difference from the standard Qt::Completer is that it creates its model by itself

Instance Method Summary (collapse)

Constructor Details

- (Completer) initialize(parent = nil)

A new instance of Completer

Parameters:

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

    the completer’s parent object



105
106
107
108
# File 'plugins/find_in_files/find_in_files_dlg.rb', line 105

def initialize parent = nil
  super
  self.model = Qt::StringListModel.new self
end

Instance Method Details

- (nil) add_entry(str)

Adds a new string to the completer

Parameters:

  • str (String)

    the string to add

Returns:

  • (nil)


116
117
118
119
120
# File 'plugins/find_in_files/find_in_files_dlg.rb', line 116

def add_entry str
  row = model.row_count
  model.insert_rows row, 1
  model.set_data model.index(row), Qt::Variant.new(str), Qt::DisplayRole
end