# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KListView Class Reference

This Widget extends the functionality of QListView to honor the system wide settings for Single Click/Double Click mode, AutoSelection and ChangeCursorOverLink (TM). More...

`#include <klistview.h>`

Inheritance diagram for KListView:

[legend]
Collaboration diagram for KListView:

[legend]
List of all members.

## Public Types

enum | SelectionModeExt { Single = QListView::Single, Multi = QListView::Multi, Extended = QListView::Extended, NoSelection = QListView::NoSelection, FileManager }
| Possible selection modes. More...

## Public Slots

virtual void | rename (QListViewItem *item, int c)
| Rename column `c` of `item`.
void | setRenameable (int column, bool yesno=true)
| By default, if you called setItemsRenameable(true), only the first column is renameable.
virtual void | setItemsMovable (bool b)
| Set whether items in the list view can be moved.
virtual void | setItemsRenameable (bool b)
| Enables inplace-renaming of items.
virtual void | setDragEnabled (bool b)
| Enable/Disable the dragging of items.
virtual void | setAutoOpen (bool b)
| Enable/Disable AutoOpen (not implemented currently).
virtual void | setDropVisualizer (bool b)
| Enable/Disable the drawing of a drop-visualizer (a bar that shows where a dropped item would be inserted).
void | setDropVisualizerWidth (int w)
| Set the width of the (default) drop-visualizer.
virtual void | setTooltipColumn (int column)
| Set which column should be used for automatic tooltips.
virtual void | setDropHighlighter (bool b)
| Enable/Disable the drawing of a drop-highlighter (a rectangle around the item under the mouse cursor).
virtual void | setCreateChildren (bool b)
| For future expansions.
void | setSelectionModeExt (SelectionModeExt mode)
| Set the selection mode.
void | setTabOrderedRenaming (bool b)

Enable/disable tabbing between editable cells

Since:
  3.1.

bool | tabOrderedRenaming () const

Returns whether tab ordered renaming is enabled

Since:
  3.1.

## Signals

void | executed (QListViewItem *item)
| This signal is emitted whenever the user executes an listview item.
void | executed (QListViewItem *item, const QPoint &pos, int c)
| This signal is emitted whenever the user executes an listview item.
void | doubleClicked (QListViewItem *item, const QPoint &pos, int c)
| This signal gets emitted whenever the user double clicks into the listview.
void | dropped (QDropEvent *e, QListViewItem *after)
| This signal gets emitted whenever something acceptable is dropped onto the listview.
void | dropped (KListView *list, QDropEvent *e, QListViewItem *after)
| This signal gets emitted whenever something acceptable is dropped onto the listview.
void | dropped (KListView *list, QDropEvent *e, QListViewItem *parent, QListViewItem *after)
| This signal gets emitted whenever something acceptable is dropped onto the listview.
void | dropped (QDropEvent *e, QListViewItem *parent, QListViewItem *after)
| This signal gets emitted whenever something acceptable is dropped onto the listview.
void | moved ()
| This signal is emitted when ever the user moves an item in the list via DnD.
void | aboutToMove ()
| Connect to this signal if you want to do some preprocessing before a move is made, for example, to disable sorting.
void | moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow)
| This signal is emitted when ever the user moves an item in the list via DnD.
void | moved (QPtrList< QListViewItem > &items, QPtrList< QListViewItem > &afterFirst, QPtrList< QListViewItem > &afterNow)
| This signal is emitted after all the items have been moved.
void | itemRenamed (QListViewItem *item, const QString &str, int col)
| This signal gets emitted when an item is renamed via in-place renaming.
void | itemRenamed (QListViewItem *item)
| Same as above, but without the extra information.
void | menuShortCutPressed (KListView *list, QListViewItem *item)
| This signal is emitted when the shortcut key for popup-menus is pressed.
void | contextMenu (KListView *l, QListViewItem *i, const QPoint &p)
| This signal is emitted whenever a context-menu should be shown for item `i`.

## Public Member Functions

| KListView (QWidget *parent=0, const char *name=0)
| Constructor.
virtual | ~KListView ()
| Destructor.
virtual void | setAcceptDrops (bool)
| Reimplemented for internal reasons.
virtual bool | isExecuteArea (const QPoint &point)
| This function determines whether the given coordinates are within the execute area.
bool | isExecuteArea (int x)
| Same thing, but from an x coordinate only.
QPtrList< QListViewItem > | selectedItems () const
void | moveItem (QListViewItem *item, QListViewItem *parent, QListViewItem *after)
| Arbitrarily move `item` to `parent`, positioned immediately after item `after`.
QListViewItem * | lastItem () const
QListViewItem * | lastChild () const
KLineEdit * | renameLineEdit () const
bool | itemsMovable () const
bool | itemsRenameable () const
bool | dragEnabled () const
bool | autoOpen () const
bool | isRenameable (int column) const
bool | dropVisualizer () const
int | tooltipColumn () const
bool | createChildren () const
| For future expansions.
bool | dropHighlighter () const
int | dropVisualizerWidth () const
| The dropVisualizerWidth defaults to 4.
SelectionModeExt | selectionModeExt () const
int | itemIndex (const QListViewItem *item) const
| Returns the index of `item` within the item tree or -1 if `item` doesn't exist in this list view.
QListViewItem * | itemAtIndex (int index)
| Returns the item of `index` within the item tree or 0 if `index` doesn't exist in this list view.
void | setFullWidth ()
| This class or method is obsolete, it is provided for compatibility only.
void | setFullWidth (bool fullWidth)
| Let the last column fit exactly all the available width.
bool | fullWidth () const
| Returns whether the last column is set to fit the available width.
virtual int | addColumn (const QString &label, int width=-1)
| Reimplemented for full width support.
virtual int | addColumn (const QIconSet &iconset, const QString &label, int width=-1)
| Reimplemented for full width support.
virtual void | removeColumn (int index)
| Reimplemented for full width support.
void | setAlternateBackground (const QColor &c)
| sets the alternate background background color.
const QColor & | alternateBackground () const
void | saveLayout (KConfig *config, const QString &group) const
| Saves the list view's layout (column widtsh, column order, sort column) to a KConfig group.
void | restoreLayout (KConfig *config, const QString &group)
| Reads the list view's layout from a KConfig group as stored with saveLayout.
virtual void | setSorting (int column, bool ascending=true)
| Reimplemented to remember the current sort column and order.
int | columnSorted (void) const
bool | ascendingSort (void) const

## Protected Slots

void | slotSettingsChanged (int)
| Update internal settings whenever the global ones change.
void | slotMouseButtonClicked (int btn, QListViewItem *item, const QPoint &pos, int c)
void | doneEditing (QListViewItem *item, int row)
void | cleanDropVisualizer ()
| Repaint the rect where I was drawing the drop line.
void | cleanItemHighlighter ()
| Repaint the rect where I was drawing the drop rectangle.
void | emitContextMenu (QListViewItem *, const QPoint &, int)
| Emit the contextMenu signal.
void | emitContextMenu (KListView *, QListViewItem *)
| Emit the contextMenu signal.
void | slotOnItem (QListViewItem *item)
| Accessory slot for AutoSelect.
void | slotOnViewport ()
| Accessory slot for AutoSelect/ChangeCursorOverItem.
void | slotAutoSelect ()
| Process AutoSelection.
void | slotHeaderChanged ()
| Reacts to header changes in full width mode.

## Protected Member Functions

bool | below (const QRect &rect, const QPoint &p)
| Determine whether a drop on position `p` would count as being above or below the QRect `rect`.
bool | below (QListViewItem *i, const QPoint &p)
| An overloaded version of below(const QRect&, const QPoint&).
virtual bool | event (QEvent *)
| Reimplemented to reload the alternate background in palette changes.
void | emitExecute (QListViewItem *item, const QPoint &pos, int c)
| Emit signal executed.
virtual void | focusInEvent (QFocusEvent *fe)
| Reimplemented for internal reasons.
virtual void | focusOutEvent (QFocusEvent *fe)
| Reimplemented for internal reasons.
virtual void | leaveEvent (QEvent *e)
| Reimplemented for internal reasons.
virtual QString | tooltip (QListViewItem *item, int column) const
virtual bool | showTooltip (QListViewItem *item, const QPoint &pos, int column) const
virtual void | contentsDragMoveEvent (QDragMoveEvent *event)
| Reimplemented for internal reasons.
virtual void | contentsMousePressEvent (QMouseEvent *e)
| Reimplemented for internal reasons.
virtual void | contentsMouseMoveEvent (QMouseEvent *e)
| Reimplemented for internal reasons.
virtual void | contentsMouseDoubleClickEvent (QMouseEvent *e)
| Reimplemented for internal reasons.
virtual void | contentsDragLeaveEvent (QDragLeaveEvent *event)
| Reimplemented for internal reasons.
virtual void | contentsMouseReleaseEvent (QMouseEvent *)
| Reimplemented for internal reasons.
virtual void | contentsDropEvent (QDropEvent *)
| Reimplemented for internal reasons.
virtual void | contentsDragEnterEvent (QDragEnterEvent *)
| Reimplemented for internal reasons.
virtual QDragObject * | dragObject ()
virtual bool | acceptDrag (QDropEvent *event) const
virtual QRect | drawDropVisualizer (QPainter *p, QListViewItem *parent, QListViewItem *after)
| Paint the drag line.
virtual QRect | drawItemHighlighter (QPainter *painter, QListViewItem *item)
| Paint the drag rectangle.
virtual void | startDrag ()
| This method calls dragObject() and starts the drag.
virtual void | keyPressEvent (QKeyEvent *)
| Reimplemented for internal reasons.
virtual void | viewportPaintEvent (QPaintEvent *)
| Reimplemented for internal reasons.
void | activateAutomaticSelection ()
| In FileManager selection mode: explicitely activate the mode in which the current item is automatically selected.
void | deactivateAutomaticSelection ()
| In FileManager selection mode: explicitely deactivate the mode in which the current item is automatically selected.
bool | automaticSelection () const
| In FileManager selection mode: return whether it is currently in the mode where the current item is selected automatically.
virtual void | viewportResizeEvent (QResizeEvent *e)
| Reimplemented for setFullWidth().
virtual void | movableDropEvent (QListViewItem *parent, QListViewItem *afterme)
| Handle dropEvent when itemsMovable() is set to true.
virtual void | findDrop (const QPoint &pos, QListViewItem *&parent, QListViewItem *&after)
| Where is the nearest QListViewItem that I'm going to drop?
void | fileManagerKeyPressEvent (QKeyEvent *)
| A special keyPressEvent (for FileManager selection mode).
int | depthToPixels (int depth)
| Convert the depth of an item into its indentation in pixels.
virtual void | virtual_hook (int id, void *data)

## Friends

class | KListViewItem

## Detailed Description

This Widget extends the functionality of QListView to honor the system wide settings for Single Click/Double Click mode, AutoSelection and ChangeCursorOverLink (TM).

There is a new signal executed(). It gets connected to either QListView::clicked() or QListView::doubleClicked() depending on the KDE wide Single Click/Double Click settings. It is strongly recommended that you use this signal instead of the above mentioned. This way you donīt need to care about the current settings. If you want to get informed when the user selects something connect to the QListView::selectionChanged() signal.

Drag-and-Drop is supported with the signal dropped(), just setAcceptDrops(true) and connect it to a suitable slot. To see where you are dropping, setDropVisualizer(true). And also you'll need acceptDrag(QDropEvent*)

KListView is drag-enabled, too: to benefit from that you've got derive from it. Reimplement dragObject() and (possibly) startDrag(), and setDragEnabled(true).

Version:
  Id
    klistview.h,v 1.92.2.3 2003/09/03 11:22:19 wheeler Exp

Definition at line 54 of file klistview.h.

## Member Enumeration Documentation

enum KListView::SelectionModeExt

Possible selection modes.

The first four correspond directly to QListView::SelectionMode, while the FileManager selection mode is defined as follows:

- home: move to the first
- end: move to the last
- PgUp/PgDn: move one page up/down
- up/down: move one item up/down
- insert: toggle selection of current and move to the next
- space: toggle selection of the current
- CTRL+up: move to the previous item and toggle selection of this one
- CTRL+down: toggle selection of the current item and move to the next
- CTRL+end: toggle selection from (including) the current item to (including) the last item
- CTRL+home: toggle selection from (including) the current item to the (including) the first item
- CTRL+PgDn: toggle selection from (including) the current item to (excluding) the item one page down
- CTRL+PgUp: toggle selection from (excluding) the current item to (including) the item one page up

The combinations work the same with SHIFT instead of CTRL, except that if you start selecting something using SHIFT everything selected before will be deselected first.

Additionally the current item is always selected automatically when navigating using the keyboard, except other items were selected explicitely.

This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected

Definition at line 95 of file klistview.h.

Referenced by selectionModeExt().

## Constructor & Destructor Documentation

KListView::KListView | ( | QWidget * | parent = 0,
|  | const char * | name = 0
| ) |

Constructor.

The parameters `parent` and `name` are handled by QListView, as usual.

Definition at line 396 of file klistview.cpp.

References KGlobalSettings::alternateBackgroundColor(), cleanDropVisualizer(), cleanItemHighlighter(), emitContextMenu(), menuShortCutPressed(), KStdAccel::name(), QListView::onItem(), QListView::onViewport(), QListView::rightButtonClicked(), QListView::rightButtonPressed(), slotAutoSelect(), slotOnItem(), slotOnViewport(), and slotSettingsChanged().

KListView::~KListView | ( |  | ) | `[virtual]`

| Destructor. Definition at line 441 of file klistview.cpp.

## Member Function Documentation

void KListView::setAcceptDrops | ( | bool |  | ) | `[virtual]`

| Reimplemented for internal reasons. Further reimplementations should call this function or else some features may not work correctly. The API is unaffected. Definition at line 1825 of file klistview.cpp.

bool KListView::isExecuteArea | ( | const QPoint & | point | ) | `[virtual]`

This function determines whether the given coordinates are within the execute area.

The execute area is the part of a QListViewItem where mouse clicks or double clicks respectively generate a executed() signal. Depending on QListView::allColumnsShowFocus() this is either the whole item or only the first column.

Returns:
  true if point is inside execute area of an item, false in all other cases including the case that it is over the viewport.

Definition at line 446 of file klistview.cpp.

References QListView::itemAt(), and QPoint::x().

Referenced by contentsMouseMoveEvent(), emitExecute(), and slotOnItem().

bool KListView::isExecuteArea | ( | int | x | ) |

| Same thing, but from an x coordinate only. This only checks if x is in the first column (if all columns don't show focus), without testing if the y coordinate is over an item or not. Definition at line 454 of file klistview.cpp. References QListView::allColumnsShowFocus(), QListView::columnWidth(), and QListView::header().

QPtrList< QListViewItem > KListView::selectedItems | ( |  | ) | const

Returns:
  a list containing the currently selected items.

Definition at line 1158 of file klistview.cpp.

References QPtrList::append(), QListView::firstChild(), QListViewItem::isSelected(), and QListViewItem::itemBelow().

Referenced by fileManagerKeyPressEvent().

void KListView::moveItem | ( | QListViewItem * | item,
|  | QListViewItem * | parent,
|  | QListViewItem * | after
| ) |

| Arbitrarily move `item` to `parent`, positioned immediately after item `after`. Definition at line 1167 of file klistview.cpp. References QListView::insertItem(), QListViewItem::insertItem(), QListViewItem::parent(), and QListView::takeItem(). Referenced by movableDropEvent().

QListViewItem * KListView::lastItem | ( |  | ) | const

Returns:
  the last item (not child!) of this listview.

See also:
  lastChild()

Reimplemented from QListView.

Definition at line 1073 of file klistview.cpp.

References QListViewItemIterator::current(), and lastChild().

Referenced by findDrop().

QListViewItem * KListView::lastChild | ( |  | ) | const

Returns:
  the last child of this listview.

Definition at line 1063 of file klistview.cpp.

References QListView::firstChild(), and QListViewItem::nextSibling().

Referenced by lastItem().

KLineEdit * KListView::renameLineEdit | ( |  | ) | const

Returns:
  the lineedit used for inline renaming. Use that to setup a KCompletion or QValidator for the lineedit

Definition at line 1083 of file klistview.cpp.

bool KListView::itemsMovable | ( |  | ) | const

Returns:
  if it is legal to move items in the list view

Definition at line 1112 of file klistview.cpp.

Referenced by acceptDrag(), and contentsDropEvent().

bool KListView::itemsRenameable | ( |  | ) | const

Returns:
  whether inplace-renaming has been enabled.

See also:
  setItemsRenameable()

Definition at line 1122 of file klistview.cpp.

Referenced by contentsMouseReleaseEvent().

bool KListView::dragEnabled | ( |  | ) | const

Returns:
  whether dragging is enabled.

Definition at line 1133 of file klistview.cpp.

Referenced by contentsMouseMoveEvent().

bool KListView::autoOpen | ( |  | ) | const

Returns:
  true if AutoOpen is enabled (not implemented currently).

See also:
  setAutoOpen()

Definition at line 1143 of file klistview.cpp.

bool KListView::isRenameable | ( | int | column | ) | const

Returns:
  true if `column` is renamable.

Definition at line 1291 of file klistview.cpp.

bool KListView::dropVisualizer | ( |  | ) | const

Returns:
  true if drawing of the drop-visualizer has been enabled.

Definition at line 1148 of file klistview.cpp.

Referenced by contentsDragMoveEvent().

int KListView::tooltipColumn | ( |  | ) | const

Returns:
  the column for which tooltips are displayed (or -1 if none set).

Definition at line 1329 of file klistview.cpp.

Referenced by showTooltip().

bool KListView::createChildren | ( |  | ) | const

| For future expansions. Do not use. This class or method is obsolete, it is provided for compatibility only. Definition at line 1323 of file klistview.cpp.

bool KListView::dropHighlighter | ( |  | ) | const

Returns:
  true if drawing of the drop-highlighter has been enabled.

Definition at line 1344 of file klistview.cpp.

Referenced by contentsDragMoveEvent().

int KListView::dropVisualizerWidth | ( |  | ) | const

The dropVisualizerWidth defaults to 4.

Returns:
  the current width of the drop-visualizer.

Definition at line 1831 of file klistview.cpp.

KListView::SelectionModeExt KListView::selectionModeExt | ( |  | ) | const

Returns:
  the "extended" selection mode of this listview.

See also:
  SelectionModeExt

  setSelectionModeExt

Definition at line 1768 of file klistview.cpp.

References SelectionModeExt.

Referenced by contentsMousePressEvent().

int KListView::itemIndex | ( | const QListViewItem * | item | ) | const

| Returns the index of `item` within the item tree or -1 if `item` doesn't exist in this list view. This function takes all items into account not only the visible ones. Definition at line 1773 of file klistview.cpp. References QListViewItemIterator::current(), and QListView::firstChild(). Referenced by slotAutoSelect().

QListViewItem * KListView::itemAtIndex | ( | int | index | ) |

| Returns the item of `index` within the item tree or 0 if `index` doesn't exist in this list view. This function takes all items into account not only the visible ones. Definition at line 1792 of file klistview.cpp. References QListViewItemIterator::current(), and QListView::firstChild().

void KListView::setFullWidth | ( |  | ) |

| This class or method is obsolete, it is provided for compatibility only. Definition at line 1868 of file klistview.cpp.

void KListView::setFullWidth | ( | bool | fullWidth | ) |

| Let the last column fit exactly all the available width. Definition at line 1873 of file klistview.cpp. References QListView::columns(), and QListView::header().

bool KListView::fullWidth | ( |  | ) | const

| Returns whether the last column is set to fit the available width. Definition at line 1879 of file klistview.cpp.

int KListView::addColumn | ( | const QString & | label,
|  | int | width = -1
| ) | `[virtual]`

| Reimplemented for full width support. Reimplemented from QListView. Definition at line 1884 of file klistview.cpp. References QListView::addColumn(), QListView::columns(), QListView::header(), and KStdAccel::label(). Referenced by KJanusWidget::KJanusWidget().

int KListView::addColumn | ( | const QIconSet & | iconset,
|  | const QString & | label,
|  | int | width = -1
| ) | `[virtual]`

| Reimplemented for full width support. Reimplemented from QListView. Definition at line 1894 of file klistview.cpp. References QListView::addColumn(), QListView::columns(), QListView::header(), and KStdAccel::label().

void KListView::removeColumn | ( | int | index | ) | `[virtual]`

| Reimplemented for full width support. Reimplemented from QListView. Definition at line 1904 of file klistview.cpp. References QListView::columns(), QListView::header(), and QListView::removeColumn().

void KListView::setAlternateBackground | ( | const QColor & | c | ) |

sets the alternate background background color.

This only has an effect if the items are KListViewItems

Parameters:

  c | the color to use for every other item. Set to an invalid colour to disable alternate colours.

Definition at line 1920 of file klistview.cpp.

const QColor & KListView::alternateBackground | ( |  | ) | const

Returns:
  the alternate background color

Definition at line 1915 of file klistview.cpp.

Referenced by KListViewItem::isAlternate().

void KListView::saveLayout | ( | KConfig * | config,
|  | const QString & | group
| ) | const

Saves the list view's layout (column widtsh, column order, sort column) to a KConfig group.

Parameters:

  config | the KConfig object to write to
  group | the config group to use

Definition at line 1926 of file klistview.cpp.

References QListView::columns(), QListView::columnWidth(), QListView::header(), QString::number(), and KConfigBase::writeEntry().

void KListView::restoreLayout | ( | KConfig * | config,
|  | const QString & | group
| ) |

Reads the list view's layout from a KConfig group as stored with saveLayout.

Parameters:

  config | the KConfig object to read from
  group | the config group to use

Definition at line 1941 of file klistview.cpp.

References KConfigBase::hasKey(), QListView::header(), KConfigBase::readBoolEntry(), KConfigBase::readListEntry(), KConfigBase::readNumEntry(), QListView::setColumnWidth(), and setSorting().

void KListView::setSorting | ( | int | column,
|  | bool | ascending = true
| ) | `[virtual]`

| Reimplemented to remember the current sort column and order. Reimplemented from QListView. Definition at line 1957 of file klistview.cpp. References QListView::setSorting(). Referenced by KJanusWidget::KJanusWidget(), and restoreLayout().

int KListView::columnSorted | ( | void |  | ) | const

Returns:
  the currently sorted column, or -1 if none is sorted

Definition at line 1964 of file klistview.cpp.

bool KListView::ascendingSort | ( | void |  | ) | const

Returns:
  whether the current sort is ascending (or descending)

Definition at line 1969 of file klistview.cpp.

void KListView::executed | ( | QListViewItem * | item | ) | `[signal]`

This signal is emitted whenever the user executes an listview item.

That means depending on the KDE wide Single Click/Double Click setting the user clicked or double clicked on that item.

Parameters:

  item | is the pointer to the executed listview item.

Note that you may not delete any QListViewItem objects in slots connected to this signal.

Referenced by emitExecute().

void KListView::executed | ( | QListViewItem * | item,
|  | const QPoint & | pos,
|  | int | c
| ) | `[signal]`

This signal is emitted whenever the user executes an listview item.

That means depending on the KDE wide Single Click/Double Click setting the user clicked or double clicked on that item.

Parameters:

  item | is the pointer to the executed listview item.
  pos | is the position where the user has clicked
  c | is the column into which the user clicked.

Note that you may not delete any QListViewItem objects in slots connected to this signal.

void KListView::doubleClicked | ( | QListViewItem * | item,
|  | const QPoint & | pos,
|  | int | c
| ) | `[signal]`

This signal gets emitted whenever the user double clicks into the listview.

Parameters:

  item | is the pointer to the clicked listview item.
  pos | is the position where the user has clicked, and
  c | is the column into which the user clicked.

Note that you may not delete any QListViewItem objects in slots connected to this signal.

This signal is more or less here for the sake of completeness. You should normally not need to use this. In most cases itīs better to use executed() instead.

Reimplemented from QListView.

Referenced by contentsMouseDoubleClickEvent().

void KListView::dropped | ( | QDropEvent * | e,
|  | QListViewItem * | after
| ) | `[signal]`

This signal gets emitted whenever something acceptable is dropped onto the listview.

Parameters:

  e | is the drop event itself (it has already been accepted)
  after | is the item after which the drop occured (or 0L, if the drop was above all items)

See also:
  #acceptDrop()

Reimplemented in KFileTreeView.

Referenced by contentsDropEvent().

void KListView::dropped | ( | KListView * | list,
|  | QDropEvent * | e,
|  | QListViewItem * | after
| ) | `[signal]`

This signal gets emitted whenever something acceptable is dropped onto the listview.

This is an overloaded version of the above (provided to simplify processing drops outside of the class).

Parameters:

  list | is the listview
  e | is the drop event itself (it has already been accepted)
  after | is the item after which the drop occured (or 0L, if the drop was above all items

void KListView::dropped | ( | KListView * | list,
|  | QDropEvent * | e,
|  | QListViewItem * | parent,
|  | QListViewItem * | after
| ) | `[signal]`

This signal gets emitted whenever something acceptable is dropped onto the listview.

This function also provides a parent, in the event that your listview is a tree

Parameters:

  list | is the listview
  e | is the drop event itself (it has already been accepted)
  parent | the item that is to be the parent of the new item
  after | is the item after which the drop occured (or 0L, if the drop was above all items

void KListView::dropped | ( | QDropEvent * | e,
|  | QListViewItem * | parent,
|  | QListViewItem * | after
| ) | `[signal]`

This signal gets emitted whenever something acceptable is dropped onto the listview.

This function also provides a parent, in the event that your listview is a tree

Parameters:

  e | is the drop event itself (it has already been accepted)
  parent | the item that is to be the parent of the new item
  after | is the item after which the drop occured (or 0L, if the drop was above all items

Reimplemented in KFileTreeView.

void KListView::moved | ( |  | ) | `[signal]`

| This signal is emitted when ever the user moves an item in the list via DnD. If more than one item is moved at the same time, this signal is only emitted once. Referenced by movableDropEvent(), and startDrag().

void KListView::aboutToMove | ( |  | ) | `[signal]`

| Connect to this signal if you want to do some preprocessing before a move is made, for example, to disable sorting. This is sent only once per each groups of moves. That is, for each drop that is a move this will be emitted once, before KListView calls moveItem() Referenced by movableDropEvent().

void KListView::moved | ( | QListViewItem * | item,
|  | QListViewItem * | afterFirst,
|  | QListViewItem * | afterNow
| ) | `[signal]`

This signal is emitted when ever the user moves an item in the list via DnD.

If more than one item is moved at the same time, `afterFirst` and `afterNow` will reflect what was true before the move. This differs from moved(), so be careful. All the items will have been moved before moved() is emitted, which is not true in this method. // FIXME

Parameters:

  item | the item that was moved
  afterFirst | the item that parameter item was in before the move, in the list
  afterNow | the item it's currently after.

void KListView::moved | ( | QPtrList< QListViewItem > & | items,
|  | QPtrList< QListViewItem > & | afterFirst,
|  | QPtrList< QListViewItem > & | afterNow
| ) | `[signal]`

| This signal is emitted after all the items have been moved. It reports info for each and every item moved, in order. The first element in `items` associates with the first of afterFirst and afterNow.

void KListView::itemRenamed | ( | QListViewItem * | item,
|  | const QString & | str,
|  | int | col
| ) | `[signal]`

This signal gets emitted when an item is renamed via in-place renaming.

Parameters:

  item | is the renamed item.
  str | is the new value of column `col`.
  col | is the renamed column.

void KListView::itemRenamed | ( | QListViewItem * | item | ) | `[signal]`

| Same as above, but without the extra information.

void KListView::menuShortCutPressed | ( | KListView * | list,
|  | QListViewItem * | item
| ) | `[signal]`

This signal is emitted when the shortcut key for popup-menus is pressed.

Normally you should not use this, just connect a slot to signal contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly handle showing context menus regardless of settings.

Parameters:

  list | is this listview.
  item | is the currentItem() at the time the key was pressed. May be 0L.

Referenced by keyPressEvent(), and KListView().

void KListView::contextMenu | ( | KListView * | l,
|  | QListViewItem * | i,
|  | const QPoint & | p
| ) | `[signal]`

This signal is emitted whenever a context-menu should be shown for item `i`.

It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click).

Parameters:

  l | is this listview.
  i | is the item for which the menu should be shown. May be 0L.
  p | is the point at which the menu should be shown.

Referenced by emitContextMenu().

void KListView::rename | ( | QListViewItem * | item,
|  | int | c
| ) | `[virtual, slot]`

| Rename column `c` of `item`. Definition at line 1282 of file klistview.cpp. References QListView::ensureItemVisible(). Referenced by contentsMouseReleaseEvent(), and KListViewLineEdit::selectNextCell().

void KListView::setRenameable | ( | int | column,
|  | bool | yesno = true
| ) | `[slot]`

| By default, if you called setItemsRenameable(true), only the first column is renameable. Use this function to enable the feature on other columns. If you want more intelligent (dynamic) selection, you'll have to derive from KListView, and override rename() and call only call it if you want the item to be renamed. Definition at line 1296 of file klistview.cpp. References QListView::header().

void KListView::setItemsMovable | ( | bool | b | ) | `[virtual, slot]`

Set whether items in the list view can be moved.

It is enabled by default.

See also:
  itemsMovable()

Definition at line 1107 of file klistview.cpp.

void KListView::setItemsRenameable | ( | bool | b | ) | `[virtual, slot]`

Enables inplace-renaming of items.

It is disabled by default.

See also:
  itemsRenameable()

  setRenameable()

Definition at line 1117 of file klistview.cpp.

void KListView::setDragEnabled | ( | bool | b | ) | `[virtual, slot]`

| Enable/Disable the dragging of items. It is disabled by default. Definition at line 1128 of file klistview.cpp.

void KListView::setAutoOpen | ( | bool | b | ) | `[virtual, slot]`

| Enable/Disable AutoOpen (not implemented currently). Definition at line 1138 of file klistview.cpp.

void KListView::setDropVisualizer | ( | bool | b | ) | `[virtual, slot]`

| Enable/Disable the drawing of a drop-visualizer (a bar that shows where a dropped item would be inserted). It is enabled by default, if dragging is enabled Definition at line 1153 of file klistview.cpp.

void KListView::setDropVisualizerWidth | ( | int | w | ) | `[slot]`

| Set the width of the (default) drop-visualizer. If you don't call this method, the width is set to 4. Definition at line 1200 of file klistview.cpp.

void KListView::setTooltipColumn | ( | int | column | ) | `[virtual, slot]`

Set which column should be used for automatic tooltips.

Parameters:

  column | is the column for which tooltips will be shown. Set -1 to disable this feature.

Definition at line 1334 of file klistview.cpp.

void KListView::setDropHighlighter | ( | bool | b | ) | `[virtual, slot]`

| Enable/Disable the drawing of a drop-highlighter (a rectangle around the item under the mouse cursor). It is disabled by default. Definition at line 1339 of file klistview.cpp.

void KListView::setCreateChildren | ( | bool | b | ) | `[virtual, slot]`

| For future expansions. Do not use. This class or method is obsolete, it is provided for compatibility only. Definition at line 1318 of file klistview.cpp.

void KListView::setSelectionModeExt | ( | SelectionModeExt | mode | ) | `[slot]`

| Set the selection mode. A different name was chosen to avoid API-clashes with QListView::setSelectionMode(). Definition at line 1745 of file klistview.cpp. References QListView::setSelectionMode().

void KListView::setTabOrderedRenaming | ( | bool | b | ) | `[slot]`

Enable/disable tabbing between editable cells

Since:
  3.1.

Definition at line 1359 of file klistview.cpp.

bool KListView::tabOrderedRenaming | ( |  | ) | const`[slot]`

Returns whether tab ordered renaming is enabled

Since:
  3.1.

Definition at line 1364 of file klistview.cpp.

bool KListView::below | ( | const QRect & | rect,
|  | const QPoint & | p
| ) | `[inline, protected]`

Determine whether a drop on position `p` would count as being above or below the QRect `rect`.

Parameters:

  rect | is the rectangle we examine.
  p | is the point located in the rectangle, p is assumed to be in viewport coordinates.

Definition at line 602 of file klistview.h.

References QRect::bottom(), QRect::top(), and QPoint::y().

Referenced by below().

bool KListView::below | ( | QListViewItem * | i,
|  | const QPoint & | p
| ) | `[inline, protected]`

An overloaded version of below(const QRect&, const QPoint&).

It differs from the above only in what arguments it takes.

Parameters:

  i | the item whose rect() is passed to the above function.
  p | is translated from contents coordinates to viewport coordinates before being passed to the above function.

Definition at line 616 of file klistview.h.

References below(), and QListView::itemRect().

bool KListView::event | ( | QEvent * |  | ) | `[protected, virtual]`

| Reimplemented to reload the alternate background in palette changes. Definition at line 712 of file klistview.cpp. References KGlobalSettings::alternateBackgroundColor(), and QEvent::type().

void KListView::emitExecute | ( | QListViewItem * | item,
|  | const QPoint & | pos,
|  | int | c
| ) | `[protected]`

| Emit signal executed. Definition at line 634 of file klistview.cpp. References executed(), and isExecuteArea(). Referenced by contentsMouseDoubleClickEvent().

void KListView::focusInEvent | ( | QFocusEvent * | fe | ) | `[protected, virtual]`

| Reimplemented for internal reasons. Further reimplementations should call this function or else some features may not work correctly. The API is unaffected. Definition at line 667 of file klistview.cpp. References QListView::currentItem(), QFocusEvent::reason(), and QListView::selectionChanged().

void KListView::focusOutEvent | ( | QFocusEvent * | fe | ) | `[protected, virtual]`

| Reimplemented for internal reasons. Further reimplementations should call this function or else some features may not work correctly. The API is unaffected. Definition at line 683 of file klistview.cpp. References cleanDropVisualizer(), cleanItemHighlighter(), QListView::currentItem(), QFocusEvent::reason(), and QListView::selectionChanged().

void KListView::leaveEvent | ( | QEvent * | e | ) | `[protected, virtual]`

| Reimplemented for internal reasons. Further reimplementations should call this function or else some features may not work correctly. The API is unaffected. Definition at line 705 of file klistview.cpp.

QString KListView::tooltip | ( | QListViewItem * | item,
|  | int | column
| ) | const`[protected, virtual]`

Returns:
  the tooltip for `column` of `item`.

Definition at line 1354 of file klistview.cpp.

References QListViewItem::text().

Referenced by showTooltip().

bool KListView::showTooltip | ( | QListViewItem * | item,
|  | const QPoint & | pos,
|  | int | column
| ) | const`[protected, virtual]`

Returns:
  whether the tooltip for `column` of `item` shall be shown at point `pos`.

Definition at line 1349 of file klistview.cpp.

References QString::length(), tooltip(), and tooltipColumn().

void KListView::contentsDragMoveEvent | ( | QDragMoveEvent * | event | ) | `[protected, virtual]`

Reimplemented for internal reasons.

Further reimplementations should call this function or else some features may not work correctly.

The API is unaffected.

Reimplemented in KFileTreeView.

Definition at line 940 of file klistview.cpp.

References acceptDrag(), cleanDropVisualizer(), cleanItemHighlighter(), drawDropVisualizer(), drawItemHighlighter(), dropHighlighter(), dropVisualizer(), KNotifyClient::event(), and findDrop().

void KListView::contentsMousePressEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

Reimplemented for internal reasons.

Further reimplementations should call this function or else some features may not work correctly.

The API is unaffected.

Reimplemented from QListView.

Definition at line 720 of file klistview.cpp.

References QMouseEvent::button(), QListView::clearSelection(), QListView::contentsMousePressEvent(), QListView::currentItem(), QListViewItem::depth(), QListView::header(), QListViewItem::isSelected(), QListView::itemAt(), QListView::itemMargin(), QMouseEvent::pos(), QListView::rootIsDecorated(), selectionModeExt(), QMouseEvent::state(), QListView::treeStepSize(), and QPoint::x().

void KListView::contentsMouseMoveEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

Reimplemented for internal reasons.

Further reimplementations should call this function or else some features may not work correctly.

The API is unaffected.

Reimplemented from QListView.

Definition at line 767 of file klistview.cpp.

References QListView::contentsMouseMoveEvent(), QListView::contentsMouseReleaseEvent(), dragEnabled(), KCursor::handCursor(), isExecuteArea(), QListView::itemAt(), QMouseEvent::pos(), startDrag(), QPoint::x(), and QPoint::y().

void KListView::contentsMouseDoubleClickEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

Reimplemented for internal reasons.

Further reimplementations should call this function or else some features may not work correctly.

The API is unaffected.

Reimplemented from QListView.

Definition at line 840 of file klistview.cpp.

References QMouseEvent::button(), doubleClicked(), QListView::doubleClicked(), emitExecute(), QMouseEvent::globalPos(), QListView::header(), QListView::itemAt(), QMouseEvent::pos(), and QPoint::x().

void KListView::contentsDragLeaveEvent | ( | QDragLeaveEvent * | event | ) | `[protected, virtual]`

| Reimplemented for internal reasons. Further reimplementations should call this function or else some features may not work correctly. The API is unaffected. Reimplemented in KFileTreeView. Definition at line 973 of file klistview.cpp. References cleanDropVisualizer(), and cleanItemHighlighter().

void KListView::contentsMouseReleaseEvent | ( | QMouseEvent * |  | ) | `[protected, virtual]`

Reimplemented for internal reasons.

Further reimplementations should call this function or else some features may not work correctly.

The API is unaffected.

Reimplemented from QListView.

Definition at line 807 of file klistview.cpp.

References QMouseEvent::button(), QListView::contentsMouseReleaseEvent(), QListViewItem::depth(), QListView::header(), QListView::itemAt(), QListView::itemMargin(), itemsRenameable(), QMouseEvent::pos(), rename(), QListView::rootIsDecorated(), QListView::treeStepSize(), and QPoint::x().

void KListView::contentsDropEvent | ( | QDropEvent * |  | ) | `[protected, virtual]`

Reimplemented for internal reasons.

Further reimplementations should call this function or else some features may not work correctly.

The API is unaffected.

Reimplemented in KFileTreeView.

Definition at line 866 of file klistview.cpp.

References QDropEvent::acceptAction(), acceptDrag(), cleanDropVisualizer(), cleanItemHighlighter(), dropped(), findDrop(), itemsMovable(), movableDropEvent(), QDropEvent::pos(), and QDropEvent::source().

void KListView::contentsDragEnterEvent | ( | QDragEnterEvent * |  | ) | `[protected, virtual]`

| Reimplemented for internal reasons. Further reimplementations should call this function or else some features may not work correctly. The API is unaffected. Reimplemented in KFileTreeView. Definition at line 1194 of file klistview.cpp. References acceptDrag(), and KNotifyClient::event().

QDragObject * KListView::dragObject | ( |  | ) | `[protected, virtual]`

Returns:
  a dragobject encoding the current selection.

See also:
  setDragEnabled()

Reimplemented from QListView.

Reimplemented in KFileTreeView.

Definition at line 1099 of file klistview.cpp.

References QListView::currentItem().

Referenced by startDrag().

bool KListView::acceptDrag | ( | QDropEvent * | event | ) | const`[protected, virtual]`

Returns:
  true if the `event` provides some acceptable format. A common mistake is to forget the "const" in your reimplementation

Reimplemented in KFileTreeView.

Definition at line 1313 of file klistview.cpp.

References itemsMovable(), and QDropEvent::source().

Referenced by contentsDragEnterEvent(), contentsDragMoveEvent(), and contentsDropEvent().

QRect KListView::drawDropVisualizer | ( | QPainter * | p,
|  | QListViewItem * | parent,
|  | QListViewItem * | after
| ) | `[protected, virtual]`

Paint the drag line.

If painter is null, don't try to :)

If after == 0 then the marker should be drawn at the top.

Returns:
  the rectangle that you painted to.

Definition at line 1205 of file klistview.cpp.

References QRect::bottom(), QListViewItem::depth(), QPainter::fillRect(), QListViewItem::firstChild(), QListViewItem::isOpen(), QListView::itemMargin(), QListView::itemRect(), QListViewItem::nextSibling(), QListView::rootIsDecorated(), QRect::setBottom(), QRect::setLeft(), QRect::setRight(), QRect::setTop(), and QListView::treeStepSize().

Referenced by contentsDragMoveEvent().

QRect KListView::drawItemHighlighter | ( | QPainter * | painter,
|  | QListViewItem * | item
| ) | `[protected, virtual]`

Paint the drag rectangle.

If painter is null, don't try to :)

Returns:
  the rectangle that you painted to.

Definition at line 1252 of file klistview.cpp.

References QListViewItem::depth(), QListView::itemRect(), QRect::left(), QRect::setLeft(), and QListView::treeStepSize().

Referenced by contentsDragMoveEvent().

void KListView::startDrag | ( |  | ) | `[protected, virtual]`

| This method calls dragObject() and starts the drag. Reimplement it to do fancy stuff like setting a pixmap or using a non-default DragMode Reimplemented from QListView. Definition at line 1088 of file klistview.cpp. References QDragObject::drag(), dragObject(), moved(), and QDragObject::target(). Referenced by contentsMouseMoveEvent().

void KListView::keyPressEvent | ( | QKeyEvent * |  | ) | `[protected, virtual]`

| Reimplemented for internal reasons. Further reimplementations should call this function or else some features may not work correctly. The API is unaffected. Reimplemented in KFileDetailView. Definition at line 1369 of file klistview.cpp. References QListView::currentItem(), fileManagerKeyPressEvent(), QKeyEvent::key(), and menuShortCutPressed().

void KListView::viewportPaintEvent | ( | QPaintEvent * |  | ) | `[protected, virtual]`

| Reimplemented for internal reasons. Further reimplementations should call this function or else some features may not work correctly. The API is unaffected. Definition at line 1837 of file klistview.cpp. References QPainter::fillRect(), and QPaintEvent::rect().

void KListView::activateAutomaticSelection | ( |  | ) | `[protected]`

| In FileManager selection mode: explicitely activate the mode in which the current item is automatically selected. Definition at line 1384 of file klistview.cpp. References QListView::currentItem(), QListView::selectAll(), and QListView::selectionChanged().

void KListView::deactivateAutomaticSelection | ( |  | ) | `[protected]`

| In FileManager selection mode: explicitely deactivate the mode in which the current item is automatically selected. Definition at line 1397 of file klistview.cpp.

bool KListView::automaticSelection | ( |  | ) | const`[protected]`

| In FileManager selection mode: return whether it is currently in the mode where the current item is selected automatically. Returns false if items were selected explicitely, e.g. using the mouse. Definition at line 1402 of file klistview.cpp.

void KListView::viewportResizeEvent | ( | QResizeEvent * | e | ) | `[protected, virtual]`

| Reimplemented for setFullWidth(). Definition at line 1910 of file klistview.cpp.

void KListView::slotSettingsChanged | ( | int |  | ) | `[protected, slot]`

Update internal settings whenever the global ones change.

Definition at line 489 of file klistview.cpp.

References KGlobalSettings::autoSelectDelay(), KGlobalSettings::changeCursorOverIcon(), KGlobalSettings::contextMenuKey(), KGlobalSettings::dndEventDelay(), emitContextMenu(), QListView::mouseButtonClicked(), QListView::rightButtonClicked(), QListView::rightButtonPressed(), KGlobalSettings::showContextMenusOnPress(), and KGlobalSettings::singleClick().

Referenced by KListView().

void KListView::cleanDropVisualizer | ( |  | ) | `[protected, slot]`

| Repaint the rect where I was drawing the drop line. Definition at line 979 of file klistview.cpp. Referenced by contentsDragLeaveEvent(), contentsDragMoveEvent(), contentsDropEvent(), focusOutEvent(), and KListView().

void KListView::cleanItemHighlighter | ( |  | ) | `[protected, slot]`

| Repaint the rect where I was drawing the drop rectangle. Definition at line 1272 of file klistview.cpp. Referenced by contentsDragLeaveEvent(), contentsDragMoveEvent(), contentsDropEvent(), focusOutEvent(), and KListView().

void KListView::emitContextMenu | ( | QListViewItem * | ,
|  | const QPoint & | ,
|  | int |
| ) | `[protected, slot]`

| Emit the contextMenu signal. This slot is for mouse actions. Definition at line 1820 of file klistview.cpp. References contextMenu(). Referenced by KListView(), and slotSettingsChanged().

void KListView::emitContextMenu | ( | KListView * | ,
|  | QListViewItem * |
| ) | `[protected, slot]`

| Emit the contextMenu signal. This slot is for key presses. Definition at line 1808 of file klistview.cpp. References contextMenu(), and QListView::itemRect().

void KListView::slotOnItem | ( | QListViewItem * | item | ) | `[protected, slot]`

| Accessory slot for AutoSelect. Definition at line 471 of file klistview.cpp. References isExecuteArea(), QCursor::pos(), and QPoint::x(). Referenced by KListView().

void KListView::slotOnViewport | ( |  | ) | `[protected, slot]`

| Accessory slot for AutoSelect/ChangeCursorOverItem. Definition at line 480 of file klistview.cpp. Referenced by KListView().

void KListView::slotAutoSelect | ( |  | ) | `[protected, slot]`

Process AutoSelection.

Definition at line 537 of file klistview.cpp.

References QListView::clearSelection(), QListViewItemIterator::current(), QListView::currentItem(), itemIndex(), QListViewItem::itemPos(), QListView::selectionChanged(), QListView::selectionMode(), QListView::setCurrentItem(), QListView::setSelected(), QListViewItem::setSelected(), and QListView::triggerUpdate().

Referenced by KListView().

void KListView::slotHeaderChanged | ( |  | ) | `[protected, slot]`

| Reacts to header changes in full width mode. Definition at line 624 of file klistview.cpp. References QListView::columns(), QListView::columnWidth(), and QListView::setColumnWidth().

void KListView::movableDropEvent | ( | QListViewItem * | parent,
|  | QListViewItem * | afterme
| ) | `[protected, virtual]`

Handle dropEvent when itemsMovable() is set to true.

Definition at line 890 of file klistview.cpp.

References aboutToMove(), QPtrList::append(), QListView::clearSelection(), QListView::currentItem(), QPtrList::first(), QListView::firstChild(), QListViewItem::isSelected(), QListViewItem::itemAbove(), QListViewItem::itemBelow(), moved(), moveItem(), QPtrList::next(), QListView::setCurrentItem(), and QListViewItem::setSelected().

Referenced by contentsDropEvent().

void KListView::findDrop | ( | const QPoint & | pos,
|  | QListViewItem *& | parent,
|  | QListViewItem *& | after
| ) | `[protected, virtual]`

Where is the nearest QListViewItem that I'm going to drop?

Definition at line 994 of file klistview.cpp.

References QListViewItem::childCount(), QListViewItem::depth(), depthToPixels(), QListViewItem::firstChild(), QListViewItem::height(), QListViewItem::isExpandable(), QListViewItem::isOpen(), QListViewItem::itemAbove(), QListView::itemAt(), QListView::itemRect(), lastItem(), QListViewItem::nextSibling(), QListViewItem::parent(), QPoint::x(), and QPoint::y().

Referenced by contentsDragMoveEvent(), and contentsDropEvent().

void KListView::fileManagerKeyPressEvent | ( | QKeyEvent * |  | ) | `[protected]`

A special keyPressEvent (for FileManager selection mode).

Definition at line 1407 of file klistview.cpp.

References QListView::currentItem(), QListView::ensureItemVisible(), QListView::firstChild(), QRect::isEmpty(), QListViewItem::isSelected(), QListViewItem::itemAbove(), QListViewItem::itemBelow(), QListView::itemRect(), QKeyEvent::key(), QRect::moveBy(), QListViewItem::nextSibling(), QListView::selectAll(), selectedItems(), QListView::selectionChanged(), QListView::selectionMode(), QListView::setCurrentItem(), QListView::setOpen(), QListViewItem::setSelected(), QListView::setSelectionMode(), QKeyEvent::state(), QRect::unite(), and QRect::x().

Referenced by keyPressEvent().

int KListView::depthToPixels | ( | int | depth | ) | `[protected]`

| Convert the depth of an item into its indentation in pixels. Definition at line 989 of file klistview.cpp. References QListView::itemMargin(), QListView::rootIsDecorated(), and QListView::treeStepSize(). Referenced by findDrop().

The documentation for this class was generated from the following files:

- klistview.h
- klistview.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:02:25 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001