eric7.WebBrowser.History.HistoryCompleter

Module implementing a special completer for the history.

Global Attributes

None

Classes

HistoryCompleter Class implementing a completer for the browser history.
HistoryCompletionModel Class implementing a special model for history based completions.
HistoryCompletionView Class implementing a special completer view for history based completions.

Functions

None


HistoryCompleter

Class implementing a completer for the browser history.

Derived from

QCompleter

Class Attributes

None

Class Methods

None

Methods

HistoryCompleter Constructor
__updateFilter Private slot to update the search string.
pathFromIndex Public method to get a path for a given index.
splitPath Public method to split the given path into strings, that are used to match at each level in the model.

Static Methods

None

HistoryCompleter (Constructor)

HistoryCompleter(model, parent=None)

Constructor

model (QAbstractItemModel)
reference to the model
parent (QObject)
reference to the parent object

HistoryCompleter.__updateFilter

__updateFilter()

Private slot to update the search string.

HistoryCompleter.pathFromIndex

pathFromIndex(idx)

Public method to get a path for a given index.

idx (QModelIndex)
reference to the index
Return:
the actual URL from the history
Return Type:
str

HistoryCompleter.splitPath

splitPath(path)

Public method to split the given path into strings, that are used to match at each level in the model.

path (str)
path to be split
Return:
list of path elements
Return Type:
list of str
Up


HistoryCompletionModel

Class implementing a special model for history based completions.

Derived from

QSortFilterProxyModel

Class Attributes

HistoryCompletionRole

Class Methods

None

Methods

HistoryCompletionModel Constructor
data Public method to get data from the model.
filterAcceptsRow Public method to determine, if the row is acceptable.
isValid Public method to check the model for validity.
lessThan Public method used to sort the displayed items.
searchString Public method to get the current search string.
setSearchString Public method to set the current search string.
setValid Public method to set the model's validity.

Static Methods

None

HistoryCompletionModel (Constructor)

HistoryCompletionModel(parent=None)

Constructor

parent (QObject)
reference to the parent object

HistoryCompletionModel.data

data(index, role=Qt.ItemDataRole.DisplayRole)

Public method to get data from the model.

index (QModelIndex)
index of history entry to get data for
role (int)
data role
Return:
history entry data
Return Type:
Any

HistoryCompletionModel.filterAcceptsRow

filterAcceptsRow(sourceRow, sourceParent)

Public method to determine, if the row is acceptable.

sourceRow (int)
row number in the source model
sourceParent (QModelIndex)
index of the source item
Return:
flag indicating acceptance
Return Type:
bool

HistoryCompletionModel.isValid

isValid()

Public method to check the model for validity.

Return:
flag indicating a valid status
Return Type:
bool

HistoryCompletionModel.lessThan

lessThan(left, right)

Public method used to sort the displayed items.

It implements a special sorting function based on the history entry's frequency giving a bonus to hits that match on a word boundary so that e.g. "dot.python-projects.org" is a better result for typing "dot" than "slashdot.org". However, it only looks for the string in the host name, not the entire URL, since while it makes sense to e.g. give "www.phoronix.com" a bonus for "ph", it does NOT make sense to give "www.yadda.com/foo.php" the bonus.

left (QModelIndex)
index of left item
right (QModelIndex)
index of right item
Return:
true, if left is less than right
Return Type:
bool

HistoryCompletionModel.searchString

searchString()

Public method to get the current search string.

Return:
current search string
Return Type:
str

HistoryCompletionModel.setSearchString

setSearchString(sstring)

Public method to set the current search string.

sstring (str)
new search string

HistoryCompletionModel.setValid

setValid(valid)

Public method to set the model's validity.

valid (bool)
flag indicating the new valid status
Up


HistoryCompletionView

Class implementing a special completer view for history based completions.

Derived from

QTableView

Class Attributes

None

Class Methods

None

Methods

HistoryCompletionView Constructor
resizeEvent Protected method handling resize events.
sizeHintForRow Public method to give a size hint for rows.

Static Methods

None

HistoryCompletionView (Constructor)

HistoryCompletionView(parent=None)

Constructor

parent (QWidget)
reference to the parent widget

HistoryCompletionView.resizeEvent

resizeEvent(evt)

Protected method handling resize events.

evt (QResizeEvent)
reference to the resize event

HistoryCompletionView.sizeHintForRow

sizeHintForRow(_row)

Public method to give a size hint for rows.

_row (int)
row number (unused)
Return:
desired row height
Return Type:
int
Up