KDEGames
kgamepropertyhandler.cpp
45 KGamePropertyHandler::KGamePropertyHandler(int id, const QObject *receiver, const char *sendf, const char *emitf, QObject *parent)
75 void KGamePropertyHandler::registerHandler(int id, const QObject *receiver, const char *sendf, const char *emitf)
376 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:252
bool isNull() const const
bool processMessage(QDataStream &stream, int id, bool isSender)
Main message process function.
Definition: kgamepropertyhandler.cpp:86
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:171
Q_EMITQ_EMIT
void unlockProperties()
Calls KGamePropertyBase::setReadOnly(false) for all properties of this player.
Definition: kgamepropertyhandler.cpp:229
void unlockDirectEmit()
Removes the lock from the emitting of property signals.
Definition: kgamepropertyhandler.cpp:271
void registerHandler(int id, const QObject *receiver, const char *send, const char *emit)
Register the handler with a parent.
Definition: kgamepropertyhandler.cpp:75
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:193
void emitSignal(KGamePropertyBase *data)
called by a property to emit a signal This call is simply forwarded to the parent object
Definition: kgamepropertyhandler.cpp:284
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:124
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:134
bool isEmpty() const const
A collection class for KGameProperty objects.
Definition: kgamepropertyhandler.h:63
int uniquePropertyId()
returns a unique property ID starting called usually with a base of KGamePropertyBase::IdAutomatic.
Definition: kgamepropertyhandler.cpp:247
KGamePropertyHandler(QObject *parent=nullptr)
Construct an unregistered KGamePropertyHandler.
Definition: kgamepropertyhandler.cpp:52
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:215
QString propertyValue(KGamePropertyBase *property)
In several situations you just want to have a QString of a KGameProperty object.
Definition: kgamepropertyhandler.cpp:335
void lockProperties()
Calls KGamePropertyBase::setReadOnly(true) for all properties of this handler.
Definition: kgamepropertyhandler.cpp:238
QString i18np(const char *singular, const char *plural, const TYPE &arg...)
QString propertyName(int id) const
Definition: kgamepropertyhandler.cpp:155
bool sendProperty(QDataStream &s)
called by a property to send itself into the datastream.
Definition: kgamepropertyhandler.cpp:300
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:191
KGamePropertyBase::PropertyPolicy policy()
Returns the default policy for this property handler.
Definition: kgamepropertyhandler.cpp:210
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:330
void setId(int id)
Use id as new ID for this KGamePropertyHandler.
Definition: kgamepropertyhandler.cpp:70
void lockDirectEmit()
Called by the KGame or KPlayer object or the handler itself to delay emitting of signals.
Definition: kgamepropertyhandler.cpp:266
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Nov 28 2023 03:50:18 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Nov 28 2023 03:50:18 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.