< Summary

Information
Class: /home/runner/work/TauriQt/TauriQt/tauri-runtime-qt/src/bridge/window.rs
Assembly: Default
File(s): /home/runner/work/TauriQt/TauriQt/tauri-runtime-qt/src/bridge/window.rs
Line coverage
47%
Covered lines: 26
Uncovered lines: 29
Coverable lines: 55
Total lines: 114
Line coverage: 47.2%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

File(s)

/home/runner/work/TauriQt/TauriQt/tauri-runtime-qt/src/bridge/window.rs

#LineLine coverage
 1// SPDX-FileCopyrightText: 2026 Alper Çelik
 2// SPDX-License-Identifier: MIT OR Apache-2.0
 3
 4//! Window declarations (owned by the window worker).
 5//!
 6//! C++ translation units include the cxx-generated header for this bridge:
 7//! `#include "tauri-runtime-qt/src/bridge/window.rs.h"`.
 8
 9#[cxx::bridge]
 10pub mod ffi {
 11    /// A size in Qt device-independent ("logical") pixels.
 12    struct QtWindowSize {
 13        width: f64,
 14        height: f64,
 15    }
 16
 17    /// A point in Qt device-independent ("logical") pixels.
 18    struct QtWindowPoint {
 19        x: f64,
 20        y: f64,
 21    }
 22
 23    unsafe extern "C++" {
 24        include!("qt_window.hpp");
 25
 26        // ---- windows (qt_window.cpp) ----
 2127        fn qt_window_create(
 2128            label: &str,
 2129            title: &str,
 2130            width: i32,
 2131            height: i32,
 2132            visible: bool,
 2133            decorations: bool,
 2134        ) -> u64;
 035        fn qt_window_show(id: u64);
 036        fn qt_window_hide(id: u64);
 037        fn qt_window_close(id: u64);
 2138        fn qt_window_set_title(id: u64, title: &str);
 039        fn qt_window_set_size(id: u64, width: i32, height: i32);
 040        fn qt_window_center(id: u64);
 041        fn qt_window_set_decorations(id: u64, decorations: bool);
 042        fn qt_window_set_maximized(id: u64, maximized: bool);
 4243        fn qt_window_is_visible(id: u64) -> bool;
 21044        fn qt_window_scale_factor(id: u64) -> f64;
 045        fn qt_window_winid(id: u64) -> u64;
 2146        fn qt_window_attach_webview(window_id: u64, webview_native_id: u64);
 47
 48        // ---- window worker: registry and platform ----
 49        /// Whether `id` names a live window in the C++ registry. Rust answers
 50        /// `Error::WindowNotFound` when it does not, instead of guessing.
 54651        fn qt_window_alive(id: u64) -> bool;
 52
 53        /// Name of the Qt platform plugin in use (e.g. `"xcb"`, `"wayland"`).
 054        fn qt_window_platform() -> String;
 55
 56        // ---- geometry (Qt logical pixels; Rust applies the scale factor) ----
 57        /// Client area size (`QWidget::size()`).
 4258        fn qt_window_inner_size(id: u64) -> QtWindowSize;
 59        /// Frame size including window manager decorations
 60        /// (`QWidget::frameGeometry()`).
 4261        fn qt_window_outer_size(id: u64) -> QtWindowSize;
 62        /// Client area origin on the desktop (`QWidget::mapToGlobal(0, 0)`).
 4263        fn qt_window_inner_position(id: u64) -> QtWindowPoint;
 64        /// Frame origin on the desktop (`QWidget::frameGeometry().topLeft()`).
 4265        fn qt_window_outer_position(id: u64) -> QtWindowPoint;
 66
 67        // ---- state ----
 4268        fn qt_window_title(id: u64) -> String;
 69        /// `QStyleHints::colorScheme()`: 1 = light, 2 = dark, 0 = unknown.
 070        fn qt_window_theme(id: u64) -> i32;
 4271        fn qt_window_is_fullscreen(id: u64) -> bool;
 4272        fn qt_window_is_minimized(id: u64) -> bool;
 4273        fn qt_window_is_maximized(id: u64) -> bool;
 4274        fn qt_window_is_focused(id: u64) -> bool;
 4275        fn qt_window_is_decorated(id: u64) -> bool;
 4276        fn qt_window_is_resizable(id: u64) -> bool;
 077        fn qt_window_is_enabled(id: u64) -> bool;
 4278        fn qt_window_is_always_on_top(id: u64) -> bool;
 79        /// Qt's `WindowMaximizeButtonHint` / `WindowMinimizeButtonHint` /
 80        /// `WindowCloseButtonHint` bits (the hints handed to the window
 81        /// manager; Qt offers no per-button state beyond them).
 082        fn qt_window_is_maximizable(id: u64) -> bool;
 083        fn qt_window_is_minimizable(id: u64) -> bool;
 084        fn qt_window_is_closable(id: u64) -> bool;
 85
 86        // ---- setters ----
 4287        fn qt_window_set_fullscreen(id: u64, fullscreen: bool);
 088        fn qt_window_minimize(id: u64);
 089        fn qt_window_unminimize(id: u64);
 90        /// Qt logical pixels; `0` / `QWIDGETSIZE_MAX` mean "no min/max".
 091        fn qt_window_set_min_size(id: u64, width: f64, height: f64);
 092        fn qt_window_set_max_size(id: u64, width: f64, height: f64);
 93        /// Takes the icon's straight RGBA8888 bytes. Returns false when the
 94        /// buffer does not match `width * height * 4` (Rust pre-validates too).
 095        fn qt_window_set_icon(id: u64, rgba: &[u8], width: u32, height: u32) -> bool;
 096        fn qt_window_set_focus(id: u64);
 097        fn qt_window_set_resizable(id: u64, resizable: bool);
 098        fn qt_window_set_enabled(id: u64, enabled: bool);
 099        fn qt_window_set_always_on_top(id: u64, on_top: bool);
 0100        fn qt_window_set_always_on_bottom(id: u64, on_bottom: bool);
 0101        fn qt_window_set_background_color(id: u64, r: u8, g: u8, b: u8, a: u8);
 102        /// Restores the application palette (tauri's `None` background).
 0103        fn qt_window_reset_background_color(id: u64);
 104        /// Moves the frame origin (X11 only; Rust rejects other platforms).
 0105        fn qt_window_set_position(id: u64, x: i32, y: i32);
 106        /// Returns false when Qt cannot start the system move (no native
 107        /// window handle, or not called from a mouse press/release handler).
 0108        fn qt_window_start_dragging(id: u64) -> bool;
 109        /// `direction` is tauri's `ResizeDirection` number (1..8, as mapped by
 110        /// `lib.rs`); Qt maps it to `Qt::Edges`. Returns false when Qt cannot
 111        /// start the system resize or the direction is unknown.
 0112        fn qt_window_start_resize_dragging(id: u64, direction: i32) -> bool;
 113    }
 114}

Methods/Properties

_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi16qt_window_create
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi14qt_window_show
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi14qt_window_hide
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi15qt_window_close
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi19qt_window_set_title
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi18qt_window_set_size
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi16qt_window_center
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi25qt_window_set_decorations
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi23qt_window_set_maximized
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi20qt_window_is_visible
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi22qt_window_scale_factor
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi15qt_window_winid
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi24qt_window_attach_webview
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi15qt_window_alive
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi18qt_window_platform
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi20qt_window_inner_size
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi20qt_window_outer_size
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi24qt_window_inner_position
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi24qt_window_outer_position
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi15qt_window_title
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi15qt_window_theme
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi23qt_window_is_fullscreen
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi22qt_window_is_minimized
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi22qt_window_is_maximized
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi20qt_window_is_focused
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi22qt_window_is_decorated
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi22qt_window_is_resizable
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi20qt_window_is_enabled
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi26qt_window_is_always_on_top
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi24qt_window_is_maximizable
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi24qt_window_is_minimizable
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi21qt_window_is_closable
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi24qt_window_set_fullscreen
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi18qt_window_minimize
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi20qt_window_unminimize
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi22qt_window_set_min_size
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi22qt_window_set_max_size
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi18qt_window_set_icon
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi19qt_window_set_focus
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi23qt_window_set_resizable
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi21qt_window_set_enabled
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi27qt_window_set_always_on_top
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi30qt_window_set_always_on_bottom
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi30qt_window_set_background_color
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi32qt_window_reset_background_color
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi22qt_window_set_position
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi24qt_window_start_dragging
_RNvNtNtNtCsdgr7Em4UC3i_16tauri_runtime_qt6bridge6window3ffi31qt_window_start_resize_dragging