PDA

View Full Version : Determination of properties to control the read-only mode



collision#
19th November 2016, 11:01
I'm a newbie in qt. And i started to read the book. In which i found out the following code.



class MyClass : public QObject {
Q_OBJECT
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
private:
bool m_bReadOnly;
public:
MyClass(QObject* pobj = 0) : QObject(pobj)
, m_bReadOnly(false)
{
}
public:
void setReadOnly(bool bReadOnly)
{
m_bReadOnly = bReadOnly;
}
bool isReadOnly() const
{
return m_bReadOnly;
}
}

This code about "Determination of properties to control the read-only mode".
But i didn't understand it. And if someone know something about it. Plz,write down your answer. And where do i have to write this code in which file?

anda_skoa
19th November 2016, 12:49
Maybe you should first explain what you don't understand?

Declaration of the property? Any part of the implementation for the property? Usage of the property?

Cheers,
_