Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QtGui>
- class Test : public QObject
- {
- Q_OBJECT
- Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
- private:
- bool bReadOnly;
- public:
- Test(QObject *pobj = 0)
- : QObject(pobj), bReadOnly(false) {}
- ~Test(){}
- void setReadOnly(bool value)
- {
- bReadOnly = value;
- }
- bool isReadValue() const
- {
- return bReadOnly;
- }
- const char * getText() const
- {
- return bReadOnly ? "ReadOnly SET" : "ReadOnly NOT SET";
- }
- };
- int main (int argc, char *argv[])
- {
- QApplication app(argc, argv);
- Test tst;
- tst.setProperty("readOnly", true);
- QLabel text(tst.getText());
- text.show();
- return app.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement