Workspace 6.21.5
Public Types | Public Member Functions | Protected Types | Protected Slots | Protected Member Functions | List of all members
DisplayWidgetTree Class Reference

Top-level only abstract tree-based dialog box for displaying inputs and outputs with DisplayWidgets. More...

#include <Workspace/Presentation/displaywidgettree.h>

Inheritance diagram for DisplayWidgetTree:
[legend]

Public Types

enum  PortType { InputPort = 0 , OutputPort , InputElementPort }
 

Public Member Functions

 DisplayWidgetTree (int displayWidgetCol, int selectWidgetCol, DataExecution::Workspace &workspace, bool readOnly=false, QWidget *parent=nullptr)
 
bool isModified ()
 
void onLoadRows ()
 
bool registerItem (QTreeWidgetItem *item, DataExecution::IOBase *ioBase, PortType portType, bool readOnly=false)
 
void setMaxRowHeight (int maxRowHeight)
 
- Public Member Functions inherited from SortOnDemandTreeWidget
 SortOnDemandTreeWidget (QWidget *parent=nullptr)
 
int rowHeight (int row) const
 Returns the current height of the nominated row.
 
void setDragPixmap (const QPixmap &pixmap)
 Sets pixmap as the pixmap used to represent the data in a drag and drop operation.
 
void setNoEditColumnList (QList< int > noEditColumnList)
 A list of columns that should be read-only, others will be editable by default.
 
void setSortableColumnList (QList< int > sortableColumnList)
 a list of columns that should be sorted alphabetically when the user clicks on the column header
 
void setSortingOnDemandEnabled (bool value)
 
- Public Member Functions inherited from BasicTextLogger
 BasicTextLogger ()
 
virtual ~BasicTextLogger ()
 
void logLine (const Application::LogManager::MessageCategory &category, const QString &msg) const
 
void logLine (const QString &msg) const
 
void logText (const Application::LogManager::MessageCategory &category, const QString &msg) const
 
void logText (const QString &msg) const
 

Protected Types

enum  Role {
  PortTypeRole = Qt::UserRole , ReadOnlyRole , OperationIdRole , NameRole ,
  IndexRole
}
 

Protected Slots

void onItemMoved (int from, int to)
 
void onItemsMoved (QList< int > from, QList< int > to)
 
void setModified ()
 
- Protected Slots inherited from SortOnDemandTreeWidget
void customSortByColumn (int column)
 

Protected Member Functions

DataExecution::IOBasegetIOBase (QTreeWidgetItem *item)
 
void setDisplaySelectionWidget (QTreeWidgetItem *item)
 
void setDisplayWidget (QString widgetName, QTreeWidgetItem *item)
 
void setDisplayWidget (QTreeWidgetItem *item)
 
- Protected Member Functions inherited from SortOnDemandTreeWidget
void dragEnterEvent (QDragEnterEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
void startDrag (Qt::DropActions supportedActions) override
 

Additional Inherited Members

- Signals inherited from SortOnDemandTreeWidget
void itemMoved (int, int)
 
void itemsMoved (QList< int >, QList< int >)
 
void modified ()
 

Detailed Description

Member Enumeration Documentation

◆ PortType

enum PortType
Enumerator
InputPort 

Input*.

OutputPort 

Output*.

InputElementPort 

Member of an input array.

◆ Role

enum Role
protected
Enumerator
PortTypeRole 
ReadOnlyRole 
  • Input (other than array element) or Output
OperationIdRole 
  • Whether the user can change the widget value(s) or not
NameRole 
  • id of the operation the port is attached to
IndexRole 
  • id of the operation the port is attached to

Constructor & Destructor Documentation

◆ DisplayWidgetTree()

DisplayWidgetTree ( int  displayWidgetCol,
int  selectWidgetCol,
DataExecution::Workspace workspace,
bool  readOnly = false,
QWidget *  parent = nullptr 
)

Creates a dialog box populated by a top-level-only tree widgets with DisplayWidgets for the values of supplied inputs or outputs

The user is responsible for populating the tree header and rows. Each row should represent one IOBase item. Create a column for the DisplayWidgets. If you also want to display a QComboBox so that the user can choose from a selection of appropriate DisplayWidgets you should create a column for that too. If you just want to use the Preferred Display Widget for the IOBase, then set the SelectWidgetCol to -1.

Parameters
displayWidgetColindex of the column where you want the display widget
selectWidgetColindex of the column where you want the selection widget (-1 for none)
workspaceRoot Workspace
readOnlySet this to true if you want all the DisplayWidgets in the tree to be read-only
parentparent widget

Member Function Documentation

◆ getIOBase()

IOBase * getIOBase ( QTreeWidgetItem *  item)
protected

◆ isModified()

bool isModified ( )
inline

◆ onItemMoved

void onItemMoved ( int  from,
int  to 
)
protectedslot

Notification that a row was dragged from one row to another

If multiple selections are allowed, this will return just the first selection member

Parameters
fromrow the item was moved from
torow the item was moved to

◆ onItemsMoved

void onItemsMoved ( QList< int >  from,
QList< int >  to 
)
protectedslot

Notification that some rows were dragged from one row to another

Parameters
fromrows the items were moved from
torows the items were moved to

◆ onLoadRows()

void onLoadRows ( )

◆ registerItem()

bool registerItem ( QTreeWidgetItem *  item,
DataExecution::IOBase ioBaseData,
PortType  portType,
bool  readOnly = false 
)

Tells the system to associate this QTreeWidgetItem with the supplied IOBase port

Call this once for each ioBase you want handled (one ioBase should be registered for each tree widget item) The system requires the data inside the DisplayWidget column reserved for internal use

Parameters
itemThe top-level tree item you want to display a DisplayWidget on
ioBaseDataThe Input or Output whose data it represents
portTypeThe port type that ioBaseData belongs to
readOnlySet this to true if you want this item in particular to be read-only
Returns
false if the item is not a current top-level item of the treewidget, or if the DisplayWidget column supplied is not a current column of the treewidget

◆ setDisplaySelectionWidget()

void setDisplaySelectionWidget ( QTreeWidgetItem *  item)
protected

Creates and inserts a QComboBox containing a choice of suitable Display Widgets

The QComboBox is created and inserted into the columns identified by selectWidgetCol_ A widget of the chosen type is then created and inserted into the column identified by displayWidgetCol_

◆ setDisplayWidget() [1/2]

void setDisplayWidget ( QString  widgetName,
QTreeWidgetItem *  item 
)
protected

Handles creation of the display widget to be put into the QTreeWidget

Parameters
widgetNameName of the widget to be used rather than the current PreferredWidget (which it will overwrite).
itemThe item where the display widget will be embedded into.

◆ setDisplayWidget() [2/2]

void setDisplayWidget ( QTreeWidgetItem *  item)
protected

Handles creation of the display widget to be put into the QTreeWidget. Uses the current Input or Output's PreferredWidget

Parameters
itemTree widget item which will have a new display widget embedded into.

◆ setMaxRowHeight()

void setMaxRowHeight ( int  maxRowHeight)

Set the maximum height allowed for a DisplayWidget inside a row before it is replaced by a wrapper button

◆ setModified

void setModified ( )
protectedslot