我是QT的新手。从 qt docs 相当简单地解释以下内容:
class CalculatorForm : public QWidget
{
Q_OBJECT
public:
CalculatorForm(QWidget *parent = 0);
private slots:
void on_inputSpinBox1_valueChanged(int value); //why is that slots are private?
private:
Ui::CalculatorForm ui;
};
和构造函数的实现
CalculatorForm::CalculatorForm(QWidget *parent)
: QWidget(parent) {
ui.setupUi(this); // <-- Question below
}
问:我想知道为什么我们将this
指针传递给 setupUi 函数?它有什么作用?