itom
|
class for visualizing the available (loaded) plugins More...
#include <pluginModel.h>
Public Member Functions | |
PlugInModel (ito::AddInManager *addInManager, QObject *parent=NULL) | |
~PlugInModel () | |
QVariant | data (const QModelIndex &index, int role) const |
Qt::ItemFlags | flags (const QModelIndex &index) const |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const |
QModelIndex | parent (const QModelIndex &index) const |
int | rowCount (const QModelIndex &parent=QModelIndex()) const |
int | columnCount (const QModelIndex &parent=QModelIndex()) const |
int | update (void) |
bool | insertInstance (ito::AddInInterfaceBase *addInInterface, bool beginOperation) |
bool | deleteInstance (ito::AddInBase *addInInstance, const bool beginOperation) |
bool | resetModel (bool beginOperation) |
QModelIndex | getIndexByAddIn (ito::AddInBase *ai) const |
QModelIndex | getIndexByAddInInterface (ito::AddInInterfaceBase *aib) const |
bool | getModelIndexInfo (const QModelIndex &index, tItemType &type, size_t &internalData) const |
bool | getIsAlgoPlugIn (tItemType &itemType, size_t &internalData) const |
bool | getIsGrabberInstance (tItemType &itemType, size_t &internalData) const |
QModelIndex | getTypeNode (const int type) const |
returns the background color for instances, that have been created by Python or which have at least one current reference by Python code | |
QColor | backgroundColorInstancesWithPythonRef () const |
void | setBackgroundColorInstancesWithPythonRef (const QColor &bgColor) |
Protected Member Functions | |
QVariant | getFixedNodeInfo (const QModelIndex &index, const QVariant &name, const tItemType &itemType, const int &role, const QIcon icon) const |
QVariant | getPluginNodeInfo (const QModelIndex &index, const int &role) const |
QVariant | getInstanceNodeInfo (const QModelIndex &index, const int &role) const |
QVariant | getFilterOrWidgetNodeInfo (const QModelIndex &index, const int &role, bool filterNotWidget) const |
QMimeData * | mimeData (const QModelIndexList &indexes) const |
Private Member Functions | |
QString | getInitCommand (const QModelIndex &item) const |
Q_DECLARE_PRIVATE (PlugInModel) | |
Private Attributes | |
QScopedPointer< PlugInModelPrivate > | d_ptr |
class for visualizing the available (loaded) plugins
The PlugInModel supplies a widget showing the available plugins (libraries) with their name, filename, version and so on. In addition below each plugin its running instances are shown and if a plugin offers a configuration dialog it can be opened using a right click on the instance and selecting "open configuration dialog" in the context menu. The tree view is automatically updated when a new instance is created or an existing one had been deleted.
ito::PlugInModel::PlugInModel | ( | ito::AddInManager * | addInManager, |
QObject * | parent = NULL ) |
constructor
constructor, creating column headers for the tree view
ito::PlugInModel::~PlugInModel | ( | ) |
destructor - clean up, clear header and alignment list
int ito::PlugInModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
return column count
[in] | parent | parent of current item |
QVariant ito::PlugInModel::data | ( | const QModelIndex & | index, |
int | role ) const |
return data elements for a given row
[in] | index | index for which the data elements should be delivered |
[in] | role | the current role of the model |
This method is actually used to fill the tree view. It returns the data for the selected element, depending as well on the column of the selected element, passed in index.column. The method here is divided into two parts. The first one handles requests for root elements (plugins) the second one is used for child elements (instances of plugins).
bool ito::PlugInModel::deleteInstance | ( | ito::AddInBase * | addInInstance, |
const bool | beginOperation ) |
addInInterface | |
addInInstance | |
beginOperation |
Qt::ItemFlags ito::PlugInModel::flags | ( | const QModelIndex & | index | ) | const |
return
|
protected |
index | |
role | |
filterNotWidget |
|
protected |
index | |
name | |
itemType | |
role | |
icon |
QModelIndex ito::PlugInModel::getIndexByAddIn | ( | ito::AddInBase * | ai | ) | const |
ai |
QModelIndex ito::PlugInModel::getIndexByAddInInterface | ( | ito::AddInInterfaceBase * | aib | ) | const |
aib |
|
private |
self-managed pointer to the private class container (deletes itself if d_ptr is destroyed)
|
protected |
index | |
role |
bool ito::PlugInModel::getIsAlgoPlugIn | ( | tItemType & | itemType, |
size_t & | internalData ) const |
itemType | |
internalData |
bool ito::PlugInModel::getIsGrabberInstance | ( | tItemType & | itemType, |
size_t & | internalData ) const |
itemType | |
internalData |
bool ito::PlugInModel::getModelIndexInfo | ( | const QModelIndex & | index, |
tItemType & | type, | ||
size_t & | internalData ) const |
index | |
type | |
internalData |
|
protected |
index | |
role |
QVariant ito::PlugInModel::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole ) const |
return the header / captions for the tree view model
QModelIndex ito::PlugInModel::index | ( | int | row, |
int | column, | ||
const QModelIndex & | parent = QModelIndex() ) const |
return current index element
[in] | row | row of current element |
[in] | column | column of current element |
[in] | parent | parent of current element |
This method returns the QModelIndex for the current element. As the tree structure is not cached it has to be "calculated" on each call. An invalid parent means were in the top most "plane" of the tree, i.e. the plugin-plane. If the passed index is out of range we return an empty element. Otherwise a new element marked as root level element (i.e. internal pointer = ROOTPOINTER) is returned. If the parent element is valid the index for an instance is requested. In that case it is first checked if the index for a child child element is queried. In that case again an empty element is returned else the plugin for the selected instance is searched in the plugin lists and an according index is created.
bool ito::PlugInModel::insertInstance | ( | ito::AddInInterfaceBase * | addInInterface, |
bool | beginOperation ) |
addInInterface | |
beginOperation |
QModelIndex ito::PlugInModel::parent | ( | const QModelIndex & | index | ) | const |
return parent element
[in] | index | the element's index for which the parent should be returned |
bool ito::PlugInModel::resetModel | ( | bool | beginOperation | ) |
beginOperation |
int ito::PlugInModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
return number of rows
[in] | parent | parent of current item |