Searchable Menu Action

class TaggedAction(*args: Any, **kwargs: Any)

Bases: QAction

hasTag(tag)

Searches this instance tags and does a contains(in) operator on each tag, returns True if the tag is valid else False.

Parameters:

tag (str) – the partial or full tag to search for

Return type:

bool

hasAnyTag(tags)

Searchable Menu Menu

Searchable QMenu

men = SearchableMenu(objectName="test", title="test menu")
subMenu = men.addMenu("helloworld")
act = taggedAction.TaggedAction("test")
act.tags = set(["test", "hello", "world"])
a = taggedAction.TaggedAction("bob")
a.tags = set(["bob"])
subMenu.addAction(act)
men.addAction(a)
men.exec_(QtGui.QCursor.pos())
class SearchableMenu(*args: Any, **kwargs: Any)

Bases: Menu

Extended the standard QMenu to make it searchable, first action is always a lineedit used to recursively search all sub actions by tags

showEvent(event)

Set the search visible or not

Returns:

Return type:

setSearchVisible(visible)

Set visibility of the search edit

Parameters:

visible

Returns:

searchVisible()

Returns visibility of search edit

Returns:

updateSearch(searchString=None)

Function that will search all actions for a search string tag

Parameters:

searchString (str) – tag names separated if a space eg. “my tag”

clear()

Clear all items from menu

Returns: