Avogadro::QtGui::LayerModel#

class LayerModel : public QAbstractItemModel, public RWLayerManager#

UI for the layer dock.

Public Types

enum ColumnType#

Values:

enumerator Name#
enumerator Menu#
enumerator Visible#
enumerator Lock#
enumerator Remove#

Public Functions

explicit LayerModel(QObject *p = nullptr)#
void loadIcons(bool darkMode)#
QModelIndex parent(const QModelIndex &child) const override#
int rowCount(const QModelIndex &parent) const override#
int columnCount(const QModelIndex &parent) const override#
Qt::ItemFlags flags(const QModelIndex &index) const override#
bool setData(const QModelIndex &index, const QVariant &value, int role) override#
QVariant data(const QModelIndex &index, int role) const override#
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override#
void addItem()#
void addLayer(RWMolecule *rwmolecule)#
void addMolecule(const Molecule *mol)#
void setActiveLayer(int index, RWMolecule *rwmolecule)#
void removeItem(int row, RWMolecule *rwmolecule)#
size_t items() const#
void flipVisible(size_t row)#
void flipLocked(size_t row)#
size_t layerCount() const#
size_t layerForRow(int row) const#

Translate a Layers dock row — as this model lays them out: one header row per layer, followed by a row for each scene plugin enabled only in that layer, so a row and its layer id can diverge — to the layer id it belongs to.

Returns:

the layer id, or MaxIndex if row does not name a layer (negative, the synthetic “+” row, or past it).

bool layerVisible(size_t layer) const#
Returns:

whether layer is visible. Out-of-range is harmless: it reads back the same default a fresh layer starts with.

bool layerLocked(size_t layer) const#
Returns:

whether layer is locked. Out-of-range is harmless: it reads back the same default a fresh layer starts with.

void setLayerVisible(size_t layer, bool visible)#

Show or hide layer. A no-op if it already matches visible, or if layer is out of range.

void setLayerLocked(size_t layer, bool locked)#

Lock or unlock layer against edits. A no-op if it already matches locked, or if layer is out of range.

void setActiveLayerId(size_t layer, RWMolecule *rwmolecule)#

Make layer the active layer. A no-op if layer is out of range.

void removeLayerId(size_t layer, RWMolecule *rwmolecule)#

Remove layer. A no-op if layer is out of range.

Public Slots

void updateRows()#