Ksetiwatch API Documentation


popListView Class Reference

A list view with a right-mouse-button popup menu. More...

#include <poplistview.h>

Inherits QListView.

Inheritance diagram for popListView:

Inheritance graph
[legend]
Collaboration diagram for popListView:

Collaboration graph
[legend]
List of all members.

Public Types

enum  PopupStyle

Public Methods

 popListView (QWidget *parent, bool grid=false, const char *name=0)
 ~popListView ()
QListViewIteminsertRootItem (const QString &aName, QPixmap *icon=0)
QListViewIteminsertChildItem (const QString &aName, QPixmap *icon=0, QListViewItem *parent=0)
void clear ()
int insertPopupItem (const QString &name, int id=-1, int index=-1)
int insertPopupItem (const QPixmap &icon, const QString &name, int id=-1, int index=-1)
int insertPopupItem (const QString &name, QPopupMenu *pop, int id=-1, int index=-1)
int insertPopupItem (const QPixmap &icon, const QString &name, QPopupMenu *pop, int id=-1, int index=-1)
void setAccel (int key, int id)
void insertSeparator ()
void popupSetTitle (const QString &title)
KPopupMenupopupMenu ()
void setPopupStyle (PopupStyle p)
PopupStyle popupStyle ()
void setGridEnabled (bool grid)
bool isGridEnabled ()

Protected Slots

void slotMouseButtonClicked (int but, QListViewItem *it, const QPoint &pos, int col)
void slotShowContextMenu (QListViewItem *it, const QPoint &pos, int col)

Protected Attributes

QListViewItemlastChildItem
QListViewItemlastRootItem
PopupStyle pstyle
KPopupMenupopup
bool drawGrid

Detailed Description

A list view with a right-mouse-button popup menu.

This class combines a normal QListView with a popup menu which appears when the right mouse button is clicked.This allows the manipulation of list view items via the menu items in the popup menu.

There are two modes for the appearance of the popup menu. Use popListView::OverItem in order to allow the popup menu to appear only when a list view item has been clicked, or popListView::ShowAnywhere if the context menu is allowed to pop up anywhere.

Definition at line 123 of file poplistview.h.


Member Enumeration Documentation

enum popListView::PopupStyle
 

Two different popup styles.

Definition at line 248 of file poplistview.h.

Referenced by popupStyle().


Constructor & Destructor Documentation

popListView::popListView QWidget   parent,
bool    grid = false,
const char *    name = 0
 

The constructor.

Parameters:
parent  The parent widget. If 0, this widget becomes a top-level widget.
name  A text that can be used to identify this widget.

Definition at line 97 of file poplistview.cpp.

References QObject::connect(), lastChildItem, lastRootItem, QListView::mouseButtonClicked(), popup, QListView::setAllColumnsShowFocus(), QFrame::setFrameStyle(), QFrame::setLineWidth(), QFrame::setMidLineWidth(), slotMouseButtonClicked(), slotShowContextMenu(), and QListView::triggerUpdate().

popListView::~popListView  
 

The destructor.

Definition at line 126 of file poplistview.cpp.


Member Function Documentation

QListViewItem * popListView::insertRootItem const QString   aName,
QPixmap   icon = 0
 

Adds a list view item at root level.

Optionally, an icon can be displayed.

Parameters:
aName  The text to be shown in the list view.
icon  A pointer to an icon that shall be shown.
Returns:
A pointer to the new list view item.

Definition at line 138 of file poplistview.cpp.

References lastRootItem, QListViewItem::setPixmap(), and QListViewItem::setText().

Referenced by CompletedWUList::fillTreeList().

QListViewItem * popListView::insertChildItem const QString   aName,
QPixmap   icon = 0,
QListViewItem   parent = 0
 

Adds a child list view item.

The list view item will be the child of parent. Optionally, an icon can be displayed.

Parameters:
aName  The text to be shown in the list view.
icon  A pointer to an icon that shall be shown.
parent  The parent the new item shall be added to. If 0, the item will be added to the last added root item.
Returns:
A pointer to the new list view item.

Definition at line 165 of file poplistview.cpp.

References lastChildItem, lastRootItem, QListViewItem::setPixmap(), and QListViewItem::setText().

Referenced by CompletedWUList::updateList().

void popListView::clear  
 

Clears all items in the list view.

Reimplemented from QListView.

Definition at line 191 of file poplistview.cpp.

References QListView::clear(), lastChildItem, and lastRootItem.

Referenced by LoggedSigs::slotFillSpikeTable().

int popListView::insertPopupItem const QString   name,
int    id = -1,
int    index = -1
 

Adds a menu item to the right-click popup menu.

The menu item will show the text name.

Parameters:
name  The text of the menu item.
id  The ID number of the item. If negative, the identifier will be automatically generated.
index  An index value. If -1, the item will be appended to the menu.
Returns:
The menu item identifier.

Definition at line 199 of file poplistview.cpp.

References popup.

Referenced by Analysis::Analysis(), and CompletedWUList::CompletedWUList().

int popListView::insertPopupItem const QPixmap   icon,
const QString   name,
int    id = -1,
int    index = -1
 

Adds a menu item to the right-click popup menu.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

The menu item will show the text name, and the icon icon.

Parameters:
icon  A pixmap with the icon that shall be shown.
name  The text of the menu item.
id  The ID number of the item. If negative, the identifier will be automatically generated.
index  An index value. If -1, the item will be appended to the menu.
Returns:
The menu item identifier.

Definition at line 205 of file poplistview.cpp.

References popup.

int popListView::insertPopupItem const QString   name,
QPopupMenu   pop,
int    id = -1,
int    index = -1
 

Adds a menu item to the right-click popup menu.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

The menu item has a sub-menu pop, and displays the text name.

Parameters:
name  The text of the menu item.
pop  A pointer to the sub-menu.
id  The ID number of the item. If negative, the identifier will be automatically generated.
index  An index value. If -1, the item will be appended to the menu.
Returns:
The menu item identifier.

Definition at line 212 of file poplistview.cpp.

References popup.

int popListView::insertPopupItem const QPixmap   icon,
const QString   name,
QPopupMenu   pop,
int    id = -1,
int    index = -1
 

Adds a menu item to the right-click popup menu.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

The menu item has a sub-menu pop, and displays the text name and the icon icon.

Parameters:
icon  A pixmap with the icon that shall be shown.
name  The text of the menu item.
pop  A pointer to the sub-menu.
id  The ID number of the item. If negative, the identifier will be automatically generated.
index  An index value. If -1, the item will be appended to the menu.
Returns:
The menu item identifier.

Definition at line 219 of file poplistview.cpp.

References popup.

void popListView::setAccel int    key,
int    id
[inline]
 

Defines an accelerator key.

Defines an accelerator key for the menu item with the identifier id.

Parameters:
key  The accelerator key, which is a combination of the key code (e.g. Key_A) and modifiers like SHIFT, CTRL, or ALT.
id  The identifier of the menu item.

Definition at line 234 of file poplistview.h.

References popup.

Referenced by Analysis::Analysis().

void popListView::insertSeparator   [inline]
 

Adds a separator to the popup menu.

The separator becomes the last item in the popup menu.

Definition at line 239 of file poplistview.h.

References popup.

Referenced by Analysis::Analysis().

void popListView::popupSetTitle const QString   title [inline]
 

Sets the title of the popup menu.

Parameters:
title  The title of the popup menu.

Definition at line 244 of file poplistview.h.

References popup, and KPopupMenu::setTitle().

Referenced by Analysis::Analysis().

KPopupMenu * popListView::popupMenu  
 

Returns a pointer to the KPopupMenu object.

Definition at line 251 of file poplistview.cpp.

Referenced by Analysis::Analysis(), Analysis::checkPopupStatus(), CompletedWUList::CompletedWUList(), and CompletedWUList::prepareTreeListPopupMenu().

void popListView::setPopupStyle PopupStyle    p
 

Sets the behaviour of the popup menu.

Parameters:
p  The new style. This can either be popListView::ShowAnywhere to allow the popup menu anywhere in the list view, or popListView::OverItem to display the menu only when the click occurred over a list view item.

Definition at line 257 of file poplistview.cpp.

References pstyle.

Referenced by Analysis::Analysis(), CompletedWUList::CompletedWUList(), DataInfo::DataInfo(), and UserInfo::UserInfo().

popListView::PopupStyle popListView::popupStyle  
 

Returns the current popup style.

Definition at line 263 of file poplistview.cpp.

References PopupStyle, and pstyle.

void popListView::setGridEnabled bool    grid
 

Enables or disables grid lines in the list view.

Parameters:
grid  TRUE if grid lines shall be drawn, otherwise FALSE.

Definition at line 131 of file poplistview.cpp.

References drawGrid, and QWidget::update().

Referenced by UserInfo::paintEvent(), LoggedSigs::paintEvent(), DataInfo::paintEvent(), CompletedWUList::paintEvent(), and Analysis::paintEvent().

bool popListView::isGridEnabled   [inline]
 

Returns whether list view items are drawn with grid lines.

Definition at line 265 of file poplistview.h.

void popListView::slotMouseButtonClicked int    but,
QListViewItem   it,
const QPoint   pos,
int    col
[protected, slot]
 

Handles mouse button clicks correctly.

This slot is called whenever the user clicked with either mouse button onto the list view.

Parameters:
but  The mouse button which the user pressed.
it  The pointer to the clicked list view item or 0, if the user didn't click on an item.
pos  The position of the mouse cursor.
col  The list view column into which the user clicked (this argument is only valid, if it is not 0).

Definition at line 227 of file poplistview.cpp.

References QListView::currentItem(), popup, QCursor::pos(), pstyle, QListView::selectionChanged(), and QListView::setSelected().

Referenced by popListView(), and slotShowContextMenu().

void popListView::slotShowContextMenu QListViewItem   it,
const QPoint   pos,
int    col
[protected, slot]
 

Implemented as a workaround for Qt 3.0.5 (mouse button signals aren't emitted).

Parameters:
it  The pointer to the clicked list view item or 0, if the user didn't click on an item.
pos  The position of the mouse cursor.
col  The list view column into which the user clicked (this argument is only valid, if it is not 0).

Definition at line 244 of file poplistview.cpp.

References slotMouseButtonClicked().

Referenced by popListView().


Member Data Documentation

QListViewItem* popListView::lastChildItem [protected]
 

The last child item added to the tree.

Definition at line 269 of file poplistview.h.

Referenced by clear(), insertChildItem(), and popListView().

QListViewItem* popListView::lastRootItem [protected]
 

The last root-item added to the tree.

Definition at line 271 of file poplistview.h.

Referenced by clear(), insertChildItem(), insertRootItem(), and popListView().

PopupStyle popListView::pstyle [protected]
 

Stores the display style of the popup menu.

Definition at line 273 of file poplistview.h.

Referenced by popupStyle(), setPopupStyle(), and slotMouseButtonClicked().

KPopupMenu* popListView::popup [protected]
 

The user-defined popup menu.

Definition at line 275 of file poplistview.h.

Referenced by insertPopupItem(), insertSeparator(), popListView(), popupSetTitle(), setAccel(), and slotMouseButtonClicked().

bool popListView::drawGrid [protected]
 

Specifies whether to draw a grid inside the list view.

Definition at line 277 of file poplistview.h.

Referenced by setGridEnabled().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for Ksetiwatch API Version 2.6.1.
Documentation copyright © 2000-2003 Gordon Machel.
Generated on Fri Jun 6 00:28:53 2003 by doxygen 1.2.18, written by Dimitri van Heesch, © 1997-2002