KDEGames
kgamepropertyhandler.cpp
47 KGamePropertyHandler::KGamePropertyHandler(int id, const QObject *receiver, const char *sendf, const char *emitf, QObject *parent)
77 void KGamePropertyHandler::registerHandler(int id, const QObject *receiver, const char *sendf, const char *emitf)
403 qDebug() << " " << p->id() << ": p=" << p->policy() << "l=" << p->isLocked() << "e=" << p->isEmittingSignal() << "o=" << p->isOptimized()
void flush()
Sends all properties which are marked dirty over the network.
Definition: kgamepropertyhandler.cpp:270
bool isNull() const const
bool processMessage(QDataStream &stream, int id, bool isSender)
Main message process function.
Definition: kgamepropertyhandler.cpp:88
static void createPropertyHeader(QDataStream &msg, int id)
Creates a property header given the property id.
Definition: kgamemessage.cpp:62
QString number(int n, int base)
virtual bool load(QDataStream &stream)
Loads properties from the datastream.
Definition: kgamepropertyhandler.cpp:173
Q_EMITQ_EMIT
void unlockProperties()
Calls KGamePropertyBase::setReadOnly(false) for all properties of this player.
Definition: kgamepropertyhandler.cpp:239
void unlockDirectEmit()
Removes the lock from the emitting of property signals.
Definition: kgamepropertyhandler.cpp:293
void registerHandler(int id, const QObject *receiver, const char *send, const char *emit)
Register the handler with a parent.
Definition: kgamepropertyhandler.cpp:77
const T & value() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void signalPropertyChanged(KGamePropertyBase *)
This is emitted by a property.
static void extractPropertyHeader(QDataStream &msg, int &id)
Retrieves the property id from a property message header.
Definition: kgamemessage.cpp:67
virtual bool save(QDataStream &stream)
Saves properties into the datastream.
Definition: kgamepropertyhandler.cpp:195
int size() const const
void emitSignal(KGamePropertyBase *data)
called by a property to emit a signal This call is simply forwarded to the parent object
Definition: kgamepropertyhandler.cpp:306
QString i18n(const char *text, const TYPE &arg...)
bool isLocked() const
A locked property can only be changed by the player who has set the lock.
Definition: kgameproperty.h:195
bool removeProperty(KGamePropertyBase *data)
Removes a property from the handler.
Definition: kgamepropertyhandler.cpp:126
void signalRequestValue(KGamePropertyBase *property, QString &value)
If you call propertyValue with a non-standard KGameProperty it is possible that the value cannot auto...
bool addProperty(KGamePropertyBase *data, const QString &name=QString())
Adds a KGameProperty property to the handler.
Definition: kgamepropertyhandler.cpp:136
QHashIterator::Item next()
A collection class for KGameProperty objects.
Definition: kgamepropertyhandler.h:63
const T & at(int i) const const
int uniquePropertyId()
returns a unique property ID starting called usually with a base of KGamePropertyBase::IdAutomatic.
Definition: kgamepropertyhandler.cpp:265
KGamePropertyHandler(QObject *parent=nullptr)
Construct an unregistered KGamePropertyHandler.
Definition: kgamepropertyhandler.cpp:54
void setPolicy(KGamePropertyBase::PropertyPolicy p, bool userspace=true)
Set the policy for all kgame variables which are currently registered in the KGame property handler.
Definition: kgamepropertyhandler.cpp:221
QString propertyValue(KGamePropertyBase *property)
In several situations you just want to have a QString of a KGameProperty object.
Definition: kgamepropertyhandler.cpp:358
bool hasNext() const const
void lockProperties()
Calls KGamePropertyBase::setReadOnly(true) for all properties of this handler.
Definition: kgamepropertyhandler.cpp:252
QString i18np(const char *singular, const char *plural, const TYPE &arg...)
QString propertyName(int id) const
Definition: kgamepropertyhandler.cpp:157
bool sendProperty(QDataStream &s)
called by a property to send itself into the datastream.
Definition: kgamepropertyhandler.cpp:322
void signalSendMessage(int msgid, QDataStream &, bool *sent)
This signal is emitted when a property needs to be sent.
virtual void command(QDataStream &stream, int msgid, bool isSender=false)
send a command to advanced properties like arrays
Definition: kgameproperty.cpp:190
KGamePropertyBase::PropertyPolicy policy()
Returns the default policy for this property handler.
Definition: kgamepropertyhandler.cpp:216
static void extractPropertyCommand(QDataStream &msg, int &pid, int &cmd)
Retrieves the property id from a property message header.
Definition: kgamemessage.cpp:81
virtual void load(QDataStream &s)=0
This will read the value of this property from the stream.
QMultiHash< int, KGamePropertyBase * > & dict() const
Reference to the internal dictionary.
Definition: kgamepropertyhandler.cpp:353
void setId(int id)
Use id as new ID for this KGamePropertyHandler.
Definition: kgamepropertyhandler.cpp:72
void lockDirectEmit()
Called by the KGame or KPlayer object or the handler itself to delay emitting of signals.
Definition: kgamepropertyhandler.cpp:288
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 03:54:58 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 03:54:58 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.