In QGIS3 I would like to get the current form-value of a ComboBox, that is within a QGroupBox (in the form).

I would like to get that value by using PyQt5.

Has anybody an idea?

  • Hi Kai, can you add a little bit more context what you will be using the value for. This will help to give you an appropriate answer. Thank you. – Matthias Kuhn May 28 '19 at 10:37
  • Hi Matthias, thank you very much. I found a solution just 1 minute before. I will poste it soon... – Kai Behncke May 28 '19 at 10:50

Ok, I got it. Be careful, that you don't try get the ComboBox of your form by an alias you set before.

Without the alias it works:

meineComboBOX = myDialog.findChild(QComboBox, "ID_UTILISATION")

and then e.g. meineComboBOX.currentData() or meineComboBOX.currentText().

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.