< Summary

Information
Class: /home/runner/work/TauriQt/TauriQt/tauri-runtime-qt/src/qt_app.cpp
Assembly: Default
File(s): /home/runner/work/TauriQt/TauriQt/tauri-runtime-qt/src/qt_app.cpp
Line coverage
66%
Covered lines: 14
Uncovered lines: 7
Coverable lines: 21
Total lines: 41
Line coverage: 66.6%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

File(s)

/home/runner/work/TauriQt/TauriQt/tauri-runtime-qt/src/qt_app.cpp

#LineLine coverage
 1// SPDX-FileCopyrightText: 2026 Alper Çelik
 2// SPDX-License-Identifier: MIT OR Apache-2.0
 3
 4#include "qt_app.hpp"
 5#include "qt_scheme.hpp"
 6
 7#include <QtCore/QCoreApplication>
 8#include <QtCore/QString>
 9#include <QtWidgets/QApplication>
 10
 11namespace {
 12QApplication* g_app = nullptr;
 13}
 14
 2115int qt_init(int argc) {
 2116    if (g_app != nullptr || QCoreApplication::instance() != nullptr) {
 017        return 1;
 018    }
 2119    QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
 20
 21    // Tauri's URL schemes must be registered before any GUI object exists.
 2122    qt_scheme_register_schemes();
 23
 2124    static int argc_storage = argc > 0 ? argc : 1;
 2125    static char argv0[] = "tauri-runtime-qt";
 2126    static char* argv[] = {argv0, nullptr};
 2127    g_app = new QApplication(argc_storage, argv);
 28
 2129    return 0;
 2130}
 31
 2132int qt_run() {
 2133    if (g_app == nullptr) {
 034        return 1;
 035    }
 2136    return QApplication::exec();
 2137}
 38
 039rust::String qt_version() {
 040    return rust::String(qVersion());
 041}