void Qt4ProjectConfigWidget::updateProblemLabel()
{
    m_ui->shadowBuildDirEdit->triggerChanged();
    ProjectExplorer::Kit *k = m_buildConfiguration->target()->kit();
    const QString proFileName = m_buildConfiguration->target()->project()->document()->fileName();

    // Check for Qt version:
    QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
    if (!version) {
        setProblemLabel(tr("This kit cannot build this project since it does not define a Qt version."));
        return;
    }

    Qt4Project *p = static_cast<Qt4Project *>(m_buildConfiguration->target()->project());
    if (p->rootQt4ProjectNode()->parseInProgress() || !p->rootQt4ProjectNode()->validParse()) {
        setProblemLabel(QString());
        return;
    }

    bool targetMismatch = false;
    bool incompatibleBuild = false;
    bool allGood = false;
    // we only show if we actually have a qmake and makestep
    if (m_buildConfiguration->qmakeStep() && m_buildConfiguration->makeStep()) {
        QString makefile = m_buildConfiguration->buildDirectory() + QLatin1Char('/');
        if (m_buildConfiguration->makefile().isEmpty())
            makefile.append(QLatin1String("Makefile"));
        else
            makefile.append(m_buildConfiguration->makefile());

        switch (m_buildConfiguration->compareToImportFrom(makefile)) {
        case Qt4BuildConfiguration::MakefileMatches:
            allGood = true;
            break;
        case Qt4BuildConfiguration::MakefileMissing:
            allGood = true;
            break;
        case Qt4BuildConfiguration::MakefileIncompatible:
            incompatibleBuild = true;
            break;
        case Qt4BuildConfiguration::MakefileForWrongProject:
            targetMismatch = true;
            break;
        }
    }

    QString shadowBuildWarning;
    if (!version->supportsShadowBuilds() && m_buildConfiguration->shadowBuild()) {
        shadowBuildWarning = tr("The Qt version %1 does not support shadow builds, building might fail.")
                .arg(version->displayName())
                + QLatin1String("<br>");
    }

    if (allGood) {
        QString buildDirectory = m_buildConfiguration->target()->project()->projectDirectory();;
        if (m_buildConfiguration->shadowBuild())
            buildDirectory = m_buildConfiguration->buildDirectory();
        QList<ProjectExplorer::Task> issues;
        issues = version->reportIssues(proFileName, buildDirectory);
        qSort(issues);

        if (!issues.isEmpty() || !shadowBuildWarning.isEmpty()) {
            QString text = QLatin1String("<nobr>") + shadowBuildWarning;
            foreach (const ProjectExplorer::Task &task, issues) {
                QString type;
                switch (task.type) {
                case ProjectExplorer::Task::Error:
                    type = tr("Error:");
                    type += QLatin1Char(' ');
                    break;
                case ProjectExplorer::Task::Warning:
                    type = tr("Warning:");
                    type += QLatin1Char(' ');
                    break;
                case ProjectExplorer::Task::Unknown:
                default:
                    break;
                }
                if (!text.endsWith(QLatin1String("br>")))
                    text.append(QLatin1String("<br>"));
                text.append(type + task.description);
            }
            setProblemLabel(text);
            return;
        }