HDF5DatasetPreviewModel
HDF5DatasetPreviewModel
Lazy-loading table model for HDF5 dataset preview. More…
#include <HDF5DatasetPreviewModel.hpp>
Inherits from QAbstractTableModel
Public Signals
| Name | |
|---|---|
| void | loadError(QString const & message) Emitted when dataset loading fails. |
| void | datasetLoaded(qint64 num_rows, int num_cols) Emitted when dataset is successfully loaded. |
Public Functions
| Name | |
|---|---|
| HDF5DatasetPreviewModel(QObject * parent =[nullptr]) Construct the preview model. |
|
| ~HDF5DatasetPreviewModel() override | |
| bool | loadDataset(QString const & file_path, QString const & dataset_path) Load a dataset from an HDF5 file for preview. |
| void | clear() Clear the current dataset. |
| bool | hasDataset() const Check if a dataset is currently loaded. |
| qint64 | totalElements() const Get the total number of elements in the dataset. |
| int | chunkSize() const Get the chunk size used for lazy loading. |
| void | setChunkSize(int size) Set the chunk size for lazy loading. |
| int | rowCount(QModelIndex const & parent =QModelIndex()) const override |
| int | columnCount(QModelIndex const & parent =QModelIndex()) const override |
| QVariant | data(QModelIndex const & index, int role =Qt::DisplayRole) const override |
| QVariant | headerData(int section, Qt::Orientation orientation, int role =Qt::DisplayRole) const override |
Detailed Description
class HDF5DatasetPreviewModel;Lazy-loading table model for HDF5 dataset preview.
This model presents HDF5 dataset data in a table format:
- 1D datasets: Single column with index as row
- 2D datasets: Rows and columns map directly
- ND datasets: Flattened view with multi-dimensional index shown
Data is loaded in chunks (default 100 rows) and cached using QCache to provide smooth scrolling while minimizing memory usage.
Public Signals Documentation
signal loadError
void loadError(
QString const & message
)Emitted when dataset loading fails.
Parameters:
- message Error message
signal datasetLoaded
void datasetLoaded(
qint64 num_rows,
int num_cols
)Emitted when dataset is successfully loaded.
Parameters:
- num_rows Number of rows in the view
- num_cols Number of columns in the view
Public Functions Documentation
function HDF5DatasetPreviewModel
explicit HDF5DatasetPreviewModel(
QObject * parent =nullptr
)Construct the preview model.
Parameters:
- parent Parent object
function ~HDF5DatasetPreviewModel
~HDF5DatasetPreviewModel() overridefunction loadDataset
bool loadDataset(
QString const & file_path,
QString const & dataset_path
)Load a dataset from an HDF5 file for preview.
Parameters:
- file_path Path to the HDF5 file
- dataset_path Path to the dataset within the file
Return: true if dataset was loaded successfully
function clear
void clear()Clear the current dataset.
function hasDataset
inline bool hasDataset() constCheck if a dataset is currently loaded.
function totalElements
inline qint64 totalElements() constGet the total number of elements in the dataset.
function chunkSize
inline int chunkSize() constGet the chunk size used for lazy loading.
function setChunkSize
void setChunkSize(
int size
)Set the chunk size for lazy loading.
Parameters:
- size Number of rows to load at once (minimum 10)
function rowCount
int rowCount(
QModelIndex const & parent =QModelIndex()
) const overridefunction columnCount
int columnCount(
QModelIndex const & parent =QModelIndex()
) const overridefunction data
QVariant data(
QModelIndex const & index,
int role =Qt::DisplayRole
) const overridefunction headerData
QVariant headerData(
int section,
Qt::Orientation orientation,
int role =Qt::DisplayRole
) const overrideUpdated on 2026-11-13 at 20:25:40 +0000