I want to use Cairo graphics library whith Qt, but I can\'t find any documenattion. I just want to make the GUI whith Qt and use Cairo for drawing graphics in a Qt window.
It can be achieved by this dirty way:
Recent version of cairo supports Qt by allowing to draw to a surface created with cairo_qt_surface_create(QPainter *painter)
: you can inspect the relevant header file here. There's no documentation because this feature is still experimental and disabled by default (you should compile cairo yourself explicitely enabling the Qt support with configure --enable-qt
.
Caveat: This is not going to be the answer you are looking for.
Are you sure you want this? To what end? Is this about writing a QPaintDevice
based on Cairo? Qt has its own graphics primitives implemented and so does Cairo. The only reason I can see is that you don't want the a heavy layer of Qt interfere with your system (embedded?). It's like you are trying to use the DirectFB backend of Cairo -- but then there's stuff like Qt-on-DirectFB. However, note such an implementation is costly and not free without its own set of quarks such as library-interop issues, printing from this Cairo based context etc. I'd suggest you do a regular search on Google to figure if such efforts are/ever were underway and weigh the pros and cons very heavily before even attempting the same.
Qt's Paint System is a very good drawing library and is vector based. And it's already there. If you pick Qt as your GUI toolkit, it can't get any easier.