digiKam
Digikam::ModelMenu Class Reference
+ Inheritance diagram for Digikam::ModelMenu:

Signals

void activated (const QModelIndex &index)
 
void hovered (const QString &text)
 

Public Member Functions

int firstSeparator () const
 
int hoverRole () const
 
QAction * makeAction (const QIcon &icon, const QString &text, QObject *const parent)
 
int maxRows () const
 
QAbstractItemModel * model () const
 
 ModelMenu (QWidget *const parent=nullptr)
 
QModelIndex rootIndex () const
 
int separatorRole () const
 
void setFirstSeparator (int offset)
 
void setHoverRole (int role)
 
void setMaxRows (int max)
 
void setModel (QAbstractItemModel *model)
 
void setRootIndex (const QModelIndex &index)
 
void setSeparatorRole (int role)
 
 ~ModelMenu () override
 

Protected Member Functions

void createMenu (const QModelIndex &parent, int max, QMenu *parentMenu=nullptr, QMenu *menu=nullptr)
 put all of the children of parent into menu up to max More...
 
virtual void postPopulated ()
 add any actions after the tree More...
 
virtual bool prePopulated ()
 add any actions before the tree, return true if any actions are added. More...
 

Detailed Description

A QMenu that is dynamically populated from a QAbstractItemModel

Constructor & Destructor Documentation

◆ ModelMenu()

Digikam::ModelMenu::ModelMenu ( QWidget *const  parent = nullptr)
explicit

◆ ~ModelMenu()

Digikam::ModelMenu::~ModelMenu ( )
override

Member Function Documentation

◆ activated

void Digikam::ModelMenu::activated ( const QModelIndex &  index)
signal

◆ createMenu()

void Digikam::ModelMenu::createMenu ( const QModelIndex &  parent,
int  max,
QMenu *  parentMenu = nullptr,
QMenu *  menu = nullptr 
)
protected

put all of the children of parent into menu up to max

References hovered(), and makeAction().

Referenced by Digikam::BookmarksMenu::prePopulated().

◆ firstSeparator()

int Digikam::ModelMenu::firstSeparator ( ) const

◆ hovered

void Digikam::ModelMenu::hovered ( const QString &  text)
signal

Referenced by createMenu().

◆ hoverRole()

int Digikam::ModelMenu::hoverRole ( ) const

◆ makeAction()

QAction * Digikam::ModelMenu::makeAction ( const QIcon &  icon,
const QString &  text,
QObject *const  parent 
)

Referenced by createMenu().

◆ maxRows()

int Digikam::ModelMenu::maxRows ( ) const

◆ model()

QAbstractItemModel * Digikam::ModelMenu::model ( ) const

Referenced by setModel().

◆ postPopulated()

void Digikam::ModelMenu::postPopulated ( )
protectedvirtual

add any actions after the tree

◆ prePopulated()

bool Digikam::ModelMenu::prePopulated ( )
protectedvirtual

add any actions before the tree, return true if any actions are added.

Reimplemented in Digikam::BookmarksMenu.

◆ rootIndex()

QModelIndex Digikam::ModelMenu::rootIndex ( ) const

◆ separatorRole()

int Digikam::ModelMenu::separatorRole ( ) const

◆ setFirstSeparator()

void Digikam::ModelMenu::setFirstSeparator ( int  offset)

◆ setHoverRole()

void Digikam::ModelMenu::setHoverRole ( int  role)

◆ setMaxRows()

void Digikam::ModelMenu::setMaxRows ( int  max)

◆ setModel()

void Digikam::ModelMenu::setModel ( QAbstractItemModel *  model)

References model().

Referenced by Digikam::BookmarksMenu::prePopulated().

◆ setRootIndex()

void Digikam::ModelMenu::setRootIndex ( const QModelIndex &  index)

◆ setSeparatorRole()

void Digikam::ModelMenu::setSeparatorRole ( int  role)

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