Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Private Slots | Private Attributes | List of all members
ActionSearch Class Reference

The ActionSearch class. More...

#include <actionsearch.h>

Inheritance diagram for ActionSearch:

Public Member Functions

 ActionSearch (QWidget *parent)
 ActionSearch Constructor. More...
 

Private Slots

void search_update (const QString &s, const QString &p=nullptr, QMenu *parent=nullptr)
 Update the list of actions according to a search query. More...
 
void perform_action ()
 Perform the currently selected action. More...
 
void move_selection_up ()
 Move selection up. More...
 
void move_selection_down ()
 Move selection down. More...
 

Private Attributes

ActionSearchListlist_widget
 Main widget that shows the list of commands. More...
 

Detailed Description

The ActionSearch class.

A popup window (accessible through Help > Action Search) that allows users to search for a menu command by typing rather than browsing through the menu bar. This can be created from anywhere provided olive::MainWindow is valid.

Constructor & Destructor Documentation

ActionSearch::ActionSearch ( QWidget *  parent)

ActionSearch Constructor.

Create ActionSearch popup.

Parameters
parentQWidget parent. Usually MainWindow.

Member Function Documentation

void ActionSearch::move_selection_down ( )
privateslot

Move selection down.

A slot for pressing down on the ActionSearchEntry field. Moves the selection in the list down once. If the selection is already at the bottom of the list, this is a no-op.

void ActionSearch::move_selection_up ( )
privateslot

Move selection up.

A slot for pressing up on the ActionSearchEntry field. Moves the selection in the list up once. If the selection is already at the top of the list, this is a no-op.

void ActionSearch::perform_action ( )
privateslot

Perform the currently selected action.

Usually triggered by pressing Enter on the ActionSearchEntry field, this will trigger whatever action is currently highlighted and then close this popup. If no entries are highlighted (i.e. the list is empty), no action is triggered and the popup closes anyway.

void ActionSearch::search_update ( const QString &  s,
const QString &  p = nullptr,
QMenu *  parent = nullptr 
)
privateslot

Update the list of actions according to a search query.

This function adds/removes actions in the action list according to a given search query entered by the user.

To loop over the menubar and all of its menus and submenus, this function will call itself recursively. As such some of its parameters do not need to be set externally, as these will be set by the function itself as it calls itself.

Parameters
sThe search text. This is the only parameter that should be set externally.
pThe current parent hierarchy. In most cases, this should be left as nullptr when called externally. search_update() will fill this automatically as it needs while calling itself recursively.
parentThe current menu to loop over. In most cases, this should be left as nullptr when called externally. search_update() will fill this automatically as it needs while calling itself recursively.

Member Data Documentation

ActionSearchList* ActionSearch::list_widget
private

Main widget that shows the list of commands.


The documentation for this class was generated from the following files: