SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Classes | Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
smtk::extension::qtDescriptivePhraseModel Class Reference

Adapt an smtk::view::PhraseModel instance into a hierarchical Qt model. More...

#include <qtDescriptivePhraseModel.h>

Inheritance diagram for smtk::extension::qtDescriptivePhraseModel:
[legend]
Collaboration diagram for smtk::extension::qtDescriptivePhraseModel:
[legend]

Classes

class  Internal
 Private storage for qtDescriptivePhraseModel. More...
 

Public Types

enum  DataRoles {
  TitleTextRole = Qt::UserRole + 100, EditableTitleTextRole, SubtitleTextRole = Qt::UserRole + 102, PhraseCleanRole = Qt::UserRole + 107,
  PhraseLockRole = Qt::UserRole + 108, ModelActiveRole = Qt::UserRole + 109, TitleTextMutableRole = Qt::UserRole + 110, PhrasePtrRole = Qt::UserRole + 112,
  BadgesRole = Qt::UserRole + 113
}
 Enumeration of model-specific data roles. More...
 

Signals

void phraseTitleChanged (const QModelIndex &)
 

Public Member Functions

 qtDescriptivePhraseModel (QObject *parent=nullptr)
 
std::string visibleIconURL () const
 Set and get the icons to be used when visibility is to be drawn.
 
std::string invisibleIconURL () const
 
void setVisibleIconURL (const std::string &url)
 
void setInvisibleIconURL (const std::string &url)
 
void setPhraseModel (smtk::view::PhraseModelPtr model)
 
smtk::view::PhraseModelPtr phraseModel () const
 
QModelIndex index (int row, int column, const QModelIndex &parent) const override
 
QModelIndex parent (const QModelIndex &child) const override
 
bool hasChildren (const QModelIndex &parent) const override
 Return true when owner has subphrases.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 The number of rows in the table "underneath" owner.
 
int columnCount (const QModelIndex &inParent=QModelIndex()) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 Return something to display in the table header.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Relate information, by its role, from a DescriptivePhrasePtr to the Qt model.
 
bool removeRows (int position, int rows, const QModelIndex &parent=QModelIndex()) override
 Remove rows from the model.
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 Provide meta-information about a model entry.
 
void setDeleteOnRemoval (bool del)
 
view::DescriptivePhrasePtr getItem (const QModelIndex &idx) const
 A utility function to retrieve the view::DescriptivePhrasePtr associated with a model index.
 
QModelIndex indexFromPath (const std::vector< int > &path) const
 
template<typename T , typename C >
bool foreach_phrase (T &visitor, C &collector, const QModelIndex &top=QModelIndex(), bool onlyBuilt=true)
 Iterate over all expanded entries in the tree. More...
 
template<typename T , typename C >
bool foreach_phrase (T &visitor, C &collector, const QModelIndex &top=QModelIndex(), bool onlyBuilt=true) const
 A const version of foreach_phrase. See the non-const version for documentation.
 
void rebuildSubphrases (const QModelIndex &qidx)
 
Qt::DropActions supportedDropActions () const override
 
void setColumnName (const std::string &name)
 
const std::string & columnName () const
 

Static Public Member Functions

static void setDefaultPhraseColor (const std::string &entityType, const QColor &color)
 
static QColor defaultPhraseColor (const std::string &entityType)
 

Protected Member Functions

void updateObserver (smtk::view::DescriptivePhrasePtr phrase, smtk::view::PhraseModelEvent event, const std::vector< int > &src, const std::vector< int > &dst, const std::vector< int > &range)
 

Protected Attributes

smtk::view::PhraseModelPtr m_model
 
smtk::view::PhraseModelObservers::Key m_modelObserver
 
bool m_deleteOnRemoval
 
std::string m_visibleIconURL
 
std::string m_invisibleIconURL
 
std::string m_columnName
 
InternalP
 

Static Protected Attributes

static std::map< std::string, QColor > s_defaultColors = {}
 

Detailed Description

Adapt an smtk::view::PhraseModel instance into a hierarchical Qt model.

By calling setPhraseModel(), you identify the toplevel description you wish to present; it may cover any set of model, mesh, and attribute resources.

The smtk::view::PhraseModel uses an smtk::view::SubphraseGenerator instance to create a hierarchy of smtk::view::DescriptivePhrase instances which portray the components in a set of resources.

Member Enumeration Documentation

◆ DataRoles

Enumeration of model-specific data roles.

Enumerator
TitleTextRole 

Phrase title (usu. current component name)

EditableTitleTextRole 

Phrase title (usu. user-editable component name)

SubtitleTextRole 

Phrase subtitle (usu. type of phrase)

PhraseCleanRole 

Is resource clean (0), dirty (1), or N/A (-1)?

PhraseLockRole 

Is resource free (0) or locked (1)?

ModelActiveRole 

Is resource the active resource?

TitleTextMutableRole 

Is the title editable?

PhrasePtrRole 

Grab the whole descriptive phrase!

BadgesRole 

Grab the set of badges for this phrase.

Member Function Documentation

◆ foreach_phrase()

template<typename T , typename C >
bool smtk::extension::qtDescriptivePhraseModel::foreach_phrase ( T &  visitor,
C &  collector,
const QModelIndex &  top = QModelIndex(),
bool  onlyBuilt = true 
)

Iterate over all expanded entries in the tree.

Note that if you call this method, you must include "smtk/extension/qt/qtTypeDeclarations.h".


The documentation for this class was generated from the following files: