MeVisLab Scripting Reference
|
#include <mlabListViewControl.h>
Inherits MLABSimpleWidgetControl.
Public Types | |
enum | Alignment |
enum | EditorFlags |
Public Slots | |
Scripting access. | |
| |
MLABListViewItem * | itemForId (int id) |
QList< MLABListViewItem * > | topLevelItems () const |
MLABListViewItem * | firstItem () const |
MLABListViewItem * | firstChild () const |
MLABListViewItem * | lastItem () const |
void | ensureItemVisible (MLABListViewItem *item, bool positionAtCenter=false) |
MLABListViewItem * | selectedItem () const |
QList< MLABListViewItem * > | selectedItems () const |
void | resizeColumnsToContents () |
void | setSelected (MLABListViewItem *item, bool selected) |
bool | isSelected (MLABListViewItem *item) |
void | setAlternatingRowColors (bool enable) |
QVariantList | selectedItemIds () |
QVariantList | checkedItemIds () |
QList< MLABListViewItem * > | checkedItems () |
void | clearSelection () |
MLABListViewItem * | currentItem () 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) |
MLABListViewItem * | appendItem (const QStringList &texts=QStringList()) |
MLABListViewItem * | appendItem (MLABListViewItem *parent, const QStringList &texts=QStringList()) |
MLABListViewItem * | insertItem () |
MLABListViewItem * | insertItem (MLABListViewItem *after) |
MLABListViewItem * | insertItem (const QStringList &texts) |
MLABListViewItem * | insertItem (MLABListViewItem *after, const QStringList &texts) |
MLABListViewItem * | insertItem (MLABListViewItem *parent, MLABListViewItem *after) |
MLABListViewItem * | insertItem (MLABListViewItem *parent, MLABListViewItem *after, const QStringList &texts) |
MLABListViewItem * | insertCheckBoxItem () |
MLABListViewItem * | insertRadioControllerItem () |
MLABListViewItem * | insertRadioItem (MLABListViewItem *after) |
MLABListViewItem * | insertCheckBoxItem (MLABListViewItem *after) |
MLABListViewItem * | insertRadioControllerItem (MLABListViewItem *after) |
MLABListViewItem * | insertRadioItem (MLABListViewItem *parent, MLABListViewItem *after) |
MLABListViewItem * | insertCheckBoxItem (MLABListViewItem *parent, MLABListViewItem *after) |
MLABListViewItem * | insertRadioControllerItem (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 () |
void | setSizeHint (const QSize &size) override |
void | beginInsertItems (int itemCount) |
void | beginInsertItems (MLABListViewItem *parent, int itemCount) |
void | endInsertItems () |
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 scaleToLowRes=false) |
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 () |
MLABWidgetControl * | control (const QString &name) |
float | scaleFactor () |
MLABModule * | module () |
QString | getType () |
QString | getName () |
bool | acceptDrops () |
void | setAcceptDrops (bool flag) |
void | raiseWidget () |
void | setStyleSheetFromString (const QString &styleSheetText) |
void | setStyleSheetFromFile (const QString &styleSheetFileName) |
MLABTree * | tree () |
void | updateMaxSize () |
bool | expandX () |
bool | expandY () |
MLABTreePtr | getDefaultTagValues () const |
virtual bool | hasUncommittedChanges () const |
virtual void | applyUncommittedChanges () |
virtual void | revertUncommittedChanges () |
MLABField * | field () const |
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.
If the list view is filtered or sorted, then beginInsertItems() and endInsertItems() should be called before and after adding or inserting items. If they are not called, the filtering and sorting will not be immediately applied to the new items.
For more details see the Qt documentation of QAbstractItemModel::beginInsertRows().
Here is an example:
These flags can be used with setColumnAlignment().
These flags can be used with setStringEditorValues().
|
slot |
Adds a column.
|
slot |
Appends a new top level item to the end of the list.
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
slot |
Appends a new child item to the given parent. It is put to the end of the children list.
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
inlineslot |
Call this before items have are appended or inserted (see Inserting and Adding Items).
References beginInsertItems().
Referenced by beginInsertItems().
|
slot |
Call this before items have are appended or inserted to the given parent item (see Inserting and Adding Items).
|
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().
|
slot |
Returns a list with all checked items.
|
slot |
Clears all items.
|
slot |
Clears the current selection.
|
slot |
Returns the number of columns currently defined.
|
slot |
Returns the text for given column.
|
slot |
Returns the current item (in single selection mode, current item and selected item are the same).
|
slot |
Call this after items have been appended or inserted (see Inserting and Adding Items).
|
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.
|
slot |
Returns the first child in the list view (the logical first item, not the one by the sorting order).
|
slot |
Returns the first child in the list view (the logical first item, not the one by the sorting order).
|
slot |
Makes a column invisible, e.g. for sorting purposes.
|
slot |
Inserts a check box item as first list item.
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
slot |
Inserts a check box item after given item (or as first item if after is NULL).
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
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!
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
slot |
Inserts a new item at the beginning of the list.
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
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.
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
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.
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
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.
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
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.
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
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!
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
slot |
Inserts a radio controller as first list item.
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
slot |
Inserts a radio controller item after given item (or as first item if after is NULL).
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
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!
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
slot |
Inserts a check box item after given item.
Must be put into a radio controller to work.
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
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.
If filtering or sorting is enabled, then beginInsertItems() and endInsertItems() should be called (see Inserting and Adding Items).
|
slot |
Returns whether a column is hidden.
|
slot |
Returns whether the item is selected.
|
slot |
Returns whether the current sort order is ascending, undefined if sortColumn is -1.
|
slot |
Returns the item for given integer id (id can be get from an item with the id() method).
|
slot |
Returns the last child in the list view (expensive, because it needs to search the whole list!).
|
slot |
Removes a column.
|
slot |
Clears all columns.
|
slot |
Removes the given item (being a normal item or child item) and all its children if any.
|
slot |
Resizes all columns to their contents.
|
slot |
Returns the selected item (in single selection mode this is identical with currentItem(), otherwise always NULL).
|
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:
|
slot |
Returns a list of the selected items.
|
inlineslot |
Enables/disables display of alternating row colors.
The alternative row color needs to be set in the style (the color's name in CSS is 'alternateBase').
|
slot |
Sets the alignment of the given column, possible values are AlignLeft, AlignRight or AlignHCenter (defined on the control itself).
|
slot |
Sets the column pixmap for this file.
|
slot |
Sets the text for given column.
|
slot |
Sets a fixed column width for given column.
-1 means always resize to content, -2 means resize to content now, but allow interactive resizing (default)
|
slot |
Sets the current item.
|
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 Qt5: http://doc.qt.io/qt-5/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.
|
slot |
Sets whether root is decorated (for tree views).
|
slot |
Selects an item.
|
overrideslot |
Sets the size hint.
|
slot |
Sets the sorting column to use, -1 means no sorting.
|
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).
|
slot |
Shows column again.
|
slot |
Returns the current sort column, -1 if not sorted by column.
|
slot |
Returns a list of the top level items of the view, in logical order.
|
slot |
Unsets a filter previously set with setItemFilter.