QObject::connect(setbutton,
SIGNAL(clicked
()),num,
SLOT(set
(int nn,
int nd
)));
QObject::connect(setbutton,SIGNAL(clicked()),num,SLOT(set(int nn, int nd)));
To copy to clipboard, switch view to plain text mode
This is not legal in Qt. The slot should have less than or equal number of arguments as signal.
Fraction add(const Fraction& other);
Fraction subtract(const Fraction& other);
Fraction multiply(const Fraction& other);
Fraction divide(const Fraction& other);
Fraction add(const Fraction& other);
Fraction subtract(const Fraction& other);
Fraction multiply(const Fraction& other);
Fraction divide(const Fraction& other);
To copy to clipboard, switch view to plain text mode
All these function declaration are not possible int Qt, because Fraction is derived QObject, instead use somthing like
void add(const Fraction& other);
void subtract(const Fraction& other);
void multiply(const Fraction& other);
void divide(const Fraction& other);
void add(const Fraction& other);
void subtract(const Fraction& other);
void multiply(const Fraction& other);
void divide(const Fraction& other);
To copy to clipboard, switch view to plain text mode
Also typically all QObject derived class objects follow parent-child relationships, i.e the parent is passed during QObject construction. The best way to define Fraction class would be to (If you have decided to make it QObject)
Q_OBJECT
public:
Fraction
(int nn,
int nd,
QObject * parent
= 0);
}
class Fraction: public QObject {
Q_OBJECT
public:
Fraction(int nn, int nd, QObject * parent = 0);
}
To copy to clipboard, switch view to plain text mode
Bookmarks