< 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
 2015int qt_init(int argc) {
 2016    if (g_app != nullptr || QCoreApplication::instance() != nullptr) {
 017        return 1;
 018    }
 2019    QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
 20
 21    // Tauri's URL schemes must be registered before any GUI object exists.
 2022    qt_scheme_register_schemes();
 23
 2024    static int argc_storage = argc > 0 ? argc : 1;
 2025    static char argv0[] = "tauri-runtime-qt";
 2026    static char* argv[] = {argv0, nullptr};
 2027    g_app = new QApplication(argc_storage, argv);
 28
 2029    return 0;
 2030}
 31
 2032int qt_run() {
 2033    if (g_app == nullptr) {
 034        return 1;
 035    }
 2036    return QApplication::exec();
 2037}
 38
 039rust::String qt_version() {
 040    return rust::String(qVersion());
 041}