Search code examples
c++qtqcomboboxdefined

how to pass #defined VALUE from QComboBox


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 ?


Solution

  • 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.