Home

Qt_Ada.Generic_Object_Pointers

The package Qt_Ada.Generic_Object_Pointers is a generic package that provides guarded pointers to QObject and its subclasses. Its value automatically set to null when the referenced object is destroyed. This is near an equivalent of the QPointer template class.

generic
   type Object_Type (<>) is
     abstract limited new Qt4.Objects.Q_Object with private;
   type Object_Access is access all Object_Type'Class;

package Qt_Ada.Generic_Object_Pointers is

   type Q_Pointer is tagged private;

   function Is_Null (Self : in Q_Pointer) return Boolean;

   function Get (Self : in Q_Pointer) return Object_Access;

   procedure Set (Self : in out Q_Pointer; To : in Object_Access);

   function "=" (Left : in Q_Pointer; Right : in Object_Access) return Boolean;

   function "=" (Left : in Object_Access; Right : in Q_Pointer) return Boolean;

private

end Qt_Ada.Generic_Object_Pointers;

The function Is_Null returns True if the referenced object has been destroyed or if there is no referenced object; otherwize returns False.

The function Get returns referenced object.

The procedure Set sets the new referenced object.

The functions "=" returns True if left and right arguments points to the same referenced object.


QtAda 2.1