[personal profile] kakadu
Now I have problems with implementing inheritance in lablqt. The problem is in abstract (in terms of C++) classes. If I make for every abstract in C++ class virtual OCaml class, then I can't wrap methods which uses this abstract class as a parameter. For example, this is a part of code


//void paintEvent(QPaintEvent* e) declared in QAbstractButton
void paintEvent(QPaintEvent* arg0) {
  CAMLparam0();
  ::CAMLlocal2(camlobj,meth);
  printf("Calling QAbstractButton::paintEvent of object = %p\n",this);
  GET_CAML_OBJECT(this,the_caml_object)
  camlobj = (::value) the_caml_object;
  meth = caml_get_public_method( camlobj, caml_hash_variant("paintEvent"));
  assert(meth!=0);
  ::value *args = new ::value[2]; // TODO: use CAMLlocalN macros
  args[0] = camlobj;
    setAbstrClass< QPaintEvent>(args[1],arg0);
    ::value *call_helper=caml_named_value("make_QPaintEvent"); // look at this line.
    assert(call_helper != 0);
    args[1]=caml_callback(*call_helper,args[1]); }
  // delete args or not?
  caml_callbackN(meth, 2, args);;
  CAMLreturn0;
}

In OCaml this method has sugnature
method paintEvent : qPaintEvent -> unit
and I should construct OCaml class and send it as 1st arguments of method paintEvent. Hence, I should have access to constructor values from C++.
Now we can formulate a problem: how to implement methods, where one of the arguments is virtual class in OCaml?

Profile

kakadu

December 2011

S M T W T F S
    123
456789 10
11121314151617
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 22nd, 2025 08:41 am
Powered by Dreamwidth Studios