Results 1 to 3 of 3

Thread: namespace with promoted classes

  1. #1
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default namespace with promoted classes

    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:
    Qt Code:
    1. using namespace aaa::bbb::ccc;
    2. #include "ui_MainWindow.h"
    To copy to clipboard, switch view to plain text mode 

    but it's ugly

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: namespace with promoted classes

    In qtcreator I promote a QTableWidget object to my own CTableWidget class.
    Set the "class name" to aaa::bbb::ccc::CTableWidget when promoting.

  3. The following user says thank you to stampede for this useful post:

    trallallero (16th February 2012)

  4. #3
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: namespace with promoted classes

    So simple ?

    thanks a lot

Similar Threads

  1. Replies: 3
    Last Post: 23rd April 2013, 14:38
  2. Why dont see a Custom Widget Promoted ?
    By tonnot in forum Newbie
    Replies: 1
    Last Post: 27th October 2010, 13:24
  3. Promoted widgets in Qt Designer
    By martinb0820 in forum Qt Tools
    Replies: 1
    Last Post: 9th June 2010, 15:07
  4. Replies: 0
    Last Post: 24th October 2009, 07:38
  5. Promoted widgets and layout boxes
    By notsonerdysunny in forum Qt Tools
    Replies: 3
    Last Post: 2nd May 2007, 14:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.