qtrs 0.4.1

qtrs - A type-safe, builder-pattern-driven Qt6 GUI library for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
// src/cpp/thread.h

#pragma once
#include <QtCore/QThread>
#include <QtCore/QCoreApplication>

/// Returns true if the current thread is the GUI (main) thread
inline bool QObject_isInGuiThread() {
    if (!QCoreApplication::instance()) {
        return true;  // No QApplication yet, assume main thread
    }
    return QThread::currentThread() == QCoreApplication::instance()->thread();
}