Configure vscode + Update flake.lock

This commit is contained in:
Florian RICHER 2025-06-09 22:54:06 +02:00
parent d783d9302e
commit 33e95af983
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
9 changed files with 114 additions and 42 deletions

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
.vscode
build/ build/
.cache/ .cache/
.direnv/ .direnv/

14
.vscode/c_cpp_properties.json vendored Normal file
View file

@ -0,0 +1,14 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"intelliSenseMode": "${default}",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}

9
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,9 @@
{
"recommendations": [
"ms-vscode.cpptools-extension-pack",
"llvm-vs-code-extensions.vscode-clangd",
"theqtcompany.qt",
"knv.qt6renderer",
"deerawan.vscode-dash",
]
}

15
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/src/tutorial_kirigami2",
"args": [],
"preLaunchTask": "CMake: build",
"cwd": "${workspaceFolder}",
"environment": [],
}
]
}

10
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,10 @@
{
"cmake.generator": "Ninja",
"cmake.configureSettings": {
"CMAKE_EXPORT_COMPILE_COMMANDS:BOOL": "ON",
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"QT_MAJOR_VERSION": "6"
},
"cmake.buildDirectory": "${workspaceFolder}/build",
"C_Cpp.intelliSenseEngine": "disabled",
}

19
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "CMake: build",
"type": "cmake",
"command": "build",
"group": "build",
"problemMatcher": [],
"detail": "CMake build"
},
{
"label": "CMake: clean",
"type": "cmake",
"command": "clean",
"group": "build",
}
]
}

12
flake.lock generated
View file

@ -5,11 +5,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1731533236,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1719436386, "lastModified": 1749401433,
"narHash": "sha256-NBGYaic5FLRg8AWSj6yr4g2IlMPUxNCVjRK6+RNuQBc=", "narHash": "sha256-HXIQzULIG/MEUW2Q/Ss47oE3QrjxvpUX7gUl4Xp6lnc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c66e984bda09e7230ea7b364e677c5ba4f0d36d0", "rev": "08fcb0dcb59df0344652b38ea6326a2d8271baff",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -14,23 +14,30 @@
{ {
devShells = rec { devShells = rec {
default = pkgs.mkShell { default = pkgs.mkShell {
buildInputs = [ packages = with pkgs; [
pkgs.kdePackages.qtbase kdePackages.qtbase
pkgs.kdePackages.kirigami kdePackages.kirigami
pkgs.kdePackages.ki18n kdePackages.ki18n
pkgs.kdePackages.kcoreaddons kdePackages.kcoreaddons
pkgs.ninja ninja
pkgs.cmake cmake
pkgs.gcc gcc
# Not required at compile time # Not required at compile time
pkgs.gammaray gammaray
pkgs.gdb # Required for gammaray gdb # Required for gammaray
pkgs.lldb # Required for gammaray lldb # Required for gammaray
# For translation generation
ruby
]; ];
dontFixCmake = true; dontFixCmake = true;
cmakeFlags = ["-DQT_MAJOR_VERSION=6"]; cmakeFlags = [
"-DQT_MAJOR_VERSION=6"
"-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON"
"-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo"
];
}; };
}; };
}); });

View file

@ -1,34 +1,33 @@
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QtQml>
#include <QUrl>
#include <QQuickStyle>
#include <KLocalizedContext> #include <KLocalizedContext>
#include <KLocalizedString> #include <KLocalizedString>
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQuickStyle>
#include <QUrl>
#include <QtQml>
#include <qcoreapplication.h> #include <qcoreapplication.h>
#include <qstringliteral.h> #include <qstringliteral.h>
int main(int argc, char *argv[]) int main(int argc, char *argv[]) {
{ QApplication app(argc, argv);
QApplication app(argc, argv); KLocalizedString::setApplicationDomain("helloworld");
KLocalizedString::setApplicationDomain("helloworld"); QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
QCoreApplication::setOrganizationName(QStringLiteral("KDE")); QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org")); QCoreApplication::setApplicationName(QStringLiteral("Hello World"));
QCoreApplication::setApplicationName(QStringLiteral("Hello World")); QCoreApplication::setApplicationVersion(QStringLiteral("0.1.0"));
QCoreApplication::setApplicationVersion(QStringLiteral("0.1.0"));
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) { if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop")); QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
} }
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty()) { if (engine.rootObjects().isEmpty()) {
return -1; return -1;
} }
return app.exec(); return app.exec();
} }