Results 1 to 4 of 4

Thread: Using namespace enums in headers

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    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: Using namespace enums in headers

    I would like to keep the #include in the namespace because there's a dozen other dependencies and I'd like to enable the user to only have to include one file instead of a dozen.
    Looks like in this case its enough to include "colorwriter.h" instead of "color_namespace.h".
    Just define the enum before any other class, it does not depend on them. My suggestion is to remove the #include "colorwriter.h" (and any other header that uses enum) from color_namespace.h, move the enum definition to separate file and include it in any source file depending on the enum, not the other way around.
    Simple fix could be to move the #include directives after enum definition.

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

    Phlucious (30th November 2011)

Similar Threads

  1. converting strings into enums
    By ugluk in forum Qt Programming
    Replies: 5
    Last Post: 26th August 2011, 10:59
  2. How to use enums in qml
    By nightroad in forum Qt Quick
    Replies: 0
    Last Post: 29th June 2011, 13:24
  3. Save enums in QSettings
    By redhat in forum Qt Programming
    Replies: 4
    Last Post: 22nd January 2009, 11:22
  4. Using enums in QtScript
    By Orphelic in forum Qt Programming
    Replies: 1
    Last Post: 29th November 2007, 11:55
  5. how to use enums
    By soul_rebel in forum General Programming
    Replies: 3
    Last Post: 23rd March 2006, 21:49

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.