Qt Creator 不会自动完成和着色代码

Qt Creator does not autocomplete and colorize the code

我在使用 Qt 时遇到问题。我正在 Qt Creator 中编写 C++ 代码,但它不会自动完成和着色我的一些函数。

这是我的代码示例:

void Form::hide_button(){
    this->ui->pushButton_10->hide();
}

void Form::on_pushButton_clicked()
{
    if(push_button_error() == 0){
        if(this->ui->comboBox_6->currentText() == "Evet"){
            open_garph_dialog();
        }
        else{
        }
    }
}

例如,它自动完成了 on_pushButton_clicked() 功能,但没有完成其他功能并为其着色。这两个函数都在头文件中定义。

你知道为什么会这样吗?

各种老的Qt Creator版本都有这个问题。您可以通过以下步骤修复它。

  1. 转到帮助
  2. select About_Plugins
  3. 更改 ClangCodeModel(设置或重置)
  4. 检查

编辑器中的代码更新有时会卡住,您可以按照以下步骤修复。

  1. 转到工具
  2. select About_Plugins
  3. 点击 Reset_Code_Model