libXpertMass Developer Documentation
  • libXpertMassGui
  • IsotopicDataTableViewModel
  • IsotopicDataTableViewModel Class

    class MsXpS::libXpertMassGui::IsotopicDataTableViewModel

    The IsotopicDataTableViewModel class provides a table view widget to display isotopic data. More...

    Header: #include <IsotopicDataTableViewModel.hpp>
    Inherits: QAbstractTableModel

    Public Functions

    IsotopicDataTableViewModel(QObject *parent_p, libXpertMass::IsotopicDataSPtr isotopic_data_sp)
    virtual ~IsotopicDataTableViewModel()
    bool clearAllData()
    void editCompleted(const QString &text)
    void insertIsotopeRowAbove()
    void insertIsotopeRowBelow()
    bool insertRow(int row, const QModelIndex &parent = QModelIndex())
    virtual const QWidget *parent() const
    void removeSelected()
    void setTableView(IsotopicDataTableView *table_view_p)
    IsotopicDataTableView *tableView()

    Reimplemented Public Functions

    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override
    virtual QVariant data(const QModelIndex &index = QModelIndex(), int role = Qt::DisplayRole) const override
    virtual Qt::ItemFlags flags(const QModelIndex &index) const override
    virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override
    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override
    virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override

    Protected Variables

    QWidget *mp_parent
    IsotopicDataTableView *mp_tableView
    libXpertMass::IsotopicDataSPtr msp_isotopicData

    Detailed Description

    Member Function Documentation

    IsotopicDataTableViewModel::IsotopicDataTableViewModel(QObject *parent_p, libXpertMass::IsotopicDataSPtr isotopic_data_sp)

    Constructs a IsotopicDataTableViewModel instance.

    [virtual noexcept] IsotopicDataTableViewModel::~IsotopicDataTableViewModel()

    Destructs this IsotopicDataTableViewModel instance.

    bool IsotopicDataTableViewModel::clearAllData()

    Removes all the rows from the table view.

    Returns true if rows were effectively removed, false otherwise.

    [override virtual] int IsotopicDataTableViewModel::columnCount(const QModelIndex &parent = QModelIndex()) const

    Reimplements: QAbstractItemModel::columnCount(const QModelIndex &parent) const.

    Returns the count of columns in this table view.

    parent is unused.

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

    Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.

    Returns the data for cell at index, for role.

    If role is Qt::TextAlignmentRole, returns (Qt::AlignRight | Qt::AlignVCenter).

    If role is Qt::DisplayRole, returns the text in the cell described in index in the form of a QVariant.

    See also setData().

    void IsotopicDataTableViewModel::editCompleted(const QString &text)

    Signals that the editing of a cell is completed with final text.

    [override virtual] Qt::ItemFlags IsotopicDataTableViewModel::flags(const QModelIndex &index) const

    Reimplements: QAbstractTableModel::flags(const QModelIndex &index) const.

    Returns the flags for the index.

    The returned flags include Qt::ItemIsEditable.

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

    Reimplements: QAbstractItemModel::headerData(int section, Qt::Orientation orientation, int role) const.

    Returns the header data for section.

    If orientation is Qt::Vertical returns the row number; if orientation is Qt::Horizontal, returns the text in the header. If role is not Qt::DisplayRole, returns QVariant().

    void IsotopicDataTableViewModel::insertIsotopeRowAbove()

    Inserts a new row above the current index.

    void IsotopicDataTableViewModel::insertIsotopeRowBelow()

    Inserts a new row below the current index.

    bool IsotopicDataTableViewModel::insertRow(int row, const QModelIndex &parent = QModelIndex())

    Returns true if the row could be inserted at reference model index parent.

    The insertion occurs at the index right before row such that the newly inserted row will be effectively at row index.

    The cells of the inserted row will be set with default values.

    [virtual] const QWidget *IsotopicDataTableViewModel::parent() const

    Returns the parent widget.

    void IsotopicDataTableViewModel::removeSelected()

    Removes all the selected rows.

    [override virtual] int IsotopicDataTableViewModel::rowCount(const QModelIndex &parent = QModelIndex()) const

    Reimplements: QAbstractItemModel::rowCount(const QModelIndex &parent) const.

    Returns the count of rows in this table view.

    parent is unused.

    [override virtual] bool IsotopicDataTableViewModel::setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole)

    Reimplements: QAbstractItemModel::setData(const QModelIndex &index, const QVariant &value, int role).

    Set the data to value for the cell described by index.

    If role is not Qt::EditRole, returns false. Returns true if value could be converted to the right type depending on the column of the cell, true otherwise.

    The data in the cell described by index is read, converted to the right type and set to the matching isotope instance. The row datum in index points to the index of the isotope in the isotopica data.

    If conversion from QVariant to the proper data type fails, returns false, otherwise returns true.

    See also data().

    void IsotopicDataTableViewModel::setTableView(IsotopicDataTableView *table_view_p)

    Sets the table view widget table_view_p.

    See also tableView().

    IsotopicDataTableView *IsotopicDataTableViewModel::tableView()

    Returns the table view widget.

    See also setTableView().

    Member Variable Documentation

    QWidget *IsotopicDataTableViewModel::mp_parent

    This variable holds the parent widget.

    IsotopicDataTableView *IsotopicDataTableViewModel::mp_tableView

    This variable holds the table view widget.

    libXpertMass::IsotopicDataSPtr IsotopicDataTableViewModel::msp_isotopicData

    This variable holds the isotopic data.