MeVisLab Scripting Reference
MLABListViewControl Class Reference

Inherits MLABSimpleWidgetControl.

Public Types

enum  Alignment
 
enum  EditorFlags
 

Public Slots

Scripting access.
MLABListViewItemitemForId (int id)
 
QList< MLABListViewItem * > topLevelItems () const
 
MLABListViewItemfirstItem () const
 
MLABListViewItemfirstChild () const
 
MLABListViewItemlastItem () const
 
void ensureItemVisible (MLABListViewItem *item, bool positionAtCenter=false)
 
MLABListViewItemselectedItem () const
 
QList< MLABListViewItem * > selectedItems () const
 
void resizeColumnsToContents ()
 
void setSelected (MLABListViewItem *item, bool selected)
 
bool isSelected (MLABListViewItem *item)
 
QVariantList selectedItemIds ()
 
QVariantList checkedItemIds ()
 
QList< MLABListViewItem * > checkedItems ()
 
void clearSelection ()
 
MLABListViewItemcurrentItem () const
 
void setCurrentItem (MLABListViewItem *item)
 
void setColumnAlignment (int column, Alignment alignment)
 
void setColumnWidth (int column, int w)
 
void setColumnPixmapFile (int column, const QString &file)
 
void setColumnText (int column, const QString &text)
 
QString columnText (int column)
 
void setSorting (int column, bool ascending)
 
int sortColumn () const
 
bool isSortOrderAscending () const
 
void addColumn (const QString &label)
 
void removeColumn (int idx)
 
int columnCount ()
 
void hideColumn (int column)
 
void showColumn (int column)
 
bool isColumnHidden (int column)
 
void removeColumns ()
 
void clearItems ()
 
void removeItem (MLABListViewItem *item)
 
MLABListViewItemappendItem (const QStringList &texts=QStringList())
 
MLABListViewItemappendItem (MLABListViewItem *parent, const QStringList &texts=QStringList())
 
MLABListViewIteminsertItem ()
 
MLABListViewIteminsertItem (MLABListViewItem *after)
 
MLABListViewIteminsertItem (const QStringList &texts)
 
MLABListViewIteminsertItem (MLABListViewItem *after, const QStringList &texts)
 
MLABListViewIteminsertItem (MLABListViewItem *parent, MLABListViewItem *after)
 
MLABListViewIteminsertItem (MLABListViewItem *parent, MLABListViewItem *after, const QStringList &texts)
 
MLABListViewIteminsertCheckBoxItem ()
 
MLABListViewIteminsertRadioControllerItem ()
 
MLABListViewIteminsertRadioItem (MLABListViewItem *after)
 
MLABListViewIteminsertCheckBoxItem (MLABListViewItem *after)
 
MLABListViewIteminsertRadioControllerItem (MLABListViewItem *after)
 
MLABListViewIteminsertRadioItem (MLABListViewItem *parent, MLABListViewItem *after)
 
MLABListViewIteminsertCheckBoxItem (MLABListViewItem *parent, MLABListViewItem *after)
 
MLABListViewIteminsertRadioControllerItem (MLABListViewItem *parent, MLABListViewItem *after)
 
void setRootIsDecorated (bool flag)
 
void setStringEditorValues (const QStringList &values, int flags=0)
 
void setItemFilter (int column, const QString &pattern, bool caseSensitive=true, bool keepParents=false)
 
void unsetItemFilter ()
 
virtual void setSizeHint (const QSize &size)
 
- Public Slots inherited from MLABWidgetControl
void adjustSize ()
 
virtual void setEnabled (bool flag)
 
virtual void setVisible (bool flag)
 
virtual bool isVisible ()
 
virtual void setFocus ()
 
virtual bool hasFocus ()
 
virtual void setToolTip (const QString &string)
 
virtual void setWhatsThis (const QString &string)
 
void displayWhatsThis ()
 
void displayWhatsThis (const QString &text)
 
virtual void setTitle (const QString &)
 
QWidget * widget ()
 
QLayout * layout ()
 
virtual QString windowHandle ()
 
virtual bool createScreenshot (const QString &filename, bool grabFromScreen=true)
 
bool isReloadable () const
 
void reload (MLABTree *tree)
 
QString createGlobalScreenshot ()
 
QString applicationName ()
 
QSize size ()
 
int width ()
 
int height ()
 
int minWidth ()
 
int minHeight ()
 
int maxWidth ()
 
int maxHeight ()
 
virtual void setMinWidth (int s)
 
virtual void setMinHeight (int s)
 
void setMaxWidth (int s)
 
void setMaxHeight (int s)
 
QSize sizeHint ()
 
QSize minSize ()
 
QSize maxSize ()
 
void setMinSize (QSize size)
 
void setMaxSize (QSize size)
 
void updateLayout ()
 
int windowID ()
 
MLABWidgetControlcontrol (const QString &name)
 
float scaleFactor ()
 
MLABModulemodule ()
 
QString getType ()
 
QString getName ()
 
bool acceptDrops ()
 
void setAcceptDrops (bool flag)
 
void raiseWidget ()
 
void setStyleSheetFromString (const QString &styleSheetText)
 
void setStyleSheetFromFile (const QString &styleSheetFileName)
 
MLABTreetree ()
 
void updateMaxSize ()
 
bool expandX ()
 
bool expandY ()
 
MLABTreePtr getDefaultTagValues () const
 
virtual bool hasUncommittedChanges () const
 
virtual void applyUncommittedChanges ()
 
virtual void revertUncommittedChanges ()
 

Detailed Description

ListView control.

Control for showing a ListView. It can be controlled and filled with content via a field or the values tag. If the items are filled via a given field or the value tag, the item ids are guaranteed to be numbered starting from 0 (without the header column).

ListView can also be controlled manually by using Scripting. It offers creation of any number of columns and creating/removing items on the fly. It also allows to create a tree view in the first column by using insertChildItem().

The interface to access content of individual items is given in MLABListViewItem.

Member Function Documentation

void MLABListViewControl::addColumn ( const QString &  label)
slot

Adds a column.

MLABListViewItem* MLABListViewControl::appendItem ( const QStringList &  texts = QStringList())
slot

Appends a new top level item to the end of the list.

MLABListViewItem* MLABListViewControl::appendItem ( MLABListViewItem parent,
const QStringList &  texts = QStringList() 
)
slot

Appends a new child item to the given parent. It is put to the end of the children list.

QVariantList MLABListViewControl::checkedItemIds ( )
slot

You should prefer using checkedItems() instead of this method.

Returns the list of checked items ids. The individual items can then be retrieved via itemForId().

QList<MLABListViewItem*> MLABListViewControl::checkedItems ( )
slot

Returns a list with all checked items.

void MLABListViewControl::clearItems ( )
slot

Clears all items.

void MLABListViewControl::clearSelection ( )
slot

Clears the current selection.

int MLABListViewControl::columnCount ( )
slot

Returns the number of columns currently defined.

QString MLABListViewControl::columnText ( int  column)
slot

Returns the text for given column.

MLABListViewItem* MLABListViewControl::currentItem ( ) const
slot

Returns the current item (in single selection mode, current item and selected item are the same).

void MLABListViewControl::ensureItemVisible ( MLABListViewItem item,
bool  positionAtCenter = false 
)
slot

Makes sure that the item is visible.

If positionAtCenter is true, the item will be centered in the ListView, otherwise it will possibly just be visible.

MLABListViewItem* MLABListViewControl::firstChild ( ) const
slot

Returns the first child in the list view (the logical first item, not the one by the sorting order).

MLABListViewItem* MLABListViewControl::firstItem ( ) const
slot

Returns the first child in the list view (the logical first item, not the one by the sorting order).

void MLABListViewControl::hideColumn ( int  column)
slot

Makes a column invisible, e.g. for sorting purposes.

MLABListViewItem* MLABListViewControl::insertCheckBoxItem ( )
slot

Inserts a check box item as first list item.

MLABListViewItem* MLABListViewControl::insertCheckBoxItem ( MLABListViewItem after)
slot

Inserts a check box item after given item (or as first item if after is NULL).

MLABListViewItem* MLABListViewControl::insertCheckBoxItem ( MLABListViewItem parent,
MLABListViewItem after 
)
slot

Inserts a check box item behind the after item of parent (if after is NULL, item is first in list).

Make sure that after is a child of parent, otherwise an error occurs!

MLABListViewItem* MLABListViewControl::insertItem ( )
slot

Inserts a new item at the beginning of the list.

MLABListViewItem* MLABListViewControl::insertItem ( MLABListViewItem after)
slot

Inserts a new item after the given item (if after is NULL, the new item is the first in the list).

If after has a parent item, the new item is also a child item of that parent.

MLABListViewItem* MLABListViewControl::insertItem ( const QStringList &  texts)
slot

Creates a new item with given texts at the beginning of the list.

If you want to add non-string items, you can call insertItem().setValues(...) instead.

MLABListViewItem* MLABListViewControl::insertItem ( MLABListViewItem after,
const QStringList &  texts 
)
slot

Creates a new item with given texts after the given item (if after is NULL, the new item is the first in the list).

If after has a parent item, the new item is also a child item of that parent. If you want to add non-string items, you can call insertItem(after).setValues(...) instead.

MLABListViewItem* MLABListViewControl::insertItem ( MLABListViewItem parent,
MLABListViewItem after 
)
slot

Inserts a new child item after given item (or as first child if after is NULL).

Make sure that after is a child of parent, otherwise an error occurs.

MLABListViewItem* MLABListViewControl::insertItem ( MLABListViewItem parent,
MLABListViewItem after,
const QStringList &  texts 
)
slot

Inserts a new child item after given item (or as first child if after is NULL), with given texts.

Make sure that after is a child of parent, otherwise an error occurs!

MLABListViewItem* MLABListViewControl::insertRadioControllerItem ( )
slot

Inserts a radio controller as first list item.

MLABListViewItem* MLABListViewControl::insertRadioControllerItem ( MLABListViewItem after)
slot

Inserts a radio controller item after given item (or as first item if after is NULL).

MLABListViewItem* MLABListViewControl::insertRadioControllerItem ( MLABListViewItem parent,
MLABListViewItem after 
)
slot

Inserts a radio controller item behind the after item of parent (if after is NULL, item is first in list).

make sure that after is a child of parent, otherwise an error occurs!

MLABListViewItem* MLABListViewControl::insertRadioItem ( MLABListViewItem after)
slot

Inserts a check box item after given item.

Must be put into a radio controller to work.

MLABListViewItem* MLABListViewControl::insertRadioItem ( MLABListViewItem parent,
MLABListViewItem after 
)
slot

Inserts a radio item behind the after item of parent (if after is NULL, item is first in list).

Make sure that after is a child of parent, otherwise an error occurs.

bool MLABListViewControl::isColumnHidden ( int  column)
slot

Returns whether a column is hidden.

bool MLABListViewControl::isSelected ( MLABListViewItem item)
slot

Returns whether the item is selected.

bool MLABListViewControl::isSortOrderAscending ( ) const
slot

Returns whether the current sort order is ascending, undefined if sortColumn is -1.

MLABListViewItem* MLABListViewControl::itemForId ( int  id)
slot

Returns the item for given integer id (id can be get from an item with the id() method).

MLABListViewItem* MLABListViewControl::lastItem ( ) const
slot

Returns the last child in the list view (expensive, because it needs to search the whole list!).

void MLABListViewControl::removeColumn ( int  idx)
slot

Removes a column.

void MLABListViewControl::removeColumns ( )
slot

Clears all columns.

void MLABListViewControl::removeItem ( MLABListViewItem item)
slot

Removes the given item (being a normal item or child item) and all its children if any.

void MLABListViewControl::resizeColumnsToContents ( )
slot

Resizes all columns to their contents.

MLABListViewItem* MLABListViewControl::selectedItem ( ) const
slot

Returns the selected item (in single selection mode this is identical with currentItem(), otherwise always NULL).

QVariantList MLABListViewControl::selectedItemIds ( )
slot

You should prefer using selectedItems() instead of this method.

Returns the list of selected items ids (especially useful for multiple selection). The individual items can then be retrieved via itemForId().

Example:

ids = list.selectedItemIds()
for id in ids:
item = list.itemForId(id)
QList<MLABListViewItem*> MLABListViewControl::selectedItems ( ) const
slot

Returns a list of the selected items.

void MLABListViewControl::setColumnAlignment ( int  column,
Alignment  alignment 
)
slot

Sets the alignment of the given column, possible values are AlignLeft, AlignRight or AlignHCenter (defined on the control itself).

void MLABListViewControl::setColumnPixmapFile ( int  column,
const QString &  file 
)
slot

Sets the column pixmap for this file.

void MLABListViewControl::setColumnText ( int  column,
const QString &  text 
)
slot

Sets the text for given column.

void MLABListViewControl::setColumnWidth ( int  column,
int  w 
)
slot

Sets the column width for given column.

void MLABListViewControl::setCurrentItem ( MLABListViewItem item)
slot

Sets the current item.

void MLABListViewControl::setItemFilter ( int  column,
const QString &  pattern,
bool  caseSensitive = true,
bool  keepParents = false 
)
slot

Sets a filter for a special column (0..n) or all columns (-1): Only show items with a string value that matches the regular expression given by pattern.

The regular expression syntax is the default pattern syntax of Qt4: http://doc.trolltech.com/4.6/qregexp.html. Operations like selecting items or making items visible/invisible will have no effect on items that are filtered away. The original item hierarchy that is accessed with parent(), firstChild(), nextSibling() and childCount() is not affected by filtering. Each call to setItemFilter will replace the previous filter. If keepParents is set, all parents of items that would make it through the filter also get through the filter, i.e. they are visible. But this may be an expensive recursive operation, especially for deeply nested trees, so handle with care.

void MLABListViewControl::setRootIsDecorated ( bool  flag)
slot

Sets whether root is decorated (for tree views).

void MLABListViewControl::setSelected ( MLABListViewItem item,
bool  selected 
)
slot

Selects an item.

virtual void MLABListViewControl::setSizeHint ( const QSize &  size)
virtualslot

Sets the size hint.

void MLABListViewControl::setSorting ( int  column,
bool  ascending 
)
slot

Sets the sorting column to use, -1 means no sorting.

void MLABListViewControl::setStringEditorValues ( const QStringList &  values,
int  flags = 0 
)
slot

Sets combo box values to use when editing string values - if the value list is empty, the normal line edit is used for editing.

This is only relevant for string values, not e.g. for numerical values which have their own editor. The flags parameter can be a combination (bit-ored) of the values EditorEditable and EditorCaseSensitive, which are defined on this control: EditorEditable defines whether the user can enter his/her own values (default is not editable), EditorCaseSensitive makes the automatic string completion case sensitive (default is case insensitive).

void MLABListViewControl::showColumn ( int  column)
slot

Shows column again.

int MLABListViewControl::sortColumn ( ) const
slot

Returns the current sort column, -1 if not sorted by column.

QList<MLABListViewItem*> MLABListViewControl::topLevelItems ( ) const
slot

Returns a list of the top level items of the view, in logical order.

void MLABListViewControl::unsetItemFilter ( )
slot

Unsets a filter previously set with setItemFilter.