kaddressbook
CardView Class Reference
#include <cardview.h>
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 194 of file cardview.h.
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 Member Functions | |
CardView (QWidget *parent, const char *name) | |
void | insertItem (CardViewItem *item) |
void | takeItem (CardViewItem *item) |
void | clear () |
CardViewItem * | currentItem () const |
void | setCurrentItem (CardViewItem *item) |
CardViewItem * | itemAt (const QPoint &viewPos) const |
QRect | itemRect (const CardViewItem *item) const |
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 (const CardViewItem *item) const |
int | childCount () const |
CardViewItem * | findItem (const QString &text, const QString &label, Qt::StringComparisonMode compare=Qt::BeginsWith) const |
uint | columnWidth () const |
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 () const |
void | setItemMargin (uint margin) |
uint | itemSpacing () const |
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 () const |
void | setMaxFieldLines (int howmany) |
int | maxFieldLines () const |
Protected Member Functions | |
void | drawContents (QPainter *p, int clipx, int clipy, int clipw, int cliph) |
void | resizeEvent (QResizeEvent *) |
void | contentsWheelEvent (QWheelEvent *) |
void | setLayoutDirty (bool dirty) |
void | calcLayout () |
virtual void | contentsMousePressEvent (QMouseEvent *) |
virtual void | contentsMouseMoveEvent (QMouseEvent *) |
virtual void | contentsMouseReleaseEvent (QMouseEvent *) |
virtual void | contentsMouseDoubleClickEvent (QMouseEvent *) |
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 |
Constructor & Destructor Documentation
|
Constructor.
Definition at line 572 of file cardview.cpp. |
Member Function Documentation
|
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 894 of file cardview.cpp. |
|
Definition at line 802 of file cardview.cpp. |
|
Clears the view and deletes all card view items.
Definition at line 624 of file cardview.cpp. |
|
This method is emitted whenever an item is clicked.
|
|
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 830 of file cardview.cpp. |
|
Changes the direction the canvas scolls.
Definition at line 1386 of file cardview.cpp. |
|
Emitted when the context menu is requested in some way.
|
|
Emitted when the current item changes.
|
|
Definition at line 631 of file cardview.cpp. |
|
Emitted whenever the user double clicks on an item.
|
|
Definition at line 1407 of file cardview.cpp. |
|
Definition at line 1420 of file cardview.cpp. |
|
Determines which cards intersect that region and tells them to paint themselves.
Definition at line 837 of file cardview.cpp. |
|
Definition at line 1433 of file cardview.cpp. |
|
Ensures that the given item is in the viewable area of the widget.
Definition at line 689 of file cardview.cpp. |
|
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. |
|
Attempts to find the first item matching the params.
Definition at line 807 of file cardview.cpp. |
|
Definition at line 797 of file cardview.cpp. |
|
Definition at line 1529 of file cardview.cpp. |
|
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 609 of file cardview.cpp. |
|
Definition at line 780 of file cardview.cpp. |
|
Definition at line 954 of file cardview.cpp. |
|
Definition at line 667 of file cardview.cpp. |
|
Definition at line 960 of file cardview.cpp. |
|
Definition at line 684 of file cardview.cpp. |
|
Definition at line 974 of file cardview.cpp. |
|
Definition at line 1506 of file cardview.cpp. |
|
Definition at line 1552 of file cardview.cpp. |
|
Repaints the given item.
Definition at line 695 of file cardview.cpp. |
|
Sets the layout to dirty and repaints.
Definition at line 887 of file cardview.cpp. |
|
Emitted when the return key is pressed in an item.
|
|
Selects or deselects all items.
Definition at line 712 of file cardview.cpp. |
|
Definition at line 785 of file cardview.cpp. |
|
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. |
|
Emitted whenever the selection changes. This means a user highlighted a new item or unhighlighted a currently selected item. |
|
Definition at line 707 of file cardview.cpp. |
|
Definition at line 1541 of file cardview.cpp. |
|
Sets the CardViewItem
Definition at line 639 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 1399 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 1412 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 1425 of file cardview.cpp. |
|
Reimplementation from QWidget.
Definition at line 1534 of file cardview.cpp. |
|
Sets the header font.
Definition at line 1522 of file cardview.cpp. |
|
Sets the internal item margin. See itemMargin(). Definition at line 965 of file cardview.cpp. |
|
Sets the item spacing.
Definition at line 979 of file cardview.cpp. |
|
Sets the width made available to card items.
Definition at line 1511 of file cardview.cpp. |
|
Sets the layout to dirty and calls for a repaint.
Definition at line 1391 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 1557 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 737 of file cardview.cpp. |
|
Sets the selection mode.
Definition at line 700 of file cardview.cpp. |
|
Sets the column separator width.
Definition at line 1546 of file cardview.cpp. |
|
Sets if fields with no value should be drawn (of cause the label only, but it allows for embedded editing sometimes. ..) Definition at line 1438 of file cardview.cpp. |
|
Definition at line 1446 of file cardview.cpp. |
|
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 1451 of file cardview.cpp. |
|
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 615 of file cardview.cpp. |
The documentation for this class was generated from the following files: