Keeps track of buffers.
More...
Inherits QAbstractListModel.
|
void | clear () |
|
void | sort (int column=0, Qt::SortOrder order=Qt::AscendingOrder) |
|
void | sort (Irc::SortMethod method, Qt::SortOrder order=Qt::AscendingOrder) |
|
IrcBufferModel automatically keeps track of channel and query buffers and manages IrcBuffer instances for them. It will notify via signals when channel and query buffers are added and/or removed. IrcBufferModel can be used directly as a data model for Qt's item views - both in C++ and QML.
listView->setModel(model);
IrcBufferModel::IrcBufferModel |
( |
QObject * |
parent = 0 | ) |
|
|
explicit |
Constructs a new model with parent.
- Note
- If parent is an instance of IrcConnection, it will be automatically assigned to connection.
IrcBufferModel::~IrcBufferModel |
( |
| ) |
|
|
virtual |
void IrcBufferModel::aboutToBeAdded |
( |
IrcBuffer * |
buffer | ) |
|
|
signal |
This signal is emitted just before a buffer is added to the list of buffers.
void IrcBufferModel::aboutToBeRemoved |
( |
IrcBuffer * |
buffer | ) |
|
|
signal |
This signal is emitted just before a buffer is removed from the list of buffers.
Adds a buffer with title to the model and returns it.
void IrcBufferModel::add |
( |
IrcBuffer * |
buffer | ) |
|
Adds the buffer to the model.
void IrcBufferModel::added |
( |
IrcBuffer * |
buffer | ) |
|
|
signal |
This signal is emitted when a buffer is added to the list of buffers.
Returns the buffer for model index.
void IrcBufferModel::clear |
( |
| ) |
|
|
slot |
Clears the model.
All buffers except persistent buffers are removed and destroyed.
In order to remove a persistent buffer, either explicitly call remove() or delete the buffer.
bool IrcBufferModel::contains |
( |
const QString & |
title | ) |
const |
Returns true
if the model contains title.
Creates a buffer object with title.
IrcBufferModel will automatically call this factory method when a need for the buffer object occurs ie. a private message is received.
The default implementation creates an instance of the buffer prototype. Reimplement this function in order to alter the default behavior.
- See Also
- bufferPrototype
Creates a channel object with title.
IrcBufferModel will automatically call this factory method when a need for the channel object occurs ie. a channel is being joined.
The default implementation creates an instance of the channel prototype. Reimplement this function in order to alter the default behavior.
- See Also
- channelPrototype
Returns the data for specified role and user referred to by by the index.
Returns the buffer object for title or 0
if not found.
IrcBuffer * IrcBufferModel::get |
( |
int |
index | ) |
const |
Returns the buffer object at index.
Returns the model index for buffer.
Returns the index of the item in the model specified by the given row, column and parent index.
Reimplemented from QAbstractListModel.
int IrcBufferModel::indexOf |
( |
IrcBuffer * |
buffer | ) |
const |
Returns the index of the specified buffer, or -1
if the model does not contain the buffer.
Returns true
if one buffer is "less than" another, otherwise returns false
.
The default implementation sorts according to the specified sort method. Reimplement this function in order to customize the sort order.
- See Also
- sort(), sortMethod
void IrcBufferModel::messageIgnored |
( |
IrcMessage * |
message | ) |
|
|
signal |
void IrcBufferModel::remove |
( |
const QString & |
title | ) |
|
Removes and destroys a buffer with title from the model.
void IrcBufferModel::remove |
( |
IrcBuffer * |
buffer | ) |
|
Removes and destroys a buffer from the model.
void IrcBufferModel::removed |
( |
IrcBuffer * |
buffer | ) |
|
|
signal |
This signal is emitted when a buffer is removed from the list of buffers.
Returns the number of buffers.
void IrcBufferModel::sort |
( |
int |
column = 0 , |
|
|
Qt::SortOrder |
order = Qt::AscendingOrder |
|
) |
| |
|
slot |
Sorts the model using the given order.
void IrcBufferModel::sort |
( |
Irc::SortMethod |
method, |
|
|
Qt::SortOrder |
order = Qt::AscendingOrder |
|
) |
| |
|
slot |
Sorts the model using the given method and order.
- See Also
- lessThan()
This property holds the buffer prototype.
The prototype is used by the default implementation of createBuffer().
- Note
- The prototype must have an invokable constructor.
- Access functions:
-
This property holds the list of buffers.
- Access function:
-
- Notifier signal:
-
This property holds the channel prototype.
The prototype is used by the default implementation of createChannel().
- Note
- The prototype must have an invokable constructor.
- Access functions:
-
This property holds the list of channel names.
- Access function:
-
- Notifier signal:
-
This property holds the connection.
- Access functions:
-
- Warning
- Changing the connection on the fly is not supported.
int IrcBufferModel::count |
|
read |
This property holds the number of buffers.
- Access function:
-
- Notifier signal:
- void countChanged(int count)
This property holds the display role.
The specified data role is returned for Qt::DisplayRole.
The default value is Irc::TitleRole.
- Access functions:
-
This property holds the network.
- Access functions:
-
This property holds the model sort method.
The default value is Irc::SortByHand
.
Method | Description | Example |
Irc::SortByHand | Buffers are not sorted automatically, but only by calling sort(). | - |
Irc::SortByName | Buffers are sorted alphabetically, ignoring any channel prefix. | "bot", "#communi", "#freenode", "jpnurmi", "#qt" |
Irc::SortByTitle | Buffers are sorted alphabetically, and channels before queries. | "#communi", "#freenode", "#qt", "bot", "jpnurmi" |
- Access functions:
-
- See Also
- sort(), lessThan()
Qt::SortOrder IrcBufferModel::sortOrder |
|
readwrite |
This property holds the model sort order.
The default value is Qt::AscendingOrder
.
- Access functions:
- Qt::SortOrder sortOrder() const
- void setSortOrder(Qt::SortOrder order)
- See Also
- sort(), lessThan()