EventViews::MonthItem Class
class EventViews::MonthItem| Header: | #include <MonthItem> |
| CMake: | find_package(KPim6 REQUIRED COMPONENTS EventViews)target_link_libraries(mytarget PRIVATE KPim6::EventViews) |
Public Functions
| MonthItem(EventViews::MonthScene *monthScene) | |
| virtual | ~MonthItem() override |
| virtual bool | allDay() const = 0 |
| void | beginMove() |
| void | beginResize() |
| virtual QColor | bgColor() const = 0 |
| int | daySpan() const |
| void | deleteAll() |
| QDate | endDate() const |
| void | endMove() |
| void | endResize() |
| virtual QColor | frameColor() const = 0 |
| virtual bool | greaterThanFallback(const EventViews::MonthItem *other) const |
| virtual QList<QPixmap> | icons() const = 0 |
| virtual bool | isMoveable() const = 0 |
| bool | isMoving() const |
| virtual bool | isResizable() const = 0 |
| bool | isResizing() const |
| EventViews::MonthScene * | monthScene() const |
| void | moveBy(int offsetToPreviousDate) |
| void | moveTo(QDate date) |
| int | position() const |
| virtual QDate | realEndDate() const = 0 |
| virtual QDate | realStartDate() const = 0 |
| bool | resizeBy(int offsetToPreviousDate) |
| bool | selected() const |
| void | setSelected(bool selected) |
| QDate | startDate() const |
| virtual QString | text(bool end) const = 0 |
| virtual QString | toolTipText(const QDate &date) const = 0 |
| void | updateGeometry() |
| void | updateMonthGraphicsItems() |
| void | updatePosition() |
Static Public Members
| bool | greaterThan(const EventViews::MonthItem *e1, const EventViews::MonthItem *e2) |
Protected Functions
| virtual void | finalizeMove(const QDate &newStartDate) = 0 |
| virtual void | finalizeResize(const QDate &newStartDate, const QDate &newEndDate) = 0 |
Detailed Description
A month item manages different MonthGraphicsItems.
Member Function Documentation
[explicit] MonthItem::MonthItem(EventViews::MonthScene *monthScene)
[override virtual noexcept] MonthItem::~MonthItem()
[pure virtual] bool MonthItem::allDay() const
True if this item last all the day.
void MonthItem::beginMove()
Begin a move.
void MonthItem::beginResize()
Begin a resize.
[pure virtual] QColor MonthItem::bgColor() const
Returns the background color of the item.
int MonthItem::daySpan() const
The number of days this item spans.
void MonthItem::deleteAll()
Deletes all MonthGraphicsItem this item handles. Clear the list.
QDate MonthItem::endDate() const
The end date of the incidence, generally realEndDate. But it reflect changes, even during move.
void MonthItem::endMove()
End a move.
void MonthItem::endResize()
End a resize.
[pure virtual protected] void MonthItem::finalizeMove(const QDate &newStartDate)
Called after a move operation.
[pure virtual protected] void MonthItem::finalizeResize(const QDate &newStartDate, const QDate &newEndDate)
Called after a resize operation.
[pure virtual] QColor MonthItem::frameColor() const
Returns the frame color of the item.
[static] bool MonthItem::greaterThan(const EventViews::MonthItem *e1, const EventViews::MonthItem *e2)
Compares two items to decide which to place in the view first.
The month view displays a list of items. When loading (which occurs each time there is a change), the items are sorted in an order intended to avoid unsightly gaps: - biggest durations first - earliest date - finally, time in the day Holidays are sorted before events with the same start date and length, so they appear at the top of the day's box.
[virtual] bool MonthItem::greaterThanFallback(const EventViews::MonthItem *other) const
Compare this event with a second one, if the former function is not able to sort them.
[pure virtual] QList<QPixmap> MonthItem::icons() const
Returns a list of pixmaps to draw next to the items.
[pure virtual] bool MonthItem::isMoveable() const
Returns true if the item can be moved.
bool MonthItem::isMoving() const
Returns true if the item is being moved.
[pure virtual] bool MonthItem::isResizable() const
Returns true if the item can be resized.
bool MonthItem::isResizing() const
Returns true if the item is being resized.
EventViews::MonthScene *MonthItem::monthScene() const
Returns the associated month scene to this item.
void MonthItem::moveBy(int offsetToPreviousDate)
Called during move to move the item a bit, relative to the previous move step.
void MonthItem::moveTo(QDate date)
Called during a drag to move the item to a particular date. An invalid date indicates a drag outside the month grid.
int MonthItem::position() const
Returns the position of the item ( > 0 ).
[pure virtual] QDate MonthItem::realEndDate() const
This is the real end date, usually the end date of the incidence.
[pure virtual] QDate MonthItem::realStartDate() const
This is the real start date, usually the start date of the incidence.
bool MonthItem::resizeBy(int offsetToPreviousDate)
Called during resize to resize the item a bit, relative to the previous resize step.
bool MonthItem::selected() const
Returns true if this item is selected.
See also setSelected().
void MonthItem::setSelected(bool selected)
Sets the selection state of this item.
See also selected().
QDate MonthItem::startDate() const
The start date of the incidence, generally realStartDate. But it reflect changes, even during move.
[pure virtual] QString MonthItem::text(bool end) const
Returns the text to draw in an item.
end True if the text at the end of an item should be returned.
[pure virtual] QString MonthItem::toolTipText(const QDate &date) const
Returns the text for the tooltip of the item
void MonthItem::updateGeometry()
Updates geometry of all MonthGraphicsItems.
void MonthItem::updateMonthGraphicsItems()
Update the monthgraphicsitems
This basically deletes and rebuild all the MonthGraphicsItems but tries to do it wisely: - If there is a moving item, it won't be deleted because then the new item won't receive anymore the MouseMove events. - If there is an item on a line where the new state needs an item, it is used and not deleted. This will avoid flickers.
void MonthItem::updatePosition()
Find the lowest possible position for this item.
The position of an item in a cell is it's vertical position. This is used to avoid overlapping of items. An item keeps the same position in every cell it crosses. The position is measured from top to bottom.