How to pass object to procedure
-
I want a procedure. I want to pass ComboBox object name to it.
@void MainWindow::addPowerUnitTypes(QComboBox *ComboBox)
{
ui->ComboBox->addItem("kilowatt [kW]");
ui->ComboBox->addItem("horsepower [hp, hp (UK)]");
}@And call the function
@addPowerUnitTypes(ui->comboBoxFrom);@But I get an error: mainwindow.h:27: error: 'QComboBox' has not been declared.
The line 27 of mainwindow.h is
@void addPowerUnitTypes(QComboBox*);@I am totally new to this. I am Delphi programmer.
-
welcome to devnet
Did you include the header in mainwindow.h prior to line 27?
@#include <QComboBox>@
-
Ohh, I missed it indeed. Thank you.