Better_Software_Header_MobileBetter_Software_Header_Web

Find what you need - explore our website and developer resources

VS Code for Qt Applications - Part 3

A Technical Guide

{
    "code-runner.executorMap": {
        "cpp": "cd $dir; g++ $fileName -o $fileNameWithoutExt; ./$fileNameWithoutExt"
    }
}
{
    "code-runner.executorMapByFileExtension": {
        ".cpp": "cd $dir; g++ $fileName -o $fileNameWithoutExt; ./$fileNameWithoutExt"
    }
}
{
    "code-runner.executorMapByGlob": {
        "*.cpp": "cd $dir; g++ $fileName -o $fileNameWithoutExt; ./$fileNameWithoutExt"
   }
}
{
    "code-runner.executorMapByFileExtension": {
        ".cpp": "echo I am a cpp file!"
    }
}
{
    "code-runner.executorMapByFileExtension": {
         ".cpp": "echo I am a cpp file!"
    },
    "code-runner.executorMap": {
         "cpp": null
    }
}
{
    "code-runner.executorMapByFileExtension": {
        ".cpp": "echo I am a cpp file!"
    }
}
> I am a cpp file! /full/path/to/your/cpp/file.cpp
{
    "terminal.integrated.env.windows": {
         "PATH": "${env:PATH};C:/Program Files/LLVM/bin"
    }
}
{
    "code-runner.runInTerminal": true
}
{
    "code-runner.executorMapByFileExtension": {
        ".qml": "qmlscene"
    }
}
{
    "code-runner.runInTerminal": true,
    "terminal.integrated.env.windows": {
        "QML2_IMPORT_PATH": "path/to/extra/qml/plugins"
    }
}
{
    "code-runner.executorMapByFileExtension": {
        ".qrc": "qtcreator -client",
        ".ui": "qtcreator -client"
    }
}
{
    "name": "Launch app with GammaRay",
    "type": "cppvsdbg",
    "request": "launch",
    "program": "GammaRay",
    "args": ["path/to/our/app", "appArg1", "appArg2", ...],
    "console": "internalConsole",
     "cwd": "${workspaceFolder}"
}
{
    "name": "Launch current CMake target with GammaRay",
    "type": "cppvsdbg",
    "request": "launch",
    "program": "GammaRay",
    "args": ["${command:cmake.launchTargetPath}"],
    "console": "internalConsole",
    "cwd": "${workspaceFolder}"
}
{
    "name": "Profile application with qmlprofile",
    "type": "cppvsdbg",
    "request": "launch",
    "program": "qmlprofiler",
    "args": ["-o", "your/favourite/output/dir/qmlprofiler.qtd", "path/to/your/app"],
}
{
    "name": "Profile current CMake target with qmlprofile",
    "type": "cppvsdbg",
    "request": "launch",
    "program": "qmlprofiler",
    "args": ["-o", "your/favourite/output/dir/qmlprofiler.qtd", "${command:cmake.launchTargetPath}"],
}
{
    "files.associations": {
        "*.moc": "cpp",
        "*.qrc": "xml",
        "*.ui": "xml"
    }
}

About KDAB


AlessandorAmbrosano

Alessandro Ambrosano

Senior Software Engineer

Learn Modern C++

Learn more