KChatBaseModel
#include <KChatBaseModel>
Public Slots | |
virtual void | addMessage (const QString &fromName, const QString &text) |
virtual void | addSystemMessage (const QString &fromName, const QString &text) |
void | slotClear () |
Detailed Description
The model used to store messages displayed in the chat dialog messages list.
This is a list model and thus derived from QAbstractListModel and implementing its abstract API.
Definition at line 66 of file kchatbasemodel.h.
Constructor & Destructor Documentation
◆ KChatBaseModel()
Default constructor.
Definition at line 67 of file kchatbasemodel.cpp.
◆ ~KChatBaseModel()
|
override |
Default destructor.
Definition at line 73 of file kchatbasemodel.cpp.
Member Function Documentation
◆ addMessage
Add a text in the listbox.
See also signalSendMessage()
Maybe you want to replace this with a function that creates a nicer text than "fromName: text"
Update: the function layoutMessage is called by this now. This means that you will get user defined outlook on the messages :-)
- Parameters
-
fromName The player who sent this message text The text to be added
Definition at line 207 of file kchatbasemodel.cpp.
◆ addSystemMessage
|
virtualslot |
This works just like addMessage but adds a system message.
System messages will have a different look than player messages.
You may wish to use this to display status information from your game.
Definition at line 222 of file kchatbasemodel.cpp.
◆ clear()
void KChatBaseModel::clear | ( | ) |
Clear all messages in the list.
Definition at line 164 of file kchatbasemodel.cpp.
◆ data()
|
overridevirtual |
Reimplementation of the inherited method.
- Returns
- The KChatBaseMessage at the given index as a QVariant
Implements QAbstractItemModel.
Definition at line 187 of file kchatbasemodel.cpp.
◆ maxItems()
int KChatBaseModel::maxItems | ( | ) | const |
- Returns
- The maximum number of messages in the list. -1 is unlimited. See also setMaxItems
Definition at line 182 of file kchatbasemodel.cpp.
◆ messageFont()
This font should be used for a message.
layoutMessage sets the font of a message using KChatBaseItemDelegate::setMessageFont but if you replace layoutMessage with your own function you should use messageFont() yourself.
- Returns
- The font that is used for a message
Definition at line 105 of file kchatbasemodel.cpp.
◆ nameFont()
This font should be used for the name (the "from: " part) of a message.
layoutMessage uses this to set the font using KChatBaseItemDelegate::setNameFont but if you want to overwrite layoutMessage you should do this yourself.
- Returns
- The font that is used for the name part of the message.
Definition at line 100 of file kchatbasemodel.cpp.
◆ readConfig()
Read the configuration from a KConfig object.
If the pointer is NULL KGlobal::config() is used and the group is changed to "KChatBase". The current KConfig::group is restored after this call.
Definition at line 150 of file kchatbasemodel.cpp.
◆ rowCount()
|
overridevirtual |
Reimplementation of the inherited method.
- Returns
- The current number of messages in the list
Implements QAbstractItemModel.
Definition at line 199 of file kchatbasemodel.cpp.
◆ saveConfig()
Save the configuration of the dialog to a KConfig object.
If the supplied KConfig pointer is NULL then KGlobal::config() is used instead (and the group is changed to "KChatBase") butr the current group is restored at the end.
- Parameters
-
conf A pointer to the KConfig object to save the config to. If you use 0 then KGlobal::config() is used and the group is changed to "KChatBase" (the current group is restored at the end).
Definition at line 136 of file kchatbasemodel.cpp.
◆ setBothFont()
This sets both - nameFont and messageFont to font.
You probably want to use this if you don't wish to distinguish between these parts of a message.
- Parameters
-
font A font used for both nameFont and messageFont
Definition at line 94 of file kchatbasemodel.cpp.
◆ setMaxItems()
void KChatBaseModel::setMaxItems | ( | int | maxItems | ) |
Set the maximum number of items in the list.
If the number of item exceeds the maximum as many items are deleted (oldest first) as necessary. The number of items will never exceed this value.
- Parameters
-
maxItems the maximum number of items. -1 (default) for unlimited.
Definition at line 169 of file kchatbasemodel.cpp.
◆ setMessageFont()
Set the font that is used for the message part of a message.
- See also
- messageFont, setBothFont
Definition at line 89 of file kchatbasemodel.cpp.
◆ setNameFont()
Set the font that is used for the name part of a message.
See also nameFont and setBothFont
Definition at line 84 of file kchatbasemodel.cpp.
◆ setSystemBothFont()
Same as setBothFont but applies only to system messages.
Definition at line 120 of file kchatbasemodel.cpp.
◆ setSystemMessageFont()
Same as setMessageFont but applies only to system messages.
Definition at line 115 of file kchatbasemodel.cpp.
◆ setSystemNameFont()
Same as setNameFont but applies only to system messages.
Definition at line 110 of file kchatbasemodel.cpp.
◆ slotClear
|
slot |
This clears all messages in the view.
Note that only the messages are cleared, not the sender names in the combo box!
Definition at line 79 of file kchatbasemodel.cpp.
◆ systemMessageFont()
Same as systemMessageFont but applies only to system messages.
Definition at line 131 of file kchatbasemodel.cpp.
◆ systemNameFont()
Same as systemNameFont but applies only to system messages.
Definition at line 126 of file kchatbasemodel.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:16:50 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.