PDA

View Full Version : How to get correct header with custom made widgets?



Arthur
26th April 2007, 12:50
Hello,

I have a class, derived from QTreeWidget: DragDropTree.

I made a user interface with the Qt Designer and I replaced my QTreeWidget by my DragDropTree in the .ui file. The Designer does not render my widget, but that's not a real problem.

Once I do the custom build step with the .uic tool and compile my project I get an error:

"Cannot open include file: 'dragdroptable.h': No such file or directory"

This is because uic inserts a statement:

#include <dragdroptable.h>

in stead of

#include "dragdroptable.h"

Is there any way to easily avoid this problem? I couldn't find command line options to do so, just like the MOC tool.

Best regards,
Arthur

marcel
26th April 2007, 13:26
What about the include paths set in your project?
Do they include the directory with that header?
It doesn't matter if you use "" or <>.
The header will be searched in standard include paths and in user defined paths.

Regards

Arthur
26th April 2007, 16:39
Thank you for your reply.


What about the include paths set in your project?
Do they include the directory with that header?
Regards
If I add the dir explicitely to my additional include paths it works...

Not ideal, but ok...

jpn
26th April 2007, 17:07
I made a user interface with the Qt Designer and I replaced my QTreeWidget by my DragDropTree in the .ui file.
The recommended way is not to edit .ui files by hand but use the promoting (http://doc.trolltech.com/4.2/designer-using-custom-widgets.html#promoting-widgets) feature of the designer.



Once I do the custom build step with the .uic tool and compile my project I get an error:

"Cannot open include file: 'dragdroptable.h': No such file or directory"

This is because uic inserts a statement:

#include <dragdroptable.h>

in stead of

#include "dragdroptable.h"

I'm afraid changing <dragdroptable.h> to "drapdroptable.h" would have no effect. A proper include path must be added to the project unless it's in the same directory.