diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp index fe8ede93b67..4564e8a6865 100644 --- a/src/plugins/python/pythonrunconfiguration.cpp +++ b/src/plugins/python/pythonrunconfiguration.cpp @@ -186,7 +186,7 @@ void InterpreterAspect::addToLayout(LayoutBuilder &builder) m_comboBox = new QComboBox; updateComboBox(); - connect(m_comboBox, &QComboBox::currentTextChanged, + connect(m_comboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &InterpreterAspect::updateCurrentInterpreter); auto manageButton = new QPushButton(tr("Manage...")); @@ -199,8 +199,12 @@ void InterpreterAspect::addToLayout(LayoutBuilder &builder) void InterpreterAspect::updateCurrentInterpreter() { - m_currentId = currentInterpreter().id; - m_comboBox->setToolTip(currentInterpreter().command.toUserOutput()); + const int index = m_comboBox->currentIndex(); + if (index < 0) + return; + QTC_ASSERT(index < m_interpreters.size(), return); + m_currentId = m_interpreters[index].id; + m_comboBox->setToolTip(m_interpreters[index].command.toUserOutput()); emit changed(); }