[Qt-interest] Drag'n'Drop: need to reimplement QGraphicsView?

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Fri Nov 26 11:49:20 CET 2010


On 2010-11-26 Christian Christian Gagneraud wrote:

> ...
> If I'm not wrong, you can still do that with QtCreator, if you right click on the view,
> and then choose "promote to", you can then create your derived class there.

Yes, that would be another possibility - but it requires you to specify the #include path, and that can be a bit tricky sometimes to figure out the proper relative path (or you do a "global" path and hope that the proper class header is picked up ;), it all depends on where the generated cpp file is put etc. So I try to avoid this approach with Qt Designer.

My general approach is to do the "general layout" of the QMainWindow in Qt Creator, but when it comes to custom widgets I prefer to do that in code, e.g. just define a "placeholder panel" or something in Qt Designer, and then add the layout and custom widget in code. Even though I agree that the "promote to" approach is a good one for lazy people such as me ;) But it can get tricky one a project becomes somewhat larger, or when e.g. the Visual Studio Qt integration tends to place generated files (by default) into a different directory hierarchy level than the qmake generated Makefile - then you are in trouble with relative #include paths ;) I remember we had such an issue...

But in the meantime I figured out that I should be able to subclass from QGraphicsScene instead :)

Thanks, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22






More information about the Qt-interest-old mailing list