Skip to main content

TensorTableModel

TensorTableModel

#include <TensorTableModel.hpp>

Inherits from QAbstractTableModel

Public Functions

Name
TensorTableModel(QObject * parent =[nullptr])
void setTensorData(std::shared_ptr< TensorData > tensor_data)
Bind (or unbind) the model to a TensorData object.
void setRowDimension(int dim)
Set which tensor axis maps to table rows.
void setColumnDimension(int dim)
Set which tensor axis maps to table columns.
void setFixedIndex(int dim, std::size_t index)
Set the fixed slice index for a dimension that is neither row nor column.
int rowDimension() const
int columnDimension() const
std::size_t fixedIndex(int dim) const
std::size_t ndim() const
Number of dimensions of the bound tensor (0 if unbound).
std::vector< std::size_t > tensorShape() const
Shape of the bound tensor (empty if unbound).
std::vector< std::string > axisNames() const
Axis names of the bound tensor.
int rowCount(QModelIndex const & parent =QModelIndex()) const override
int columnCount(QModelIndex const & parent =QModelIndex()) const override
QVariant data(QModelIndex const & index, int role) const override
QVariant headerData(int section, Qt::Orientation orientation, int role) const override

Public Functions Documentation

function TensorTableModel

explicit TensorTableModel(
    QObject * parent =nullptr
)

function setTensorData

void setTensorData(
    std::shared_ptr< TensorData > tensor_data
)

Bind (or unbind) the model to a TensorData object.

Resets the model and auto-selects sensible row/column dimensions (row = 0, col = 1 if ndim >= 2).

function setRowDimension

void setRowDimension(
    int dim
)

Set which tensor axis maps to table rows.

Parameters:

function setColumnDimension

void setColumnDimension(
    int dim
)

Set which tensor axis maps to table columns.

Parameters:

  • dim Axis index (0-based), or -1 for “no column dimension” (single value column). Must be != rowDimension()

function setFixedIndex

void setFixedIndex(
    int dim,
    std::size_t index
)

Set the fixed slice index for a dimension that is neither row nor column.

Parameters:

  • dim Axis index
  • index Slice index (must be < axis size)

function rowDimension

inline int rowDimension() const

function columnDimension

inline int columnDimension() const

function fixedIndex

std::size_t fixedIndex(
    int dim
) const

function ndim

std::size_t ndim() const

Number of dimensions of the bound tensor (0 if unbound).

function tensorShape

std::vector< std::size_t > tensorShape() const

Shape of the bound tensor (empty if unbound).

function axisNames

std::vector< std::string > axisNames() const

Axis names of the bound tensor.

function rowCount

int rowCount(
    QModelIndex const & parent =QModelIndex()
) const override

function columnCount

int columnCount(
    QModelIndex const & parent =QModelIndex()
) const override

function data

QVariant data(
    QModelIndex const & index,
    int role
) const override

function headerData

QVariant headerData(
    int section,
    Qt::Orientation orientation,
    int role
) const override

Updated on 2026-11-13 at 20:25:39 +0000