org.kde.qt

Class qtjava

public class qtjava extends Object

The 'Run the Qt Java library' class'. Various utility methods to manage the mapping between C++ and java instances. Used in conjunction the C++ methods in QtSupport.cpp and JavaSlot.cpp.
Field Summary
static WeakValueMapqtKeyToJavaMap
Uses a C++ key to retrieve the corresponding Java instance
static HashMapqtSignalDictionary
Allows a JavaSignal proxy instance to be retrieved for a given Java instance/Signal name combination
static HashMapqtSlotDictionary
Allows a JavaSlot proxy instance to be retrieved for a given Java instance/Slot name combination
Method Summary
static voidinitialize()
static ObjectobjectForQtKey(long qt, String className, boolean allocatedInJavaWorld)
Retrieves a corresponding Java instance for a given C++ instance.
static voidqtKeyDeleted(long qt)
When a C++ instance has been deleted.
static voidremoveObjectForQtKey(long qt)
Remove a 'C++ qt instance key/Java instance value' pair from the map.
static voidsetObjectForQtKey(Object obj, long qt)
Add a 'C++ qt instance key/Java instance value' pair to the map
static longsignalForSender(long qt, String signal)
Looks up a 'qt instance/signal name' key and returns the corresponding JavaSignal instance
static longslotForReceiver(long qt, QObject receiver, String slot)
Looks up a 'qt instance/slot name' key and returns the corresponding JavaSlot instance
static StringtoFullyQualifiedClassName(String className)
Converts any unqualified class names in a signal or slot string to the fully qualified versions

Field Detail

qtKeyToJavaMap

public static WeakValueMap qtKeyToJavaMap
Uses a C++ key to retrieve the corresponding Java instance

qtSignalDictionary

public static HashMap qtSignalDictionary
Allows a JavaSignal proxy instance to be retrieved for a given Java instance/Signal name combination

qtSlotDictionary

public static HashMap qtSlotDictionary
Allows a JavaSlot proxy instance to be retrieved for a given Java instance/Slot name combination

Method Detail

initialize

public static void initialize()

objectForQtKey

public static Object objectForQtKey(long qt, String className, boolean allocatedInJavaWorld)
Retrieves a corresponding Java instance for a given C++ instance. Allocates the Java instance if it doesn't already exist.

qtKeyDeleted

public static void qtKeyDeleted(long qt)
When a C++ instance has been deleted. Retrieves a corresponding Java instance for a given C++ instance. Sets the '_allocatedInJavaWorld' flag to false.

removeObjectForQtKey

public static void removeObjectForQtKey(long qt)
Remove a 'C++ qt instance key/Java instance value' pair from the map. Normally an entry would be removed when its map value is the last reference left to the java instance, and it becomes a weak reference to be reaped. But C++ can reuse a heap address for a C++ ref without giving the java runtime a chance to do any garbage collection and tidy up the corresponding entry in the qtKeyToJavaMap (tricky!). So it is useful to be able to force the early removal of an entry, when the C++ instance has a known lifetime (eg a QEvent after its event handler has returned).

setObjectForQtKey

public static void setObjectForQtKey(Object obj, long qt)
Add a 'C++ qt instance key/Java instance value' pair to the map

signalForSender

public static long signalForSender(long qt, String signal)
Looks up a 'qt instance/signal name' key and returns the corresponding JavaSignal instance

slotForReceiver

public static long slotForReceiver(long qt, QObject receiver, String slot)
Looks up a 'qt instance/slot name' key and returns the corresponding JavaSlot instance

toFullyQualifiedClassName

public static String toFullyQualifiedClassName(String className)
Converts any unqualified class names in a signal or slot string to the fully qualified versions