D2 GUI Libs

Eldar Insafutdinov e.insafutdinov at gmail.com
Sun Dec 13 06:04:04 PST 2009


Andrei Alexandrescu Wrote:

> Eldar Insafutdinov wrote:
> > Right now we are working on a next QtD version. We dropped support
> > for D1, it is D2 only. I believe Qt suits all your requirements very
> > well. It's performant - we try to emulate as many C++ types using D
> > structs as possible, for drawing purposes. So types like QPoint - are
> > D structs and for drawing lines you can pass D array directly. No
> > perfromance hit. But of course we cannot avoid all of them, it is
> > still a binding. Regarding the license, Qt itself is LGPLed, QtD is
> > boost. you don't have to put any attribution. About stability of APIs
> > - Qt4 is stable within the major version. At the moment we are
> > working on signals/slots implementation. It is mostly complete, but
> > syntax may change. It will hopefully change once and stay forever.
> > 
> > I would say that QtD is in the state close to that of D2, almost
> > there, but not quite ready yet. But we intend to release the next
> > version, which will be ready to use earlier than D2 anyway, I would
> > say within a month.
> 
> I salute the decision of going with D2, as well as that of using the 
> Boost license. If there is anything in the language that prevents you 
> from getting things done, please let us know. The availability of QtD 
> concurrently with that of D2 will hopefully push both forward.
> 
> Andrei

Some bits I have forgotten to write about in my previous post.

- We really need an access for an original object in copy constructor in structures, as this structures emulate C++ classes directly and we need to call C++ copy constructors from this(this). But C++ ctors require original object.

Currently this could be done like:

struct QImage
{
ubyte[SIZE_OF_QIMAGE] data;

this(this)
{
    ubyte[SIZE_OF_QIMAGE] dummy;
    memcpy(dummy.ptr, &this, SIZE_OF_QIMAGE);
    call_QImage_copy_ctor(dummy.ptr, &this);
}

extern (C) call_QImage_copy_ctor(void* src, void* dst);

// C++

extern "C" call_QImage_copy_ctor(QImage* src, QImage* dst)
{
   dst->QImage(*src);
}

We emulated original object by doing creating a dummy buffer, but that requires extra memcpy. Having an identifier like __source which will be a reference to original structure will be a good thing. You don't have to use it all the time, but in rare cases when you really need it - it is here.

- Another good use case for annotations is to allow grouped declarations:

@Signal
{
    void fooed();
    void booed();
}



More information about the Digitalmars-d mailing list