• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

libkdegames/libkdegamesprivate

Public Slots | Public Member Functions | List of all members
KChatBaseModel Class Reference

#include <KChatBaseModel>

Inheritance diagram for KChatBaseModel:
Inheritance graph
[legend]

Public Slots

virtual void addMessage (const QString &fromName, const QString &text)
 
virtual void addSystemMessage (const QString &fromName, const QString &text)
 
void slotClear ()
 

Public Member Functions

 KChatBaseModel (QObject *parent=0)
 
virtual ~KChatBaseModel ()
 
void clear ()
 
virtual QVariant data (const QModelIndex &index, int role) const
 
int maxItems () const
 
const QFont & messageFont () const
 
const QFont & nameFont () const
 
virtual void readConfig (KConfig *conf=0)
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
 
virtual void saveConfig (KConfig *conf=0)
 
void setBothFont (const QFont &font)
 
void setMaxItems (int maxItems)
 
void setMessageFont (const QFont &font)
 
void setNameFont (const QFont &font)
 
void setSystemBothFont (const QFont &font)
 
void setSystemMessageFont (const QFont &font)
 
void setSystemNameFont (const QFont &font)
 
const QFont & systemMessageFont () const
 
const QFont & systemNameFont () const
 

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 76 of file kchatbasemodel.h.

Constructor & Destructor Documentation

KChatBaseModel::KChatBaseModel ( QObject *  parent = 0)

Default constructor.

Definition at line 90 of file kchatbasemodel.cpp.

KChatBaseModel::~KChatBaseModel ( )
virtual

Default destructor.

Definition at line 95 of file kchatbasemodel.cpp.

Member Function Documentation

void KChatBaseModel::addMessage ( const QString &  fromName,
const QString &  text 
)
virtualslot

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
fromNameThe player who sent this message
textThe text to be added

Definition at line 224 of file kchatbasemodel.cpp.

void KChatBaseModel::addSystemMessage ( const QString &  fromName,
const QString &  text 
)
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 240 of file kchatbasemodel.cpp.

void KChatBaseModel::clear ( )

Clear all messages in the list.

Definition at line 178 of file kchatbasemodel.cpp.

QVariant KChatBaseModel::data ( const QModelIndex &  index,
int  role 
) const
virtual

Reimplementation of the inherited method.

Returns
The KChatBaseMessage at the given index as a QVariant

Definition at line 203 of file kchatbasemodel.cpp.

int KChatBaseModel::maxItems ( ) const
Returns
The maximum number of messages in the list. -1 is unlimited. See also setMaxItems

Definition at line 197 of file kchatbasemodel.cpp.

const QFont & KChatBaseModel::messageFont ( ) const

This font should be used for a message.

layoutMessage sets the font of a message using KChatBaseItemDelegate::setMessageFont but if ypu replace layoutMessage with your own function you should use messageFont() yourself.

Returns
The font that is used for a message

Definition at line 125 of file kchatbasemodel.cpp.

const QFont & KChatBaseModel::nameFont ( ) const

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 122 of file kchatbasemodel.cpp.

void KChatBaseModel::readConfig ( KConfig *  conf = 0)
virtual

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 164 of file kchatbasemodel.cpp.

int KChatBaseModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Reimplementation of the inherited method.

Returns
The current number of messages in the list

Definition at line 216 of file kchatbasemodel.cpp.

void KChatBaseModel::saveConfig ( KConfig *  conf = 0)
virtual

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
confA 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 150 of file kchatbasemodel.cpp.

void KChatBaseModel::setBothFont ( const QFont &  font)

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
fontA font used for both nameFont and messageFont

Definition at line 116 of file kchatbasemodel.cpp.

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
maxItemsthe maximum number of items. -1 (default) for unlimited.

Definition at line 183 of file kchatbasemodel.cpp.

void KChatBaseModel::setMessageFont ( const QFont &  font)

Set the font that is used for the message part of a message.

See also
messageFont, setBothFont

Definition at line 111 of file kchatbasemodel.cpp.

void KChatBaseModel::setNameFont ( const QFont &  font)

Set the font that is used for the name part of a message.

See also nameFont and setBothFont

Definition at line 106 of file kchatbasemodel.cpp.

void KChatBaseModel::setSystemBothFont ( const QFont &  font)

Same as setBothFont but applies only to system messages.

Definition at line 138 of file kchatbasemodel.cpp.

void KChatBaseModel::setSystemMessageFont ( const QFont &  font)

Same as setMessageFont but applies only to system messages.

Definition at line 133 of file kchatbasemodel.cpp.

void KChatBaseModel::setSystemNameFont ( const QFont &  font)

Same as setNameFont but applies only to system messages.

Definition at line 128 of file kchatbasemodel.cpp.

void KChatBaseModel::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 101 of file kchatbasemodel.cpp.

const QFont & KChatBaseModel::systemMessageFont ( ) const

Same as systemMessageFont but applies only to system messages.

Definition at line 147 of file kchatbasemodel.cpp.

const QFont & KChatBaseModel::systemNameFont ( ) const

Same as systemNameFont but applies only to system messages.

Definition at line 144 of file kchatbasemodel.cpp.


The documentation for this class was generated from the following files:
  • kchatbasemodel.h
  • kchatbasemodel.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:44:45 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdegames/libkdegamesprivate

Skip menu "libkdegames/libkdegamesprivate"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal