QtPdCom  1.3.3
Classes | Public Types | Signals | Public Member Functions | Protected Member Functions | Properties | Private Attributes | Friends | List of all members
QtPdCom::MessageModel Class Reference

List of Messages. More...

#include <MessageModel.h>

Inheritance diagram for QtPdCom::MessageModel:
Inheritance graph
[legend]
Collaboration diagram for QtPdCom::MessageModel:
Collaboration graph
[legend]

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::ProcessgetProcess () 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< Implimpl
 

Friends

class Message::Impl
 

Detailed Description

List of Messages.

See also
Message.

Member Enumeration Documentation

◆ Roles

Enumerator
DecorationPathRole 
TimeStringRole 
ResetTimeStringRole 
MessageTypeRole 

Constructor & Destructor Documentation

◆ MessageModel()

MessageModel::MessageModel ( QObject *  parent = nullptr)

Constructor.

◆ ~MessageModel()

MessageModel::~MessageModel ( )

Destructor.

References clear().

Member Function Documentation

◆ anyMessage

void QtPdCom::MessageModel::anyMessage ( const QtPdCom::Message message)
signal

Emitted, when a new message gets active.

This signal announces any new arriving message.

Parameters
messageThe message that got active.

◆ canFetchMore()

bool MessageModel::canFetchMore ( const QModelIndex &  parent) const
overridevirtual

◆ clear()

void MessageModel::clear ( )

Clears the messages.

References currentMessage(), and impl.

Referenced by ~MessageModel().

◆ columnCount()

int MessageModel::columnCount ( const QModelIndex &  index) const
overridevirtual

Implements the model interface.

Returns
Number of columns.

◆ connect()

void MessageModel::connect ( QtPdCom::Process process)

◆ currentMessage

void QtPdCom::MessageModel::currentMessage ( const QtPdCom::Message message)
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.

Parameters
messageThe message that got active. The signal is emitted with message being NULL, if no messages are active any more.

Referenced by clear(), and translate().

◆ data()

QVariant MessageModel::data ( const QModelIndex &  index,
int  role 
) const
overridevirtual

Implements the Model interface.

References DecorationPathRole, impl, MessageTypeRole, ResetTimeStringRole, and TimeStringRole.

◆ event()

bool MessageModel::event ( QEvent *  event)
overrideprotected

Event handler.

Parameters
eventPaint event flags.

◆ fetchMore()

void MessageModel::fetchMore ( const QModelIndex &  parent)
overridevirtual

References canFetchMore(), and impl.

◆ flags()

Qt::ItemFlags MessageModel::flags ( const QModelIndex &  index) const
overridevirtual

Implements the Model interface.

References impl.

◆ getIcon()

const QIcon & MessageModel::getIcon ( Message::Type  type) const
Returns
Icon for given message type.

References impl.

◆ getProcess()

QtPdCom::Process * MessageModel::getProcess ( ) const

References impl.

◆ getRowLimit()

int MessageModel::getRowLimit ( ) const

Gets the maxium number of rows to fetch.

References impl.

◆ headerData()

QVariant MessageModel::headerData ( int  section,
Qt::Orientation  o,
int  role 
) const
overridevirtual

Implements the Model interface.

◆ load()

void MessageModel::load ( const QString &  path,
const QString &  lang = QString(),
const QString &  pathPrefix = QString() 
)

Loads messages from an Xml file.

Parameters
pathPath to Xml file.
langLanguage identifier.
pathPrefixPrefix to path (with leading /).

References QtPdCom::Message::impl, impl, QtPdCom::Message::Impl::indexFromPlainXmlElement(), QtPdCom::Message::Exception::msg, and QtPdCom::Message::Impl::pathFromPlainXmlElement().

◆ roleNames()

QHash< int, QByteArray > MessageModel::roleNames ( ) const
overridevirtual

Additional Rolename for decoration for use in QML views.

References DecorationPathRole, MessageTypeRole, ResetTimeStringRole, and TimeStringRole.

◆ rowCount()

int MessageModel::rowCount ( const QModelIndex &  index) const
overridevirtual

Implements the model interface.

Returns
Number of active messages.

References impl.

◆ setIcon()

void MessageModel::setIcon ( Message::Type  type,
const QIcon &  icon 
)

Sets an icon for a specific message type.

References impl.

Referenced by setIconPath().

◆ setIconPath()

void MessageModel::setIconPath ( Message::Type  type,
const QString &  iconPath 
)

Sets the path (url) to an icon for a specific message type.

If the model is used with QML views this is the only way to store the icon information.

References impl, and setIcon().

◆ setRowLimit()

void MessageModel::setRowLimit ( int  limit)

Sets the maximum number of rows to fetch.

Parameters
limitMaximum number of rows.

References impl.

◆ translate()

void MessageModel::translate ( const QString &  lang)

Sets a new language and notifies views.

References currentMessage(), and impl.

Friends And Related Function Documentation

◆ Message::Impl

friend class Message::Impl
friend

Member Data Documentation

◆ Impl

class Q_DECL_HIDDEN QtPdCom::MessageModel::Impl
private

◆ impl

std::unique_ptr<Impl> QtPdCom::MessageModel::impl
private

Property Documentation

◆ process

QtPdCom::Process QtPdCom::MessageModel::process
readwrite

Referenced by connect().

◆ rowLimit

int QtPdCom::MessageModel::rowLimit
readwrite

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