CardView Class Reference
The CardView is a method of displaying data in cards. More...
#include <cardview.h>
Inheritance diagram for CardView:

Public Types | |
enum | SelectionMode { Single, Multi, Extended, NoSelection } |
Signals | |
void | selectionChanged () |
void | selectionChanged (CardViewItem *) |
void | clicked (CardViewItem *) |
void | executed (CardViewItem *) |
void | doubleClicked (CardViewItem *) |
void | currentChanged (CardViewItem *) |
void | returnPressed (CardViewItem *) |
void | contextMenuRequested (CardViewItem *, const QPoint &) |
Public Methods | |
CardView (QWidget *parent, const char *name) | |
virtual | ~CardView () |
void | insertItem (CardViewItem *item) |
void | takeItem (CardViewItem *item) |
void | clear () |
CardViewItem * | currentItem () |
void | setCurrentItem (CardViewItem *item) |
CardViewItem * | itemAt (const QPoint &viewPos) |
QRect | itemRect (const CardViewItem *item) |
void | ensureItemVisible (const CardViewItem *item) |
void | repaintItem (const CardViewItem *item) |
void | setSelectionMode (SelectionMode mode) |
SelectionMode | selectionMode () const |
void | setSelected (CardViewItem *item, bool selected) |
void | selectAll (bool state) |
bool | isSelected (CardViewItem *item) const |
CardViewItem * | selectedItem () const |
CardViewItem * | firstItem () const |
CardViewItem * | itemAfter (CardViewItem *item) |
int | childCount () const |
CardViewItem * | findItem (const QString &text, const QString &label, Qt::StringComparisonMode compare=Qt::BeginsWith) |
uint | columnWidth () |
void | setDrawCardBorder (bool enabled) |
bool | drawCardBorder () const |
void | setDrawColSeparators (bool enabled) |
bool | drawColSeparators () const |
void | setDrawFieldLabels (bool enabled) |
bool | drawFieldLabels () const |
void | setShowEmptyFields (bool show) |
bool | showEmptyFields () const |
uint | itemMargin () |
void | setItemMargin (uint margin) |
uint | itemSpacing () |
void | setItemSpacing (uint spacing) |
int | itemWidth () const |
void | setItemWidth (int width) |
void | setHeaderFont (const QFont &fnt) |
QFont | headerFont () const |
void | setFont (const QFont &fnt) |
void | setSeparatorWidth (int width) |
int | separatorWidth () |
void | setMaxFieldLines (int howmany) |
int | maxFieldLines () const |
Protected Methods | |
void | drawContents (QPainter *p, int clipx, int clipy, int clipw, int cliph) |
void | resizeEvent (QResizeEvent *e) |
void | contentsWheelEvent (QWheelEvent *e) |
void | setLayoutDirty (bool dirty) |
void | calcLayout () |
virtual void | contentsMousePressEvent (QMouseEvent *e) |
virtual void | contentsMouseMoveEvent (QMouseEvent *e) |
virtual void | contentsMouseReleaseEvent (QMouseEvent *e) |
virtual void | contentsMouseDoubleClickEvent (QMouseEvent *e) |
virtual void | enterEvent (QEvent *) |
virtual void | leaveEvent (QEvent *) |
virtual void | focusInEvent (QFocusEvent *) |
virtual void | focusOutEvent (QFocusEvent *) |
virtual void | keyPressEvent (QKeyEvent *) |
virtual void | startDrag () |
Friends | |
class | CardViewItem |
Detailed Description
The CardView is a method of displaying data in cards.This idea is similar to the idea of a rolodex or business cards. Each card has a caption and a list of fields, which are label<->value pairs. The CardView displays multiple cards in a grid. The Cards are sorted based on their caption.
The CardView class is designed to mirror the API of the QListView or QIconView. The CardView is also completely independant of KAddressBook and can be used elsewhere. With the exception of a few simple config checks, the CardView is also 100% independant of KDE.
Definition at line 174 of file cardview.h.
Constructor & Destructor Documentation
|
Constructor.
Definition at line 609 of file cardview.cpp. References QFont::setBold(), QScrollView::setVScrollBarMode(), and QScrollView::viewport(). |
Member Function Documentation
|
Inserts the item into the card view. This method does not have to be called if you created the item with a proper parent. Once inserted, the CardView takes ownership of the item. Definition at line 646 of file cardview.cpp. References setLayoutDirty(). |
|
Takes the item from the view. The item will not be deleted and ownership of the item is returned to the caller. Definition at line 652 of file cardview.cpp. References CardViewItem::nextItem(), and setLayoutDirty(). |
|
Clears the view and deletes all card view items.
Definition at line 661 of file cardview.cpp. References setLayoutDirty(). Referenced by KAddressBookCardView::refresh(). |
|
Definition at line 668 of file cardview.cpp. Referenced by CardViewItem::paintCard(), and setCurrentItem(). |
|
Sets the CardViewItem
Definition at line 675 of file cardview.cpp. References CardViewItem::cardView(), currentChanged(), currentItem(), ensureItemVisible(), CardViewItem::repaintCard(), and setSelected(). |
|
Definition at line 706 of file cardview.cpp. References QPtrListIterator::current(), CardViewItem::d, CardViewItem::height(), and QPtrListIterator::toFirst(). |
|
Definition at line 725 of file cardview.cpp. References CardViewItem::d, and CardViewItem::height(). |
|
Ensures that the given item is in the viewable area of the widget.
Definition at line 731 of file cardview.cpp. References CardViewItem::d, and QScrollView::ensureVisible(). Referenced by setCurrentItem(), and KAddressBookCardView::setSelected(). |
|
Repaints the given item.
Definition at line 737 of file cardview.cpp. References CardViewItem::d, CardViewItem::height(), and QScrollView::repaintContents(). Referenced by CardViewItem::repaintCard(). |
|
Sets the selection mode.
Definition at line 743 of file cardview.cpp. References selectAll(). |
|
Definition at line 750 of file cardview.cpp. |
|
Selects or deselects the given item. This method honors the current selection mode, so if other items are selected, they may be unselected. Definition at line 788 of file cardview.cpp. References CardViewItem::isSelected(), CardViewItem::repaintCard(), selectAll(), selectionChanged(), and CardViewItem::setSelected(). Referenced by setCurrentItem(), and KAddressBookCardView::setSelected(). |
|
Selects or deselects all items.
Definition at line 755 of file cardview.cpp. References QPtrListIterator::current(), selectionChanged(), QPtrListIterator::toFirst(), and QScrollView::viewport(). Referenced by KAddressBookCardView::setSelected(), setSelected(), and setSelectionMode(). |
|
Definition at line 840 of file cardview.cpp. References CardViewItem::isSelected(). |
|
Definition at line 845 of file cardview.cpp. References QPtrListIterator::current(), and QPtrListIterator::toFirst(). |
|
Definition at line 858 of file cardview.cpp. Referenced by KAddressBookCardView::refresh(), KAddressBookCardView::selectedUids(), and KAddressBookCardView::setSelected(). |
|
Definition at line 1035 of file cardview.cpp. Referenced by CardViewItem::nextItem(). |
|
Definition at line 863 of file cardview.cpp. |
|
Attempts to find the first item matching the params.
Definition at line 868 of file cardview.cpp. References QPtrListIterator::current(), QString::isEmpty(), QString::startsWith(), QPtrListIterator::toFirst(), and QString::upper(). |
|
Returns the amounts of pixels required for one column. This depends on wheather drawSeparators is enabled: If so, it is itemWidth + 2*itemSpacing + separatorWidth If not, it is itemWidth + itemSpacing
Definition at line 895 of file cardview.cpp. |
|
Sets if the border around a card should be draw. The border is a thing (1 or 2 pixel) line that bounds the card. When drawn, it shows when a card is highlighted and when it isn't. Definition at line 1530 of file cardview.cpp. Referenced by KAddressBookCardView::readConfig(). |
|
Definition at line 1539 of file cardview.cpp. |
|
Sets if the column separator should be drawn. The column separator is a thin verticle line (1 or 2 pixels) that is used to separate the columns in the list view. The separator is just for esthetics and it does not serve a functional purpose. Definition at line 1544 of file cardview.cpp. References setLayoutDirty(). Referenced by KAddressBookCardView::readConfig(). |
|
Definition at line 1553 of file cardview.cpp. |
|
Sets if the field labels should be drawn. The field labels are the unique strings used to identify the fields. Sometimes drawing these labels makes sense as a source of clarity for the user, othertimes they waste too much space and do not assist the user. Definition at line 1558 of file cardview.cpp. Referenced by KAddressBookCardView::readConfig(). |
|
Definition at line 1567 of file cardview.cpp. Referenced by CardViewItem::showFullString(). |
|
Sets if fields with no value should be drawn (of cause the label only, but it allows for embedded editing sometimes...).
Definition at line 1572 of file cardview.cpp. References setLayoutDirty(). Referenced by KAddressBookCardView::readConfig(). |
|
Definition at line 1581 of file cardview.cpp. Referenced by CardViewItem::fieldAt(), CardViewItem::height(), and CardViewItem::showFullString(). |
|
Definition at line 1041 of file cardview.cpp. Referenced by CardViewItem::height(), CardViewItem::paintCard(), and CardViewItem::showFullString(). |
|
Sets the internal item margin.
Definition at line 1046 of file cardview.cpp. References setLayoutDirty(). Referenced by KAddressBookCardView::readConfig(). |
|
Definition at line 1055 of file cardview.cpp. |
|
Sets the item spacing.
Definition at line 1060 of file cardview.cpp. References setLayoutDirty(). Referenced by KAddressBookCardView::readConfig(). |
|
Definition at line 1641 of file cardview.cpp. Referenced by CardViewItem::paintCard(), CardViewItem::showFullString(), and KAddressBookCardView::writeConfig(). |
|
Sets the width made available to card items.
Definition at line 1646 of file cardview.cpp. References setLayoutDirty(), and QScrollView::updateContents(). Referenced by KAddressBookCardView::readConfig(). |
|
Sets the header font.
Definition at line 1657 of file cardview.cpp. Referenced by KAddressBookCardView::readConfig(). |
|
Definition at line 1664 of file cardview.cpp. Referenced by CardViewItem::paintCard(), and CardViewItem::showFullString(). |
|
@reimp.
Definition at line 1669 of file cardview.cpp. Referenced by KAddressBookCardView::readConfig(). |
|
Sets the column separator width.
Definition at line 1681 of file cardview.cpp. References setLayoutDirty(). Referenced by KAddressBookCardView::readConfig(). |
|
Definition at line 1676 of file cardview.cpp. |
|
Sets the maximum number of lines to display pr field. If set to 0 (the default) all lines will be displayed. Definition at line 1692 of file cardview.cpp. |
|
Definition at line 1687 of file cardview.cpp. Referenced by CardViewItem::fieldAt(), CardViewItem::height(), CardViewItem::paintCard(), and CardViewItem::showFullString(). |
|
Emitted whenever the selection changes. This means a user highlighted a new item or unhighlighted a currently selected item. Referenced by selectAll(), and setSelected(). |
|
Same as above method, only it carries the item that was selected. This method will only be emitted in single select mode, since it defineds which item was selected. |
|
This method is emitted whenever an item is clicked.
|
|
Emitted whenever the user 'executes' an item. This is dependant on the KDE global config. This could be a single click or a doubleclick. Also emitted when the return key is pressed on an item. |
|
Emitted whenever the user double clicks on an item.
|
|
Emitted when the current item changes.
Referenced by setCurrentItem(). |
|
Emitted when the return key is pressed in an item.
|
|
Emitted when the context menu is requested in some way.
|
|
Determines which cards intersect that region and tells them to paint themselves.
Reimplemented from QScrollView. Definition at line 902 of file cardview.cpp. References calcLayout(), QRect::contains(), QPtrListIterator::current(), CardViewItem::d, QScrollView::drawContents(), CardViewItem::height(), QRect::intersects(), CardViewItem::paintCard(), QPainter::restore(), QPainter::save(), QRect::setRect(), QPtrListIterator::toFirst(), QPainter::translate(), QScrollView::viewport(), QRect::x(), and QRect::y(). |
|
Sets the layout to dirty and repaints.
Definition at line 961 of file cardview.cpp. References setLayoutDirty(). |
|
Changes the direction the canvas scolls.
Reimplemented from QScrollView. Definition at line 1516 of file cardview.cpp. References QWheelEvent::delta(), and QScrollView::scrollBy(). |
|
Sets the layout to dirty and calls for a repaint.
Definition at line 1521 of file cardview.cpp. Referenced by clear(), CardViewItem::clearFields(), CardViewItem::insertField(), insertItem(), CardViewItem::removeField(), resizeEvent(), setDrawColSeparators(), setItemMargin(), setItemSpacing(), setItemWidth(), setSeparatorWidth(), setShowEmptyFields(), and takeItem(). |
|
Does the math based on the bounding rect of the cards to properly lay the cards out on the screen. This is only done if the layout is marked as dirty. Definition at line 968 of file cardview.cpp. References QPtrListIterator::current(), CardViewItem::d, CardViewItem::height(), QScrollView::horizontalScrollBar(), QScrollView::resizeContents(), and QPtrListIterator::toFirst(). Referenced by drawContents(). |
|
Overload this method to be told when a drag should be started. In most cases you will want to start a drag event with the currently selected item. Definition at line 1586 of file cardview.cpp. |
The documentation for this class was generated from the following files: