KListView Class Reference

`#include <klistview.h>`

Inheritance diagram for KListView:

## Public Types

enum | SelectionModeExt { Single = QListView::Single, Multi = QListView::Multi, Extended = QListView::Extended, NoSelection = QListView::NoSelection, FileManager }

## Public Slots

virtual void | rename (QListViewItem *item, int c)
void | setRenameable (int column, bool yesno=true)
virtual void | setItemsMovable (bool b)
virtual void | setItemsRenameable (bool b)
virtual void | setDragEnabled (bool b)
virtual void | setAutoOpen (bool b)
virtual void | setDropVisualizer (bool b)
void | setDropVisualizerWidth (int w)
virtual void | setTooltipColumn (int column)
virtual void | setDropHighlighter (bool b)
virtual void | setCreateChildren (bool b) KDE_DEPRECATED
void | setSelectionModeExt (SelectionModeExt mode)
void | setTabOrderedRenaming (bool b)
bool | tabOrderedRenaming () const

## Signals

void | executed (QListViewItem *item)
void | executed (QListViewItem *item, const QPoint &pos, int c)
void | dropped (QDropEvent *e, QListViewItem *after)
void | dropped (KListView *list, QDropEvent *e, QListViewItem *after)
void | dropped (KListView *list, QDropEvent *e, QListViewItem *parent, QListViewItem *after)
void | dropped (QDropEvent *e, QListViewItem *parent, QListViewItem *after)
void | moved ()
void | aboutToMove ()
void | moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow)
void | moved (QPtrList< QListViewItem > &items, QPtrList< QListViewItem > &afterFirst, QPtrList< QListViewItem > &afterNow)
void | itemRenamed (QListViewItem *item, const QString &str, int col)
void | itemRenamed (QListViewItem *item)
void | menuShortCutPressed (KListView *list, QListViewItem *item)
void | contextMenu (KListView *l, QListViewItem *i, const QPoint &p)
void | itemAdded (QListViewItem *item)
void | itemRemoved (QListViewItem *item)

## Public Member Functions

| KListView (QWidget *parent=0, const char *name=0)
virtual | ~KListView ()
virtual void | setAcceptDrops (bool)
virtual bool | isExecuteArea (const QPoint &point)
bool | isExecuteArea (int x)
QPtrList< QListViewItem > | selectedItems () const
QPtrList< QListViewItem > | selectedItems (bool includeHiddenItems) const
void | moveItem (QListViewItem *item, QListViewItem *parent, QListViewItem *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 KDE_DEPRECATED
bool | dropHighlighter () const
int | dropVisualizerWidth () const
SelectionModeExt | selectionModeExt () const
int | itemIndex (const QListViewItem *item) const
QListViewItem * | itemAtIndex (int index)
void | setFullWidth () KDE_DEPRECATED
void | setFullWidth (bool fullWidth)
bool | fullWidth () const
virtual int | addColumn (const QString &label, int width=-1)
virtual int | addColumn (const QIconSet &iconset, const QString &label, int width=-1)
virtual void | removeColumn (int index)
void | setAlternateBackground (const QColor &c)
const QColor & | alternateBackground () const
void | saveLayout (KConfig *config, const QString &group) const
void | restoreLayout (KConfig *config, const QString &group)
virtual void | setSorting (int column, bool ascending=true)
int | columnSorted (void) const
bool | ascendingSort (void) const
virtual void | takeItem (QListViewItem *i)
void | setShadeSortColumn (bool shadeSortColumn)
bool | shadeSortColumn (void) const

## Protected Slots

void | slotSettingsChanged (int)
void | slotMouseButtonClicked (int btn, QListViewItem *item, const QPoint &pos, int c)
void | doneEditing (QListViewItem *item, int row)
void | cleanDropVisualizer ()
void | cleanItemHighlighter ()
void | emitContextMenu (QListViewItem *, const QPoint &, int)
void | emitContextMenu (KListView *, QListViewItem *)
void | slotOnItem (QListViewItem *item)
void | slotOnViewport ()
void | slotAutoSelect ()
void | slotDragExpand ()
void | slotHeaderChanged ()

## Protected Member Functions

bool | below (const QRect &rect, const QPoint &p)
bool | below (QListViewItem *i, const QPoint &p)
virtual bool | event (QEvent *)
void | emitExecute (QListViewItem *item, const QPoint &pos, int c)
virtual void | focusInEvent (QFocusEvent *fe)
virtual void | focusOutEvent (QFocusEvent *fe)
virtual void | leaveEvent (QEvent *e)
virtual QString | tooltip (QListViewItem *item, int column) const
virtual bool | showTooltip (QListViewItem *item, const QPoint &pos, int column) const
virtual void | contentsDragMoveEvent (QDragMoveEvent *event)
virtual void | contentsMousePressEvent (QMouseEvent *e)
virtual void | contentsMouseMoveEvent (QMouseEvent *e)
virtual void | contentsMouseDoubleClickEvent (QMouseEvent *e)
virtual void | contentsDragLeaveEvent (QDragLeaveEvent *event)
virtual void | contentsMouseReleaseEvent (QMouseEvent *)
virtual void | contentsDropEvent (QDropEvent *)
virtual void | contentsDragEnterEvent (QDragEnterEvent *)
virtual QDragObject * | dragObject ()
virtual bool | acceptDrag (QDropEvent *event) const
virtual QRect | drawDropVisualizer (QPainter *p, QListViewItem *parent, QListViewItem *after)
virtual QRect | drawItemHighlighter (QPainter *painter, QListViewItem *item)
virtual void | startDrag ()
virtual void | keyPressEvent (QKeyEvent *)
virtual void | viewportPaintEvent (QPaintEvent *)
void | activateAutomaticSelection ()
void | deactivateAutomaticSelection ()
bool | automaticSelection () const
virtual void | viewportResizeEvent (QResizeEvent *e)
void | disableAutoSelection ()
void | resetAutoSelection ()
void | doubleClicked (QListViewItem *item, const QPoint &pos, int c)
virtual void | movableDropEvent (QListViewItem *parent, QListViewItem *afterme)
virtual void | findDrop (const QPoint &pos, QListViewItem *&parent, QListViewItem *&after)
void | fileManagerKeyPressEvent (QKeyEvent *)
int | depthToPixels (int depth)
virtual void | virtual_hook (int id, void *data)

## Properties

bool | fullWidth
bool | itemsMovable
bool | itemsRenameable
bool | dragEnabled
bool | autoOpen
bool | dropVisualizer
int | tooltipColumn
int | dropVisualizerWidth
QColor | alternateBackground
bool | shadeSortColumn

## 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 have to derive from it. Reimplement dragObject() and (possibly) startDrag(), and setDragEnabled(true).

Definition at line 53 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 explicitly.

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

Definition at line 104 of file klistview.h.

## 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 425 of file klistview.cpp.

KListView::~KListView | ( |  | ) |

virtual

Destructor.

Definition at line 470 of file klistview.cpp.

## Member Function Documentation

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

See also
  moveItem()

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

Definition at line 1407 of file klistview.cpp.

void KListView::activateAutomaticSelection | ( |  | ) |

protected

In FileManager selection mode: explicitly activate the mode in which the current item is automatically selected.

Definition at line 1478 of file klistview.cpp.

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

virtual

Reimplemented for full width support.

See also
  removeColumn()

Definition at line 1965 of file klistview.cpp.

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

virtual

Reimplemented for full width support.

Definition at line 1975 of file klistview.cpp.

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

Returns
  the alternate background color

See also
  setAlternateBackground()

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

Returns
  whether the current sort is ascending (or descending)

Definition at line 2109 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 explicitly, e.g. using the mouse.

Definition at line 1495 of file klistview.cpp.

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

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

See also
  setAutoOpen()

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 671 of file klistview.h.

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 685 of file klistview.h.

void KListView::cleanDropVisualizer | ( |  | ) |

protected slot

Repaint the rect where I was drawing the drop line.

Definition at line 1042 of file klistview.cpp.

void KListView::cleanItemHighlighter | ( |  | ) |

protected slot

Repaint the rect where I was drawing the drop rectangle.

Definition at line 1368 of file klistview.cpp.

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

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

Definition at line 2104 of file klistview.cpp.

void KListView::contentsDragEnterEvent | ( | QDragEnterEvent * | 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.

Definition at line 1294 of file klistview.cpp.

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.

Definition at line 1035 of file klistview.cpp.

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.

Definition at line 985 of file klistview.cpp.

void KListView::contentsDropEvent | ( | QDropEvent * | 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 909 of file klistview.cpp.

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.

Definition at line 881 of file klistview.cpp.

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.

Definition at line 808 of file klistview.cpp.

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.

Definition at line 761 of file klistview.cpp.

void KListView::contentsMouseReleaseEvent | ( | 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.

Definition at line 848 of file klistview.cpp.

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.

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

For future expansions.

Do not use.

Deprecated:

Definition at line 1417 of file klistview.cpp.

void KListView::deactivateAutomaticSelection | ( |  | ) |

protected

In FileManager selection mode: explicitly deactivate the mode in which the current item is automatically selected.

Definition at line 1490 of file klistview.cpp.

int KListView::depthToPixels | ( | int | depth | ) |

protected

Convert the depth of an item into its indentation in pixels.

Definition at line 1052 of file klistview.cpp.

void KListView::disableAutoSelection | ( |  | ) |

protected

Disable AutoSelection.

This overrides the system wide setting for AutoSelection. Please don't call this unless you have good reasons to override the system wide setting for AutoSelection.

See also
  resetAutoSelection()

Since
  3.2

Definition at line 2122 of file klistview.cpp.

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

protected

Deprecated:
  This is just here for binary compatibility. Use the signal in QListView instead.

Definition at line 2141 of file klistview.cpp.

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

Returns
  whether dragging is enabled. False by default.

See also
  setDragEnabled()

QDragObject * KListView::dragObject | ( |  | ) |

protected virtual

Returns
  a dragobject encoding the current selection.

See also
  setDragEnabled()

Definition at line 1162 of file klistview.cpp.

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 1305 of file klistview.cpp.

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 1352 of file klistview.cpp.

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

Returns
  true if drawing of the drop-highlighter has been enabled. False by default.

See also
  setDropHighlighter()

Definition at line 1438 of file klistview.cpp.

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 occurred (or 0L, if the drop was above all items)

See also
  acceptDrop()

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 occurred (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 occurred (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 occurred (or 0L, if the drop was above all items

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

Returns
  true if drawing of the drop-visualizer has been enabled. True by default.

See also
  setDropVisualizer()

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

The dropVisualizerWidth defaults to 4.

See also
  setDropVisualizerWidth()

Returns
  the current width of the drop-visualizer.

void KListView::emitContextMenu | ( | QListViewItem * | i,
|  | const QPoint & | p,
|  | int |
| ) |  |

protected slot

Emit the contextMenu signal.

This slot is for mouse actions.

Definition at line 1905 of file klistview.cpp.

void KListView::emitContextMenu | ( | KListView * | ,
|  | QListViewItem * | i
| ) |  |

protected slot

Emit the contextMenu signal.

This slot is for key presses.

Definition at line 1893 of file klistview.cpp.

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

protected

Emit signal executed.

Definition at line 680 of file klistview.cpp.

bool KListView::event | ( | QEvent * | e | ) |

protected virtual

Reimplemented to reload the alternate background in palette changes.

Definition at line 753 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.

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::fileManagerKeyPressEvent | ( | QKeyEvent * | e | ) |

protected

A special keyPressEvent (for FileManager selection mode).

Definition at line 1500 of file klistview.cpp.

void KListView::findDrop | ( | const QPoint & | pos,
|  | QListViewItem *& | parent,
|  | QListViewItem *& | after
| ) |  |

protected virtual

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

FIXME KDE 4.0: Make this method const so it can be called from an acceptDrag method without ugly casts

Definition at line 1057 of file klistview.cpp.

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 708 of file klistview.cpp.

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 724 of file klistview.cpp.

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

Returns whether the last column is set to fit the available width.

See also
  setFullWidth()

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 475 of file klistview.cpp.

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 485 of file klistview.cpp.

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

Returns
  true if `column` is renamable.

See also
  setRenameable()

Definition at line 1387 of file klistview.cpp.

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 1877 of file klistview.cpp.

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 1858 of file klistview.cpp.

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.

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

Returns
  if it is legal to move items in the list view. True by default.

See also
  setDragEnabled()
  setItemsMovable()

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

Returns
  whether inplace-renaming has been enabled. False by default.

See also
  setItemsRenameable()

void KListView::keyPressEvent | ( | QKeyEvent * | 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 1463 of file klistview.cpp.

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

Returns
  the last child of this listview.

See also
  lastItem()

Definition at line 1126 of file klistview.cpp.

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

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

See also
  lastChild()

Definition at line 1136 of file klistview.cpp.

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 746 of file klistview.cpp.

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.

void KListView::movableDropEvent | ( | QListViewItem * | parent,
|  | QListViewItem * | afterme
| ) |  |

protected virtual

Handle dropEvent when itemsMovable() is set to true.

Definition at line 935 of file klistview.cpp.

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.

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::moveItem | ( | QListViewItem * | item,
|  | QListViewItem * | parent,
|  | QListViewItem * | after
| ) |  |

Arbitrarily move `item` to `parent`, positioned immediately after item `after`.

If after is 0, `item` is made the first child of `parent`.

(Un-deprecated in kde-3.4)

Definition at line 1264 of file klistview.cpp.

void KListView::removeColumn | ( | int | index | ) |

virtual

Reimplemented for full width support.

See also
  addColumn()

Definition at line 1985 of file klistview.cpp.

void KListView::rename | ( | QListViewItem * | item,
|  | int | c
| ) |  |

virtual slot

Rename column `c` of `item`.

Definition at line 1378 of file klistview.cpp.

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

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

Since
  3.2

Definition at line 1146 of file klistview.cpp.

void KListView::resetAutoSelection | ( |  | ) |

protected

Reset AutoSelection to the system wide setting.

See also
  disableAutoSelection()

Since
  3.2

Definition at line 2132 of file klistview.cpp.

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 2036 of file klistview.cpp.

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 2018 of file klistview.cpp.

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

Returns
  a list containing the currently selected items.

Deprecated:

Definition at line 1222 of file klistview.cpp.

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

Returns
  a list containing the currently selected items.

Parameters

  includeHiddenItems | Set to true to return all items regardless of visibility. Set to false to only return items that are isVisible().

Returns
  a list of all selected listview items

Since
  3.4

Definition at line 1227 of file klistview.cpp.

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

Returns
  the "extended" selection mode of this listview.

See also
  SelectionModeExt
  setSelectionModeExt

Definition at line 1853 of file klistview.cpp.

void KListView::setAcceptDrops | ( | bool | val | ) |

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 1910 of file klistview.cpp.

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 color to disable alternate colors.

See also
  alternateBackground()

Definition at line 2001 of file klistview.cpp.

void KListView::setAutoOpen | ( | bool | b | ) |

virtual slot

Enable/Disable AutoOpen (not implemented currently).

Definition at line 1202 of file klistview.cpp.

void KListView::setCreateChildren | ( | bool | b | ) |

virtual slot

For future expansions.

Do not use.

Deprecated:

Definition at line 1412 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 1192 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 1433 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 1217 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 1300 of file klistview.cpp.

void KListView::setFullWidth | ( |  | ) |

Deprecated:
  See also
    setFullWidth()

Definition at line 1949 of file klistview.cpp.

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

Let the last column fit exactly all the available width.

See also
  fullWidth()

Definition at line 1954 of file klistview.cpp.

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 1171 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 1181 of file klistview.cpp.

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 1392 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 1830 of file klistview.cpp.

void KListView::setShadeSortColumn | ( | bool | shadeSortColumn | ) |

Set to true if the currently sorted column should be drawn shaded.

Defaults to true

Parameters

  shadeSortColumn | True if sort column should be shaded.

Since
  3.4

Definition at line 2007 of file klistview.cpp.

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

virtual

Reimplemented to remember the current sort column and order.

Parameters

  column | is the column to be sorted, or -1 to sort in order of insertion
  ascending | whether to sort ascending (or descending)

Definition at line 2071 of file klistview.cpp.

void KListView::setTabOrderedRenaming | ( | bool | b | ) |

slot

Enable/disable tabbing between editable cells.

Since
  3.1

Definition at line 1453 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 1428 of file klistview.cpp.

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

See if the sort column should be drawn shaded.

Returns
  true if the sort column should be shaded

Since
  3.4

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 1443 of file klistview.cpp.

void KListView::slotAutoSelect | ( |  | ) |

protected slot

Process AutoSelection.

Definition at line 591 of file klistview.cpp.

void KListView::slotHeaderChanged | ( |  | ) |

protected slot

Reacts to header changes in full width mode.

Definition at line 667 of file klistview.cpp.

void KListView::slotOnItem | ( | QListViewItem * | item | ) |

protected slot

Accessory slot for AutoSelect.

Definition at line 524 of file klistview.cpp.

void KListView::slotOnViewport | ( |  | ) |

protected slot

Accessory slot for AutoSelect/ChangeCursorOverItem.

Definition at line 533 of file klistview.cpp.

void KListView::slotSettingsChanged | ( | int | category | ) |

protected slot

Update internal settings whenever the global ones change.

Definition at line 542 of file klistview.cpp.

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

Definition at line 1151 of file klistview.cpp.

bool KListView::tabOrderedRenaming | ( |  | ) | const

slot

Returns whether tab ordered renaming is enabled.

Since
  3.1

Definition at line 1458 of file klistview.cpp.

void KListView::takeItem | ( | QListViewItem * | i | ) |

virtual

Reimplemented for internal reasons.

Definition at line 2114 of file klistview.cpp.

QString KListView::tooltip | ( | QListViewItem * | item,
|  | int | column
| ) |  | const

protected virtual

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

Definition at line 1448 of file klistview.cpp.

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

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

See also
  setTooltipColumn()

void KListView::viewportPaintEvent | ( | QPaintEvent * | 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 1922 of file klistview.cpp.

void KListView::viewportResizeEvent | ( | QResizeEvent * | e | ) |

protected virtual

Reimplemented for setFullWidth()

Definition at line 1991 of file klistview.cpp.

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

- klistview.h
- klistview.cpp

KDE Home | KDE Accessibility Home | Description of Access Keys