Skip to main content

BinaryDatasetPreviewModel

BinaryDatasetPreviewModel

Lazy-loading table model for raw binary file preview. More…

#include <BinaryDatasetPreviewModel.hpp>

Inherits from QAbstractTableModel

Public Signals

Name
void loadError(QString const & message)
Emitted when file loading fails.
void fileLoaded(qint64 num_rows, int num_cols)
Emitted when file is successfully loaded.

Public Functions

Name
BinaryDatasetPreviewModel(QObject * parent =[nullptr])
~BinaryDatasetPreviewModel() override
bool loadFile(QString const & file_path, BinaryParseConfig const & config)
Load a binary file for preview with the given parse configuration.
bool reloadWithConfig(BinaryParseConfig const & config)
Reload the current file with a new parse configuration.
void clear()
Clear the current file.
bool hasData() const
Check if a file is currently loaded.
BinaryFileInfo const & fileInfo() const
Get the computed file information.
BinaryParseConfig const & parseConfig() const
Get the current parse configuration.
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 BinaryDatasetPreviewModel;

Lazy-loading table model for raw binary file preview.

This model presents binary file data in a table format based on user configuration (data type, channels, header offset, byte order).

When bitwise expansion is enabled, each element is expanded into individual bit columns, useful for interpreting digital event data from multi-channel acquisition devices.

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 file loading fails.

Parameters:

  • message Error message

signal fileLoaded

void fileLoaded(
    qint64 num_rows,
    int num_cols
)

Emitted when file is successfully loaded.

Parameters:

  • num_rows Number of rows in the view
  • num_cols Number of columns in the view

Public Functions Documentation

function BinaryDatasetPreviewModel

explicit BinaryDatasetPreviewModel(
    QObject * parent =nullptr
)

function ~BinaryDatasetPreviewModel

~BinaryDatasetPreviewModel() override

function loadFile

bool loadFile(
    QString const & file_path,
    BinaryParseConfig const & config
)

Load a binary file for preview with the given parse configuration.

Parameters:

  • file_path Path to the binary file
  • config Parse configuration

Return: true if file was loaded successfully

function reloadWithConfig

bool reloadWithConfig(
    BinaryParseConfig const & config
)

Reload the current file with a new parse configuration.

Parameters:

  • config New parse configuration

Return: true if reload was successful

function clear

void clear()

Clear the current file.

function hasData

inline bool hasData() const

Check if a file is currently loaded.

function fileInfo

inline BinaryFileInfo const & fileInfo() const

Get the computed file information.

function parseConfig

inline BinaryParseConfig const & parseConfig() const

Get the current parse configuration.

function chunkSize

inline int chunkSize() const

Get 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 override

function columnCount

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

function data

QVariant data(
    QModelIndex const & index,
    int role =Qt::DisplayRole
) const override

function headerData

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

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