QtPdCom
1.3.3
|
List of Messages. More...
#include <MessageModel.h>
Classes | |
struct | Exception |
Exception type. More... | |
class | Impl |
Public Types | |
enum | Roles { DecorationPathRole = Qt::UserRole + 1, TimeStringRole = Qt::UserRole + 2, ResetTimeStringRole = Qt::UserRole + 3, MessageTypeRole = Qt::UserRole + 4 } |
Signals | |
void | currentMessage (const QtPdCom::Message *message) |
Emitted, when a new message gets active. More... | |
void | anyMessage (const QtPdCom::Message *message) |
Emitted, when a new message gets active. More... | |
Public Member Functions | |
MessageModel (QObject *parent=nullptr) | |
Constructor. More... | |
~MessageModel () | |
Destructor. More... | |
void | load (const QString &, const QString &=QString(), const QString &=QString()) |
Loads messages from an Xml file. More... | |
Q_INVOKABLE void | clear () |
Clears the messages. More... | |
void | setRowLimit (int) |
Sets the maximum number of rows to fetch. More... | |
int | getRowLimit () const |
Gets the maxium number of rows to fetch. More... | |
void | connect (QtPdCom::Process *) |
Connects messages to the given process. More... | |
QtPdCom::Process * | getProcess () const |
Q_INVOKABLE void | translate (const QString &) |
Sets a new language and notifies views. More... | |
void | setIcon (Message::Type, const QIcon &) |
Sets an icon for a specific message type. More... | |
const QIcon & | getIcon (Message::Type) const |
void | setIconPath (Message::Type, const QString &) |
Sets the path (url) to an icon for a specific message type. More... | |
virtual int | rowCount (const QModelIndex &) const override |
Implements the model interface. More... | |
virtual int | columnCount (const QModelIndex &) const override |
Implements the model interface. More... | |
virtual QVariant | data (const QModelIndex &, int) const override |
Implements the Model interface. More... | |
virtual QVariant | headerData (int, Qt::Orientation, int) const override |
Implements the Model interface. More... | |
virtual Qt::ItemFlags | flags (const QModelIndex &) const override |
Implements the Model interface. More... | |
virtual QHash< int, QByteArray > | roleNames () const override |
Additional Rolename for decoration for use in QML views. More... | |
virtual bool | canFetchMore (const QModelIndex &) const override |
virtual void | fetchMore (const QModelIndex &) override |
Protected Member Functions | |
bool | event (QEvent *) override |
Event handler. More... | |
Properties | |
int | rowLimit |
QtPdCom::Process | process |
Private Attributes | |
class Q_DECL_HIDDEN | Impl |
std::unique_ptr< Impl > | impl |
Friends | |
class | Message::Impl |
List of Messages.
MessageModel::MessageModel | ( | QObject * | parent = nullptr | ) |
Constructor.
MessageModel::~MessageModel | ( | ) |
Destructor.
References clear().
|
signal |
Emitted, when a new message gets active.
This signal announces any new arriving message.
message | The message that got active. |
|
overridevirtual |
References impl.
Referenced by fetchMore(), QtPdCom::MessageModel::Impl::getHistoryMessage(), QtPdCom::MessageModel::Impl::getMessageReply(), and QtPdCom::MessageModel::Impl::processReset().
void MessageModel::clear | ( | ) |
|
overridevirtual |
Implements the model interface.
void MessageModel::connect | ( | QtPdCom::Process * | process | ) |
Connects messages to the given process.
process | PdCom process. |
References QtPdCom::Message::getIndex(), QtPdCom::Process::getMessageManager(), QtPdCom::Message::getPath(), QtPdCom::Message::impl, impl, QtPdCom::AbstractScalarVariable::Exception::msg, process, QtPdCom::Process::processConnected(), QtPdCom::MessageModel::Impl::processMessage(), QtPdCom::MessageManager::processMessageSignal(), QtPdCom::MessageModel::Impl::processReset(), QtPdCom::MessageManager::processResetSignal(), and QtPdCom::MessageModel::Impl::reloadActiveMessages().
|
signal |
Emitted, when a new message gets active.
This signal announces the most recent message. It is only emitted for the first message getting active, or for a subsequent message with a higher type.
message | The message that got active. The signal is emitted with message being NULL, if no messages are active any more. |
Referenced by clear(), and translate().
|
overridevirtual |
Implements the Model interface.
References DecorationPathRole, impl, MessageTypeRole, ResetTimeStringRole, and TimeStringRole.
|
overrideprotected |
Event handler.
event | Paint event flags. |
|
overridevirtual |
References canFetchMore(), and impl.
|
overridevirtual |
Implements the Model interface.
References impl.
const QIcon & MessageModel::getIcon | ( | Message::Type | type | ) | const |
References impl.
QtPdCom::Process * MessageModel::getProcess | ( | ) | const |
References impl.
int MessageModel::getRowLimit | ( | ) | const |
Gets the maxium number of rows to fetch.
References impl.
|
overridevirtual |
Implements the Model interface.
void MessageModel::load | ( | const QString & | path, |
const QString & | lang = QString() , |
||
const QString & | pathPrefix = QString() |
||
) |
Loads messages from an Xml file.
path | Path to Xml file. |
lang | Language identifier. |
pathPrefix | Prefix to path (with leading /). |
References QtPdCom::Message::impl, impl, QtPdCom::Message::Impl::indexFromPlainXmlElement(), QtPdCom::Message::Exception::msg, and QtPdCom::Message::Impl::pathFromPlainXmlElement().
|
overridevirtual |
Additional Rolename for decoration for use in QML views.
References DecorationPathRole, MessageTypeRole, ResetTimeStringRole, and TimeStringRole.
|
overridevirtual |
void MessageModel::setIcon | ( | Message::Type | type, |
const QIcon & | icon | ||
) |
void MessageModel::setIconPath | ( | Message::Type | type, |
const QString & | iconPath | ||
) |
void MessageModel::setRowLimit | ( | int | limit | ) |
void MessageModel::translate | ( | const QString & | lang | ) |
Sets a new language and notifies views.
References currentMessage(), and impl.
|
friend |
|
private |
|
private |
Referenced by canFetchMore(), clear(), connect(), data(), fetchMore(), flags(), getIcon(), getProcess(), getRowLimit(), load(), rowCount(), setIcon(), setIconPath(), setRowLimit(), and translate().
|
readwrite |
Referenced by connect().
|
readwrite |