eklavay_tonoy
29th September 2015, 15:41
Hello to All,
I just have started to learn Qt with a very little C++ knowledge. Anyhow, I am having problem to slove a very simple problem. I am having problem with "Signal and Slot" understanding.
Task:
1. By selecting an item from Combo Box
2. That Item will be showed by a Label in the mainwindow.
It is very simple thing but I am not able to solve it.
Here below is my code:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->comboBox,&QComboBox::activated,ui->label,&QLabel::setLabelValue);
}
MainWindow::~MainWindow()
{
delete ui;
}
MainWindow::setLabelValue()
{
ui->label->text() = ui->comboBox->currentText();
}
It is not working. Will there be anyone to suggest me so that I could solve it.
Thanks in advance!
I just have started to learn Qt with a very little C++ knowledge. Anyhow, I am having problem to slove a very simple problem. I am having problem with "Signal and Slot" understanding.
Task:
1. By selecting an item from Combo Box
2. That Item will be showed by a Label in the mainwindow.
It is very simple thing but I am not able to solve it.
Here below is my code:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->comboBox,&QComboBox::activated,ui->label,&QLabel::setLabelValue);
}
MainWindow::~MainWindow()
{
delete ui;
}
MainWindow::setLabelValue()
{
ui->label->text() = ui->comboBox->currentText();
}
It is not working. Will there be anyone to suggest me so that I could solve it.
Thanks in advance!