Workspace 6.21.5
Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
SortOnDemandTreeWidget Class Reference

Tree widget that supports sorting by clicking on a column header as well as dragging items from row to row. More...

#include <Workspace/Presentation/sortondemandtreewidget.h>

Inheritance diagram for SortOnDemandTreeWidget:
[legend]

Signals

void itemMoved (int, int)
 
void itemsMoved (QList< int >, QList< int >)
 
void modified ()
 

Public Member Functions

 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)
 

Protected Slots

void customSortByColumn (int column)
 

Protected Member Functions

void dragEnterEvent (QDragEnterEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
void startDrag (Qt::DropActions supportedActions) override
 

Detailed Description

Drag drop support is limited to passsing data types supported by the tree-widget default handlers. To pass pointers as user data, use reinterpret_cast to pass them as uLongLong, for example:

Data* dataPtr = getData();
item->setData(Column::Name, Qt::UserRole, QVariant::fromValue(reinterpret_cast<uintptr_t>(dataPtr)));
Data* restoredData = reinterpret_cast<Data*>(item->data(Column::Name, Qt::UserRole).toULongLong());
static Value getData(const QMap< const QtProperty *, PrivateData > &propertyMap, Value PrivateData::*data, const QtProperty *property, const Value &defaultValue=Value())
Definition: qtpropertymanager.cpp:285

Constructor & Destructor Documentation

◆ SortOnDemandTreeWidget()

SortOnDemandTreeWidget ( QWidget *  parent = nullptr)

Member Function Documentation

◆ customSortByColumn

void customSortByColumn ( int  column)
protectedslot

Sorts the data alphabetically by the text in the given row.

Returns without sorting if the column is not in sortableColumnList_ **

◆ dragEnterEvent()

void dragEnterEvent ( QDragEnterEvent *  event)
overrideprotected

◆ dropEvent()

void dropEvent ( QDropEvent *  event)
overrideprotected

◆ itemMoved

void itemMoved ( int  ,
int   
)
signal

◆ itemsMoved

void itemsMoved ( QList< int >  ,
QList< int >   
)
signal

◆ modified

void modified ( )
signal

◆ rowHeight()

int rowHeight ( int  row) const

◆ setDragPixmap()

void setDragPixmap ( const QPixmap &  pixmap)

◆ setNoEditColumnList()

void setNoEditColumnList ( QList< int >  noEditColumnList)

◆ setSortableColumnList()

void setSortableColumnList ( QList< int >  sortableColumnList)

◆ setSortingOnDemandEnabled()

void setSortingOnDemandEnabled ( bool  value)

Enables sorting by clicking on the column header Initially false. Set this to true once the tree has been populated. If this is true during the widget creation process then the the list will be sorted automatically before the user has a chance to look at it **

◆ startDrag()

void startDrag ( Qt::DropActions  supportedActions)
overrideprotected