AvogadroLibs 1.98.1
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Member Functions | List of all members
MoleQueueQueueListModel Class Reference

The MoleQueueQueueListModel class is Qt item model representing the tree of available queues and programs in a running MoleQueue process. More...

#include <molequeuequeuelistmodel.h>

Inheritance diagram for MoleQueueQueueListModel:

Public Member Functions

QStringList queues () const
 
QStringList programs (const QString &queue) const
 
QModelIndexList findQueueIndices (const QString &filter=QString()) const
 
QModelIndexList findProgramIndices (const QString &programFilter=QString(), const QString &queueFilter=QString()) const
 
bool lookupProgram (const QModelIndex &idx, QString &queueName, QString &programName) const
 
QVariant data (const QModelIndex &idx, int role) const override
 
Qt::ItemFlags flags (const QModelIndex &idx=QModelIndex()) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent_=QModelIndex()) const override
 
QModelIndex parent (const QModelIndex &child) const override
 
int rowCount (const QModelIndex &parent_=QModelIndex()) const override
 
int columnCount (const QModelIndex &parent_=QModelIndex()) const override
 

Protected Types

enum  { QueueProgramRole = Qt::UserRole }
 

Protected Member Functions

 MoleQueueQueueListModel (QObject *parent_=nullptr)
 
void setQueueList (QList< QString > queueList, QList< QStringList > programList)
 

Detailed Description

<avogadro/molequeue/molequeuequeuelistmodel.h>

This class provides access to the available MoleQueue queues and programs in a convenient tree item model. Resources can be queried directly using the queues() and programs() methods, or this item model may be used with a Qt model view class, such a QTreeView.

QModelIndex objects that match a queue or program node may be found using the findQueueIndices() and findProgramIndices() methods. A program model index may be translated into queue and program strings using the lookupProgram() method.

An instance of this class is obtained by calling MoleQueueManager::instance().queueListModel(), and can be updated by calling MoleQueueManager::instance().requestQueueList() and waiting for the MoleQueueManager::queueListUpdated() signal.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

Used to retrieve a QStringList with [queueName, programName] from data() given a program model index.

Constructor & Destructor Documentation

◆ MoleQueueQueueListModel()

MoleQueueQueueListModel ( QObject *  parent_ = nullptr)
explicitprotected

Protected constructor. Keeps objects isolated to MoleQueueManager ivars.

Member Function Documentation

◆ queues()

QStringList queues ( ) const
Returns
A list of the available queues.

◆ programs()

QStringList programs ( const QString &  queue) const
Returns
A list of programs belonging to queue.

◆ findQueueIndices()

QModelIndexList findQueueIndices ( const QString &  filter = QString()) const
Returns
A QModelIndexList containing indices for queues that contain the string filter. Matches are case-insensitive.

◆ findProgramIndices()

QModelIndexList findProgramIndices ( const QString &  programFilter = QString(),
const QString &  queueFilter = QString() 
) const
Returns
A QModelIndexList containing indices for programs that contain the string programFilter and belong to queues that contain queueFilter. Matches are case-insensitive.

◆ lookupProgram()

bool lookupProgram ( const QModelIndex &  idx,
QString &  queueName,
QString &  programName 
) const

Translate a QModelIndex for a program node into queue and program strings.

Parameters
idxThe model index.
queueNameString reference to be overwritten with the queue name.
programNameString reference to be overwritten with the queue name.
Returns
True if the index matched a program node, false otherwise.

◆ setQueueList()

void setQueueList ( QList< QString >  queueList,
QList< QStringList >  programList 
)
protected

Merge the queue and program lists with the existing model.


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