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 WeakValueMap | qtKeyToJavaMap Uses a C++ key to retrieve the corresponding Java instance |
static HashMap | qtSignalDictionary Allows a JavaSignal proxy instance to be retrieved for a given Java
instance/Signal name combination |
static HashMap | qtSlotDictionary Allows a JavaSlot proxy instance to be retrieved for a given Java
instance/Slot name combination |
Method Summary |
static void | initialize() |
static Object | objectForQtKey(long qt, String className, boolean allocatedInJavaWorld) Retrieves a corresponding Java instance for a given C++ instance. |
static void | qtKeyDeleted(long qt) When a C++ instance has been deleted. |
static void | removeObjectForQtKey(long qt) Remove a 'C++ qt instance key/Java instance value' pair from the map.
|
static void | setObjectForQtKey(Object obj, long qt) Add a 'C++ qt instance key/Java instance value' pair to the map |
static long | signalForSender(long qt, String signal) Looks up a 'qt instance/signal name' key and returns the corresponding
JavaSignal instance |
static long | slotForReceiver(long qt, QObject receiver, String slot) Looks up a 'qt instance/slot name' key and returns the corresponding
JavaSlot instance |
static String | toFullyQualifiedClassName(String className) Converts any unqualified class names in a signal or slot string to the fully qualified versions |
Uses a C++ key to retrieve the corresponding Java instance
public static HashMap qtSignalDictionary
Allows a JavaSignal proxy instance to be retrieved for a given Java
instance/Signal name combination
public static HashMap qtSlotDictionary
Allows a JavaSlot proxy instance to be retrieved for a given Java
instance/Slot name combination
public static void initialize()
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.
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.
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).
public static void setObjectForQtKey(Object obj, long qt)
Add a 'C++ qt instance key/Java instance value' pair to the map
public static long signalForSender(long qt, String signal)
Looks up a 'qt instance/signal name' key and returns the corresponding
JavaSignal instance
public static long slotForReceiver(long qt,
QObject receiver, String slot)
Looks up a 'qt instance/slot name' key and returns the corresponding
JavaSlot instance
public static String toFullyQualifiedClassName(String className)
Converts any unqualified class names in a signal or slot string to the fully qualified versions