Class Avogadro::MoleQueue::MoleQueueQueueListModel#

class Avogadro::MoleQueue::MoleQueueQueueListModel : public QAbstractItemModel#

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


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.

Public Functions

~MoleQueueQueueListModel() override#
QStringList queues() const#

A list of the available queues.

QStringList programs(const QString &queue) const#

A list of programs belonging to queue.

QModelIndexList findQueueIndices(const QString &filter = QString()) const#

A QModelIndexList containing indices for queues that contain the string filter. Matches are case-insensitive.

QModelIndexList findProgramIndices(const QString &programFilter = QString(), const QString &queueFilter = QString()) const#

A QModelIndexList containing indices for programs that contain the string programFilter and belong to queues that contain queueFilter. Matches are case-insensitive.

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

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

  • idx – The model index.

  • queueName – String reference to be overwritten with the queue name.

  • programName – String reference to be overwritten with the queue name.


True if the index matched a program node, false otherwise.

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 [anonymous]#

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


enumerator QueueProgramRole#

Protected Functions

explicit MoleQueueQueueListModel(QObject *parent_ = nullptr)#

Protected constructor. Keeps objects isolated to MoleQueueManager ivars.

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

Merge the queue and program lists with the existing model.


friend class MoleQueueManager
friend class ::MoleQueueQueueListModelTestBridge