A slot connected to QCombox::currentIndexChanged signal does not get triggered

73 Views Asked by At

Qt version: 5.6.

connect(ui.m_projectList, SIGNAL(currentlndexChanged(const QString&)), this, SLOT(OnProjectListChange(const QString&)));
void RunTestUI::OnProjectListChange(const QString& _p)
{
    QString project = ui.m_projectList->currentText();
    std::wstring clientPath = GetRunClientPath();
    std::wstring projectConfigPath = FilePath::Combine(clientPath, L"ServerConfig-" + project.toStdWString() + L".json");
    std::wstring destConfigPath = FilePath::Combine(clientPath, L"ServerConfig.json");
    FileUtility::CopyFileW(projectConfigPath, destConfigPath);
}

ui.m_projectList is a QComboBox, OnProjectListChange is the slot, but it does not get triggered when m_projectList is changed.

I tried the following code, but still failed:

connect(ui.m_projectList, SIGNAL(currentlndexChanged(int)), this, SLOT(OnProjectListChange()));
0

There are 0 best solutions below