Module qtjambi
Package io.qt

Class QtUtilities

java.lang.Object
io.qt.QtUtilities

public final class QtUtilities extends Object
This class contains static members that gives information and performs QtJambi related tasks.
  • Method Details

    • isAvailableQtLibrary

      public static boolean isAvailableQtLibrary(String library)
    • isAvailableUtilityLibrary

      public static boolean isAvailableUtilityLibrary(String library)
    • isAvailableUtilityLibrary

      public static boolean isAvailableUtilityLibrary(String library, String versionString)
    • loadQtLibrary

      public static void loadQtLibrary(String library)
    • loadQtLibrary

      public static void loadQtLibrary(String library, QtUtilities.LibraryRequirementMode mode, String ... platforms)
    • loadUtilityLibrary

      public static void loadUtilityLibrary(String library)
    • loadUtilityLibrary

      public static void loadUtilityLibrary(String library, QtUtilities.LibraryRequirementMode mode, String ... platforms)
    • loadUtilityLibrary

      public static void loadUtilityLibrary(String library, String version)
    • loadUtilityLibrary

      public static void loadUtilityLibrary(String library, String version, QtUtilities.LibraryRequirementMode mode, String ... platforms)
    • loadQtJambiLibrary

      public static void loadQtJambiLibrary(String library)
    • loadJambiLibrary

      public static void loadJambiLibrary(String library)
    • loadLibrary

      public static void loadLibrary(String lib)
    • useAsGadget

      public static void useAsGadget(Class<?> clazz)
      Use a class (e.g. from third party library) as gadget.
      See Also:
    • usePackageContentAsGadgets

      public static void usePackageContentAsGadgets(String _package)
      Define a package (e.g. from third party library) to let all its classes considered to be gadgets.
      See Also:
    • jambiDeploymentDir

      public static File jambiDeploymentDir()
    • jambiTempDir

      @Deprecated(forRemoval=true) public static File jambiTempDir()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
    • initializePackage

      public static boolean initializePackage(String packagePath)
    • initializePackage

      public static boolean initializePackage(Package pkg)
    • initializePackage

      public static boolean initializePackage(Class<?> cls)
    • getSignalOnDispose

      public static QMetaObject.DisposedSignal getSignalOnDispose(QtObjectInterface object)
    • initializeNativeObject

      public static void initializeNativeObject(QtObjectInterface object)
    • initializeNativeObject

      public static void initializeNativeObject(QtObjectInterface object, QtArgument.Stream arguments)
    • putenv

      public static boolean putenv(String varName, String value)
      This function sets the value of the environment variable named varName.
      Parameters:
      varName -
      value -
    • unsetenv

      public static boolean unsetenv(String varName)
      This function deletes the variable varName from the environment.
      Parameters:
      varName -
    • getenv

      public static String getenv(String varName)
      This function gets the value of the environment variable named varName.
      Parameters:
      varName -
      Returns:
      value
    • reinstallEventNotifyCallback

      public static boolean reinstallEventNotifyCallback()
      This method allows to reinstall the QtJambi event notify callback as the last callback. If other libraries register their event notify callback to Qt, it is necessary to make sure QtJambi's callback is called at last. This method can only be called from inside the main thread and before calling QCoreApplication.exec().
    • saveUnixSignalHandlers

      public static boolean saveUnixSignalHandlers()
      Third-party libraries must not overwrite Java's installed signal handlers. Several of these signal handlers are crucial for JVM to work. This method saves the installed signal handlers for later restoring by restoreUnixSignalHandlers().
    • restoreUnixSignalHandlers

      public static boolean restoreUnixSignalHandlers()
      Third-party libraries must not overwrite Java's installed signal handlers. Several of these signal handlers are crucial for JVM to work. This method restores the signal handlers previously saved by saveUnixSignalHandlers().
    • qtjambiVersion

      public static QVersionNumber qtjambiVersion()
      Return the version of QtJambi
      Returns:
      qtjambi version
    • uiThreadCheck

      public static void uiThreadCheck() throws QThreadAffinityException
      Checks if the current thread is UI thread and throws QThreadAffinityException otherwise.
      Throws:
      QThreadAffinityException
    • threadCheck

      public static void threadCheck(QObject object) throws QThreadAffinityException
      Checks if the current thread is the given object's thread and throws QThreadAffinityException otherwise.
      Throws:
      QThreadAffinityException
    • asSelectiveEventFilter

      @Deprecated(since="6.8.1", forRemoval=true) public static QObject asSelectiveEventFilter(QObject eventFilter, QEvent.Type eventType, QEvent.Type ... eventTypes)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setDanglingPointerCheckEnabled

      public static void setDanglingPointerCheckEnabled(boolean enabled)
      Enables or disables the dangling pointer checks at runtime.

      CAUTION: This function is experimental and may have unexpected behavior.

      Parameters:
      enabled -
    • setThreadAffinityCheckEnabled

      public static void setThreadAffinityCheckEnabled(boolean enabled)

      Enables or disables the thread affinity checks at runtime.

      This function is not thread-safe, i.e. calling this method parallel to usage of Qtjambi's API in other threads may lead to crash.

      CAUTION: This function is experimental and may have unexpected behavior.

      Parameters:
      enabled -
    • setEventThreadAffinityCheckEnabled

      public static void setEventThreadAffinityCheckEnabled(boolean enabled)

      Enables or disables the thread affinity checks on events at runtime.

      This function is not thread-safe, i.e. calling this method parallel to running event loops in other threads may lead to crash.

      CAUTION: This function is experimental and may have unexpected behavior.

      Parameters:
      enabled -
    • setMethodLogsEnabled

      public static void setMethodLogsEnabled(boolean enabled)
      Enables or disables method logs at runtime.

      CAUTION: This function is experimental and may have unexpected behavior.

      Parameters:
      enabled -
    • setEventLogsEnabled

      public static void setEventLogsEnabled(boolean enabled)
      Enables or disables event logs checks at runtime.

      CAUTION: This function is experimental and may have unexpected behavior.

      Parameters:
      enabled -
    • setSignalEmitThreadCheckEnabled

      public static void setSignalEmitThreadCheckEnabled(boolean enabled)
      Enables or disables thread checks at signal emit.

      CAUTION: This function is experimental and may have unexpected behavior.

      Parameters:
      enabled -
    • installSignalEmitThreadCheckHandler

      public static void installSignalEmitThreadCheckHandler(BiConsumer<QObject,QMetaObject.AbstractSignal> handler)
      Install a handler for signal emit thread checks. The handler is executed every time an event is emitted from a thread different than the object's thread. The handler may throw QThreadAffinityException if necessary. Call this method with to remove the installed handler.
      Parameters:
      handler -
    • setNoExceptionForwardingFromMetaCallsEnabled

      public static void setNoExceptionForwardingFromMetaCallsEnabled(boolean enabled)
      Specify `true` to avoid `QMetaObject` calls (like method invocation and property access) forwarding exceptions to the Qt caller in any case.

      CAUTION: This function is experimental and may have unexpected behavior.

      Parameters:
      enabled -
    • setNoExceptionForwardingFromVirtualCallsEnabled

      public static void setNoExceptionForwardingFromVirtualCallsEnabled(boolean enabled)
      Specify `true` to avoid virtual calls (i.e. Java overrides) forwarding exceptions to the Qt caller in any case.

      CAUTION: This function is experimental and may have unexpected behavior.

      Parameters:
      enabled -