KCategoryDrawer Class Reference
from PyKDE5.kitemviews import *
Inherits: QObject
Detailed Description
The category drawing is performed by this class. It also gives information about the category height and margins.
Signals | |
actionRequested (int action, QModelIndex index) | |
collapseOrExpandClicked (QModelIndex index) | |
Methods | |
__init__ (self, KCategorizedView view) | |
int | categoryHeight (self, QModelIndex index, QStyleOption option) |
drawCategory (self, QModelIndex index, int sortRole, QStyleOption option, QPainter painter) | |
int | leftMargin (self) |
mouseButtonDoubleClicked (self, QModelIndex index, QRect blockRect, QMouseEvent event) | |
mouseButtonPressed (self, QModelIndex index, QRect blockRect, QMouseEvent event) | |
mouseButtonReleased (self, QModelIndex index, QRect blockRect, QMouseEvent event) | |
mouseLeft (self, QModelIndex index, QRect blockRect) | |
mouseMoved (self, QModelIndex index, QRect blockRect, QMouseEvent event) | |
int | rightMargin (self) |
KCategorizedView | view (self) |
Signal Documentation
actionRequested | ( | int | action, | |
QModelIndex | index | |||
) |
Emit this signal on your subclass implementation to notify that something happened. 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...)
- Signal syntax:
QObject.connect(source, SIGNAL("actionRequested(int, const QModelIndex&)"), target_slot)
collapseOrExpandClicked | ( | QModelIndex | index | |
) |
This signal becomes emitted when collapse or expand has been clicked.
- Signal syntax:
QObject.connect(source, SIGNAL("collapseOrExpandClicked(const QModelIndex&)"), target_slot)
Method Documentation
__init__ | ( | self, | ||
KCategorizedView | view | |||
) |
int categoryHeight | ( | self, | ||
QModelIndex | index, | |||
QStyleOption | option | |||
) |
- Returns:
- The category height for the category representated by index index with style options option.
drawCategory | ( | self, | ||
QModelIndex | index, | |||
int | sortRole, | |||
QStyleOption | option, | |||
QPainter | painter | |||
) |
This method purpose is to draw a category represented by the given
- Parameters:
-
index with the given sortRole sorting role
- Note:
- This method will be called one time per category, always with the first element in that category
int leftMargin | ( | self ) |
- Note:
- 0 by default
- Since:
- 4.4
mouseButtonDoubleClicked | ( | self, | ||
QModelIndex | index, | |||
QRect | blockRect, | |||
QMouseEvent | event | |||
) |
Method called when the mouse button has been double clicked.
- 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 | ( | self, | ||
QModelIndex | index, | |||
QRect | blockRect, | |||
QMouseEvent | event | |||
) |
Method called when the mouse button has been pressed.
- 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 | ( | self, | ||
QModelIndex | index, | |||
QRect | blockRect, | |||
QMouseEvent | event | |||
) |
Method called when the mouse button has been released.
- 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 | ( | self, | ||
QModelIndex | index, | |||
QRect | blockRect | |||
) |
Method called when the mouse button has left this block.
- Parameters:
-
index The representative index of the block of items. blockRect The rect occupied by the block of items.
mouseMoved | ( | self, | ||
QModelIndex | index, | |||
QRect | blockRect, | |||
QMouseEvent | event | |||
) |
Method called when the mouse has been moved.
- Parameters:
-
index The representative index of the block of items. blockRect The rect occupied by the block of items. event The mouse event.
int rightMargin | ( | self ) |
- Note:
- 0 by default
- Since:
- 4.4
KCategorizedView view | ( | self ) |
- Returns:
- The view this category drawer is associated with.