taking into account that I have a static VALUE which is already defined in a header file (that contains other defined static values) as follow:

#defined VALUE  2

I would like to update the VALUE by passing the text taken from a QComboBox to the #defined in mainwindow.cpp, so, I am using the following line:

#defined VALUE ui->QComboBoc->currentText();

but is not working, what exactly I did wrong ?

有帮助吗?

解决方案

I suggest you learn about the C++ preprocessor, VALUE is fixed at compile time. You will have to replace it with a global static variable, or even better fix your architecture.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top