PDA

View Full Version : namespace with promoted classes



trallallero
16th February 2012, 09:25
I have a problem using namespaces with promoted classes.

In my company with use a structure where all the namespaces have a relative directory with the same name so,
if a have a project that uses namespace aaa { namespace bbb { namespace ccc,
the files are in <path>/aaa/bbb/ccc

Now, my current project is inside 3 namespaces. In qtcreator I promote a QTableWidget object to my own CTableWidget class.
When I compile, the file CTableWidget.h is found but, as the file uses namespace aaa { namespace bbb { namespace ccc,
the compiler throws and error:

ui_MainWindow.h:50: error: ISO C++ forbids declaration of ‘CTableWidget’ with no type
as ui_MainWindow.h doesn't know that there are namespaces and, of course, I cannot modify it as it's created by qmake.

Is there a solution for this ?

Actually I've solved in this way:

using namespace aaa::bbb::ccc;
#include "ui_MainWindow.h"

but it's ugly :(

stampede
16th February 2012, 10:12
In qtcreator I promote a QTableWidget object to my own CTableWidget class.
Set the "class name" to aaa::bbb::ccc::CTableWidget when promoting.

trallallero
16th February 2012, 10:56
So simple ? :)

thanks a lot