TweakLane for Qt is a C++17 library for Qt 6.5 or later (Core and Network), plus a QML module for the renderer and edit mode (Gui, Qml and Quick). It builds on Windows, macOS and Linux with CMake.
1. Install
Request access and create your app. The dashboard's setup step gets you the Qt library and the configuration for your app, with your public key filled in.
Link it with target_link_libraries(your_app PRIVATE TweakLane::TweakLane TweakLane::Quick).
TweakLane::Quick is a static QML module. Import it once in main.cpp, outside any function:
#include <tweaklane/quick/quick.h>
TWEAKLANE_IMPORT_QML
2. Register your parts and screens
Each part has a stable id, a display name, a props schema, its alternatives and a lock level. Each screen has a default document.
#include <tweaklane/core/engine.h>
using namespace tweaklane;
Catalog makeCatalog() {
Catalog catalog;
PartRegistration today;
today.displayName = "Today";
today.props = Json::object({{"properties", Json::object({{"title", "string"}})}});
today.alternatives = {"home.todayCompact"};
catalog.registerPart("home.today", today);
PartRegistration price;
price.displayName = "Plan and price";
price.lock = "required";
catalog.registerPart("plan.price", price);
catalog.screen(Json::parse(R"({"schemaVersion": 1, "screen": "home", "root": "root", "nodes": [
{"id": "root", "type": "vstack", "order": 0},
{"id": "today", "type": "component", "component": "home.today", "parent": "root", "order": 0}]})").value());
return catalog;
}
Fields, actions, user screens, the theme, navigation and history limits use the manifest's own JSON shapes:
catalog.field(...), catalog.action(...), catalog.userScreens(json), catalog.theme(json),
catalog.navigation(json) and catalog.history(json). catalog.registerGenericPieces() adds text, number, progress,
picture, button, divider and space pieces built from your fields, actions and strings.
3. Create the engine and draw a screen
auto *engine = new Engine(makeCatalog(), currentUserId,
std::make_unique<FileStore>(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)));
Controller controller(engine);
controller.setData({{"steps.today", 8432}});
QQmlApplicationEngine qml;
qml.setInitialProperties({{"controller", QVariant::fromValue(&controller)}});
qml.loadFromModule("YourApp", "Main");
Register how each part draws, then render screens with TweakScreen:
import QtQuick
import TweakLane
ApplicationWindow {
id: window
required property var controller
Component { id: todayPart; TodayCard { } }
Component.onCompleted: controller.registerPart("home.today", todayPart)
TweakScreen {
anchors.fill: parent
controller: window.controller
screen: "home"
}
}
A part's item receives part: its props, its content options (with defaults), its style, the screen's theme
values (theme.roles.text, theme.cornerScale, …), textScale, textColor, iconTint and editing. A part calls
part.controller.perform(action, params, part.screen) to run one of your actions; set engine->actionHandler to receive it.
4. Edit mode
Button { text: "Customize"; onClicked: controller.beginEditing("home") }
Edit mode draws a chip on every part and section, and the tray: undo, redo, the last change and Done; the AI prompt; then Add, Hidden, Theme, History and More. Done saves a version. Locked parts stay where the locks say, on the device and on the server.
5. Sync and AI
SyncConfiguration sync;
sync.baseURL = "{TWEAKLANE_URL}";
sync.publishableKey = "tlpk_...";
sync.tokenProvider = [](const QString &user, bool forceRefresh, TokenCallback done) {
yourBackend.tweakLaneToken(user, forceRefresh, [done](QString token) { done(token, {}); });
};
engine->connectSync(sync);
engine->enableAI({"Anthropic"});
Edits made offline queue and go out when the network is back; a screen fetched from another device appears the next time that screen opens. The token is signed by your backend with your app's signing secret; it never ships in the app.
Same model on every platform
The layout documents, manifest, validation rules and issue codes are the same as on every other SDK, and the shared fixtures pass on Qt exactly as they do there.