BibleTime
Public Types | Signals | Public Member Functions | Public Attributes | Private Member Functions | List of all members
BtModuleChooserMenu Class Referencefinal

#include <btmodulechoosermenu.h>

Inheritance diagram for BtModuleChooserMenu:

Public Types

enum  Flag { DisableNonBiblesOnFirstButton , DisableSelectedModule , AddNoneButton }
 

Signals

void sigModuleChosen (CSwordModuleInfo *module)
 
- Signals inherited from BtMenuView
void triggered (QModelIndex index)
 

Public Member Functions

 BtModuleChooserMenu (QString const &title, CSwordModuleInfo::ModuleType moduleType, Flags flags, QWidget *parent=nullptr)
 
QIcon buttonIcon () const
 
int buttonIndex () const noexcept
 
CSwordModuleInfoselectedModule () const noexcept
 
void setSelectedModule (CSwordModuleInfo *const newSelectedModule) noexcept
 
void update (BtModuleList newModulesToUse, CSwordModuleInfo *newSelectedModule, int newButtonIndexIndex, int newLeftLikeModules)
 
- Public Member Functions inherited from BtMenuView
 BtMenuView (QString const &title, QWidget *parent=nullptr)
 
 BtMenuView (QWidget *parent=nullptr)
 
bool event (QEvent *e) override
 
QAbstractItemModelmodel () const
 
void setModel (QAbstractItemModel *model)
 
 ~BtMenuView () override
 

Public Attributes

int m_buttonIndex
 
BtBookshelfFilterModel *const m_filterModel
 
Flags const m_flags
 
int m_leftLikeModules
 
BtModuleList m_newModulesToUse
 
CSwordModuleInfom_selectedModule = nullptr
 

Private Member Functions

QActionnewAction (QMenu *parentMenu, QModelIndex const &itemIndex) final override
 
void preBuildMenu (QActionGroup *actionGroup) final override
 

Additional Inherited Members

- Protected Member Functions inherited from BtMenuView
virtual QMenunewMenu (QMenu *parentMenu, const QModelIndex &itemIndex)
 
virtual void postBuildMenu (QActionGroup *actions)
 
void rebuildMenu ()
 Rebuilds the menu.
 

Detailed Description

Definition at line 31 of file btmodulechoosermenu.h.

Member Enumeration Documentation

◆ Flag

Enumerator
DisableNonBiblesOnFirstButton 
DisableSelectedModule 
AddNoneButton 

Definition at line 37 of file btmodulechoosermenu.h.

Constructor & Destructor Documentation

◆ BtModuleChooserMenu()

BtModuleChooserMenu::BtModuleChooserMenu ( QString const &  title,
CSwordModuleInfo::ModuleType  moduleType,
Flags  flags,
QWidget parent = nullptr 
)

Member Function Documentation

◆ buttonIcon()

QIcon BtModuleChooserMenu::buttonIcon ( ) const

◆ buttonIndex()

int BtModuleChooserMenu::buttonIndex ( ) const
inlinenoexcept

Definition at line 63 of file btmodulechoosermenu.h.

References m_buttonIndex.

Referenced by BtModuleChooserButton::moduleChosen().

◆ newAction()

QAction * BtModuleChooserMenu::newAction ( QMenu parentMenu,
QModelIndex const &  itemIndex 
)
finaloverrideprivatevirtual

This method is called by BtMenuView to initialize an action to add to this menu. If the action corresponding to the given index is not to be added to this menu, please return 0.

Parameters
[in]parentMenuthe parent menu under which the new action is to be added.
[in]itemIndexthe index of the item corresponding to the action.

Reimplemented from BtMenuView.

Definition at line 66 of file btmodulechoosermenu.cpp.

References CSwordModuleInfo::Bible, CSwordModuleInfo::Bibles, BT_ASSERT, DisableNonBiblesOnFirstButton, DisableSelectedModule, CSwordModuleInfo::isLocked(), m_buttonIndex, m_filterModel, m_flags, m_newModulesToUse, m_selectedModule, BtBookshelfFilterModel::moduleChooserType(), and BtMenuView::newAction().

◆ preBuildMenu()

void BtModuleChooserMenu::preBuildMenu ( QActionGroup *  actions)
finaloverrideprivatevirtual

This method is called by BtMenuView before populating itself with data from the model. Reimplement this method to add any menus/actions to this menu before the items of the menu. The default implementation does nothing.

The model might be unset before this method is called. When the menu is about to be shown, this allows for this method to initialize the model on request. If the model is unset after this method returns, the menu is not populated with data from the item model.

Reimplemented from BtMenuView.

Definition at line 45 of file btmodulechoosermenu.cpp.

References AddNoneButton, BT_ASSERT, BT_CONNECT, m_buttonIndex, m_flags, m_leftLikeModules, m_newModulesToUse, m_selectedModule, and BtMenuView::triggered().

◆ selectedModule()

CSwordModuleInfo * BtModuleChooserMenu::selectedModule ( ) const
inlinenoexcept

Definition at line 56 of file btmodulechoosermenu.h.

References m_selectedModule.

Referenced by BtModuleChooserButton::moduleChosen().

◆ setSelectedModule()

void BtModuleChooserMenu::setSelectedModule ( CSwordModuleInfo *const  newSelectedModule)
noexcept

Definition at line 114 of file btmodulechoosermenu.cpp.

Referenced by BtModuleChooserButton::moduleChosen().

◆ sigModuleChosen

void BtModuleChooserMenu::sigModuleChosen ( CSwordModuleInfo module)
signal

◆ update()

void BtModuleChooserMenu::update ( BtModuleList  newModulesToUse,
CSwordModuleInfo newSelectedModule,
int  newButtonIndexIndex,
int  newLeftLikeModules 
)

Member Data Documentation

◆ m_buttonIndex

int BtModuleChooserMenu::m_buttonIndex

Definition at line 82 of file btmodulechoosermenu.h.

Referenced by buttonIndex(), newAction(), preBuildMenu(), and update().

◆ m_filterModel

BtBookshelfFilterModel* const BtModuleChooserMenu::m_filterModel

Definition at line 78 of file btmodulechoosermenu.h.

Referenced by BtModuleChooserMenu(), buttonIcon(), and newAction().

◆ m_flags

Flags const BtModuleChooserMenu::m_flags

Definition at line 79 of file btmodulechoosermenu.h.

Referenced by newAction(), and preBuildMenu().

◆ m_leftLikeModules

int BtModuleChooserMenu::m_leftLikeModules

Definition at line 83 of file btmodulechoosermenu.h.

Referenced by preBuildMenu(), and update().

◆ m_newModulesToUse

BtModuleList BtModuleChooserMenu::m_newModulesToUse

Definition at line 80 of file btmodulechoosermenu.h.

Referenced by newAction(), preBuildMenu(), and update().

◆ m_selectedModule

CSwordModuleInfo* BtModuleChooserMenu::m_selectedModule = nullptr

Definition at line 81 of file btmodulechoosermenu.h.

Referenced by buttonIcon(), newAction(), preBuildMenu(), selectedModule(), and update().


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