SHAPER  9.12.0
ModuleBase_ListView Class Reference

An extension of QListWidget to provide Undo/Redo functionality. More...

Inheritance diagram for ModuleBase_ListView:
Inheritance graph

Signals

void deleteActionClicked ()
 Signal about delete action click. More...
 
void listActivated ()
 

Public Member Functions

 ModuleBase_ListView (QWidget *theParent=0, const QString &theObjectName=QString(), const QString &theToolTip=QString())
 Constructor. More...
 
virtual ~ModuleBase_ListView ()
 Destructor. More...
 
QListWidgetgetControl () const
 Returns current control. More...
 
void addItem (const QString &theTextValue, const int theIndex)
 Adds a new list widget item to the end of the list and connect it to the given index. More...
 
bool hasItem (const QString &theTextValue) const
 Returns True if the control already contains an item with the given text. More...
 
void getSelectedIndices (std::set< int > &theIndices)
 Returns list of internal list view item indices. More...
 
void selectIndices (const std::set< int > &theIndices)
 Selects items with indices. More...
 
void removeSelectedItems ()
 Removes selected items from the list widget. More...
 
void removeItems (std::set< int > &theIndices)
 Remove items contain parameter indices. More...
 
void restoreSelection (const QModelIndexList &theIndices)
 Set selected items if possible. More...
 
void updateActionsStatus ()
 Update enable/disable state of context menu actions. More...
 

Protected Slots

void onCopyItem ()
 Slot for copy command in a list pop-up menu. More...
 
void onListSelection ()
 Slot is called on selection of list of selected items. More...
 

Protected Attributes

QListWidgetmyListControl
 List control. More...
 
QAction * myCopyAction
 A copy action for pop-up menu in a list control. More...
 
QAction * myDeleteAction
 A delete action for pop-up menu in a list control. More...
 

Detailed Description

An extension of QListWidget to provide Undo/Redo functionality.

Constructor & Destructor Documentation

◆ ModuleBase_ListView()

ModuleBase_ListView::ModuleBase_ListView ( QWidget theParent = 0,
const QString &  theObjectName = QString(),
const QString &  theToolTip = QString() 
)

Constructor.

◆ ~ModuleBase_ListView()

virtual ModuleBase_ListView::~ModuleBase_ListView ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ getControl()

QListWidget* ModuleBase_ListView::getControl ( ) const
inline

Returns current control.

Returns
list view instance

◆ addItem()

void ModuleBase_ListView::addItem ( const QString &  theTextValue,
const int  theIndex 
)

Adds a new list widget item to the end of the list and connect it to the given index.

Parameters
theTextValuevalue visualized in the view
theIndexan item internal index

◆ hasItem()

bool ModuleBase_ListView::hasItem ( const QString &  theTextValue) const

Returns True if the control already contains an item with the given text.

Parameters
theTextValuetex of item to find

◆ getSelectedIndices()

void ModuleBase_ListView::getSelectedIndices ( std::set< int > &  theIndices)

Returns list of internal list view item indices.

Parameters
theIndicesan output container for indices

◆ selectIndices()

void ModuleBase_ListView::selectIndices ( const std::set< int > &  theIndices)

Selects items with indices.

Parameters
theIndicesindices

◆ removeSelectedItems()

void ModuleBase_ListView::removeSelectedItems ( )

Removes selected items from the list widget.

◆ removeItems()

void ModuleBase_ListView::removeItems ( std::set< int > &  theIndices)

Remove items contain parameter indices.

Parameters
theIndicesan indices

◆ restoreSelection()

void ModuleBase_ListView::restoreSelection ( const QModelIndexList &  theIndices)

Set selected items if possible.

Parameters
theIndicescontainer of indices to be selected

◆ updateActionsStatus()

void ModuleBase_ListView::updateActionsStatus ( )

Update enable/disable state of context menu actions.

◆ onCopyItem

void ModuleBase_ListView::onCopyItem ( )
protectedslot

Slot for copy command in a list pop-up menu.

◆ onListSelection

void ModuleBase_ListView::onListSelection ( )
protectedslot

Slot is called on selection of list of selected items.

◆ deleteActionClicked

void ModuleBase_ListView::deleteActionClicked ( )
signal

Signal about delete action click.

Field Documentation

◆ myListControl

QListWidget* ModuleBase_ListView::myListControl
protected

List control.

◆ myCopyAction

QAction* ModuleBase_ListView::myCopyAction
protected

A copy action for pop-up menu in a list control.

◆ myDeleteAction

QAction* ModuleBase_ListView::myDeleteAction
protected

A delete action for pop-up menu in a list control.