digiKam Developer Documentation: Digikam::DCategoryDrawer Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Signals | Public Member Functions | Protected Member Functions | Friends | List of all members
Digikam::DCategoryDrawer Class Reference

The category drawing is performed by this class. More...

Inheritance diagram for Digikam::DCategoryDrawer:

## Signals
void | actionRequested (int action, const QModelIndex &index)
| Emit this signal on your subclass implementation to notify that something happened.
void | collapseOrExpandClicked (const QModelIndex &index)
| This signal becomes emitted when collapse or expand has been clicked.

## Public Member Functions
| DCategoryDrawer (DCategorizedView *const view)
| Construct a category drawer for a given view.
virtual int | categoryHeight (const QModelIndex &index, const QStyleOption &option) const
virtual void | drawCategory (const QModelIndex &index, int sortRole, const QStyleOption &option, QPainter *painter) const
| This method purpose is to draw a category represented by the given.
virtual int | leftMargin () const
virtual int | rightMargin () const
DCategorizedView * | view () const

## Protected Member Functions
virtual void | mouseButtonDoubleClicked (const QModelIndex &index, const QRect &blockRect, QMouseEvent *event)
| Method called when the mouse button has been double clicked.
virtual void | mouseButtonPressed (const QModelIndex &index, const QRect &blockRect, QMouseEvent *event)
| Method called when the mouse button has been pressed.
virtual void | mouseButtonReleased (const QModelIndex &index, const QRect &blockRect, QMouseEvent *event)
| Method called when the mouse button has been released.
virtual void | mouseLeft (const QModelIndex &index, const QRect &blockRect)
| Method called when the mouse button has left this block.
virtual void | mouseMoved (const QModelIndex &index, const QRect &blockRect, QMouseEvent *event)
| Method called when the mouse has been moved.

## Friends
class | DCategorizedView

## Detailed Description

It also gives information about the category height and margins.

## Member Function Documentation

## ◆ actionRequested

void Digikam::DCategoryDrawer::actionRequested | ( | int | action,
|  | const QModelIndex & | index
| ) |  |
| signal

Usually this will be triggered when you have received an event, and its position matched some "hot spot".

You give this action the integer you want, and having connected this signal to your code, the connected slot can perform the needed changes (view, model, selection model, delegate...)

## ◆ categoryHeight()

int Digikam::DCategoryDrawer::categoryHeight | ( | const QModelIndex & | index,
|  | const QStyleOption & | option
| ) |  | const
| virtual

Returns
  The category height for the category represented by index `index` with style options `option`.

Reimplemented in Digikam::ItemCategoryDrawer, and Digikam::ImportCategoryDrawer.

## ◆ drawCategory()

void Digikam::DCategoryDrawer::drawCategory | ( | const QModelIndex & | index,
|  | int | sortRole,
|  | const QStyleOption & | option,
|  | QPainter * | painter
| ) |  | const
| virtual

Parameters

  index | The index with the given
  sortRole | The sorting role
  option | The painter style options
  painter | The painter instance

Note
  This method will be called one time per category, always with the first element in that category

Reimplemented in Digikam::ItemCategoryDrawer, and Digikam::ImportCategoryDrawer.

## ◆ leftMargin()

int Digikam::DCategoryDrawer::leftMargin | ( |  | ) | const
| virtual

Note
  0 by default

## ◆ mouseButtonDoubleClicked()

void Digikam::DCategoryDrawer::mouseButtonDoubleClicked | ( | const QModelIndex & | index,
|  | const QRect & | blockRect,
|  | QMouseEvent * | event
| ) |  |
| protectedvirtual

Parameters

  index | The representative index of the block of items.
  blockRect | The rect occupied by the block of items.
  event | The mouse event.

Warning
  You explicitly have to determine whether the event has been accepted or not. You have to call event->accept() or event->ignore() at all possible case branches in your code.

## ◆ mouseButtonPressed()

void Digikam::DCategoryDrawer::mouseButtonPressed | ( | const QModelIndex & | index,
|  | const QRect & | blockRect,
|  | QMouseEvent * | event
| ) |  |
| protectedvirtual

Parameters

  index | The representative index of the block of items.
  blockRect | The rect occupied by the block of items.
  event | The mouse event.

Warning
  You explicitly have to determine whether the event has been accepted or not. You have to call event->accept() or event->ignore() at all possible case branches in your code.

## ◆ mouseButtonReleased()

void Digikam::DCategoryDrawer::mouseButtonReleased | ( | const QModelIndex & | index,
|  | const QRect & | blockRect,
|  | QMouseEvent * | event
| ) |  |
| protectedvirtual

Parameters

  index | The representative index of the block of items.
  blockRect | The rect occupied by the block of items.
  event | The mouse event.

Warning
  You explicitly have to determine whether the event has been accepted or not. You have to call event->accept() or event->ignore() at all possible case branches in your code.

## ◆ mouseLeft()

void Digikam::DCategoryDrawer::mouseLeft | ( | const QModelIndex & | index,
|  | const QRect & | blockRect
| ) |  |
| protectedvirtual

Parameters

  index | The representative index of the block of items.
  blockRect | The rect occupied by the block of items.

## ◆ mouseMoved()

void Digikam::DCategoryDrawer::mouseMoved | ( | const QModelIndex & | index,
|  | const QRect & | blockRect,
|  | QMouseEvent * | event
| ) |  |
| protectedvirtual

Parameters

  index | The representative index of the block of items.
  blockRect | The rect occupied by the block of items.
  event | The mouse event.

## ◆ rightMargin()

int Digikam::DCategoryDrawer::rightMargin | ( |  | ) | const
| virtual

Note
  0 by default

## ◆ view()

DCategorizedView * Digikam::DCategoryDrawer::view | ( |  | ) | const

Returns
  The view this category drawer is associated with.