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

    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.

  • Moderators

    welcome to devnet

    Did you include the header in mainwindow.h prior to line 27?

    @#include <QComboBox>@

  • Ohh, I missed it indeed. Thank you.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.