The class that uses the second UI just needs to provide a method that allows the main window to set a value on the combobox and a signal that forwards changes from he combobox to the outside of the second class.
void SecondClass::setComboIndex(int index)
{
ui->comboBox->setCurrentIndex(index);
}
void SecondClass::setComboIndex(int index)
{
ui->comboBox->setCurrentIndex(index);
}
To copy to clipboard, switch view to plain text mode
SecondClass
::SecondClass(QWidget *parent
) , ui(new Ui::SecondClass)
{
ui->setupUi(this);
connect(ui->comboBox, &QComboBox::currentIndexChanged, this, &SecondClass::comboIndexChanged);
}
SecondClass::SecondClass(QWidget *parent)
: QWidget(parent)
, ui(new Ui::SecondClass)
{
ui->setupUi(this);
connect(ui->comboBox, &QComboBox::currentIndexChanged, this, &SecondClass::comboIndexChanged);
}
To copy to clipboard, switch view to plain text mode
Cheers,
_
Bookmarks