Eos Pengwern
12th December 2009, 21:36
Hello,
A fairly common format for a Qt class, which I make use of often, is:
class Garden : public QWidget
{
Q_OBJECT
Q_PROPERTY(double wheelBarrow READ wheelBarrow WRITE setWheelBarrow);
.
.
public:
// Constructor:
.
.
void setWheelBarrow(const double &newWheelBarrow);
etc.
public slots:
void updateWheelBarrow(const double &newWheelBarrow);
.
.
.
};
Quite often, setWheelBarrow and updateWheelBarrow do different things (for example, updateWheelBarrow may need to update some other parameters which depend on wheelBarrow, which setWheelBarrow assumes will be set directly by the parent) , but sometimes they do exactly the same thing. In the cases where they are exactly the same, can the same function be used? Or is it always necessary for Q_PROPERTY functions and slots to be separate entities?
Thanks,
Stephen.
A fairly common format for a Qt class, which I make use of often, is:
class Garden : public QWidget
{
Q_OBJECT
Q_PROPERTY(double wheelBarrow READ wheelBarrow WRITE setWheelBarrow);
.
.
public:
// Constructor:
.
.
void setWheelBarrow(const double &newWheelBarrow);
etc.
public slots:
void updateWheelBarrow(const double &newWheelBarrow);
.
.
.
};
Quite often, setWheelBarrow and updateWheelBarrow do different things (for example, updateWheelBarrow may need to update some other parameters which depend on wheelBarrow, which setWheelBarrow assumes will be set directly by the parent) , but sometimes they do exactly the same thing. In the cases where they are exactly the same, can the same function be used? Or is it always necessary for Q_PROPERTY functions and slots to be separate entities?
Thanks,
Stephen.