KirigamiAppDefaults Namespace

Contains a function to apply useful default Qt options for Kirigami apps. More...

Header: #include <KirigamiAppDefaults>
CMake: find_package(KF6 REQUIRED COMPONENTS KirigamiAddons)
target_link_libraries(mytarget PRIVATE KF6::KirigamiAddons)

Functions

void apply(QGuiApplication *app)

Detailed Description

Function Documentation

void KirigamiAppDefaults::apply(QGuiApplication *app)

Helper to apply suitable defaults for an app using Kirigami

Kirigami apps are generally Qt apps using Kirigami. Qt's defaults and fallbacks on different platforms don't fit these apps very well. This function sets up the default style to Breeze, sets up support for color schemes, sets the Breeze icon theme, sets a font size and configures logging and crash handling.

Your normal main function should look something like

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    KirigamiAppDefaults::apply(&app);

    // Set up KAboutData

    // QCommandLineParser creation and processing

    QQmlApplicationEngine engine;
    KLocalization::setupLocalizedContext(&engine);
    engine.loadFromModule("org.kde.myapp", u"Main");

    if (!engine.rootObjects().isEmpty()) {
        return -1;
    }
    return app.exec();
}