Rujia Liu rujia.liu@gmail.com writes:
On Thu, Sep 12, 2013 at 3:31 AM, Stas Boukarev stassats@gmail.com wrote:
Indeed. But it looks like this sequence of code is repeated in all the projects. So, I decided to make it easier.
That's good! :)
Good to hear that. Feel free to ask any questions, the documentation may be lacking in some aspects.
I updated it to mention the above changes. And also added a description
on how to better connect signals and some additional information about method overrides.
Great. I've just experimented about ways to connect signals yesterday :) I also used with-objects macro, after comparing with C++ version and also looking at the macro's source code. I think the spirit is: if the C++ version used a local object (implicit object construction and destroying), use with-objects; but if the C++ version used a pointer without deleting it, don't use with-objects. Correct me if I'm wrong, and I think this information is quite useful for new CommonQt users if you add it to the documentation.
Another interesting thing is QVector's streaming operator:
QPolygon polygon; polygon << QPoint(10, 20) << QPoint(20, 30);
Of course it's not mandatory to use "<<" but it's convenient. Just curious: can we do it similarly in CommonQt?
BTW: I'm talking about this because I use QPolygon in my project. It uses QGraphicsView heavily and everything is going on very well.
Template classes are problematic, there's no meta information like with QObject, so it has to be marshalled explicitly, i.e. converted to a vector, and then converted back, which may not be the most efficient thing to do. There's currently no QVector<QPoint> marshalling, but it can be added if needed.
P.S. For ordinary classes (#_<< x y z) works.