Results 1 to 13 of 13

Thread: QString constants in a class

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QString constants in a class

    Quote Originally Posted by jpn View Post
    Of course macros have their own use, but *cough* macros are evil! At least compilers and debuggers come along with typed variables. Try googling for "const vs #define".. http://www.comeaucomputing.com/techtalk/#definevsconst
    Funny position to take given that a lot of Qt goodness is due to macros and preprocessors

    Anyway, none of those reasons apply in this case, since the point is just to put the name in one place. I'm against heavy use of macros as well (I hate it when people define macros like MWPTR MainWindowFactor::getInterfacePointer()->mainWindow()). Those just serve to obfuscate code, but in this case a define is the easiest way to go.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QString constants in a class

    Quote Originally Posted by pherthyl View Post
    Funny position to take given that a lot of Qt goodness is due to macros and preprocessors
    But there's quite a big difference, don't you think? Most of the macros providing this goodness are actually defined as empty. They are just used as markers for moc.
    J-P Nurmi

  3. #3
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QString constants in a class

    Ah, that I didn't know... Thanks for the info.

Similar Threads

  1. Delayed Rendering of QTabWidget Tabs
    By mclark in forum Qt Tools
    Replies: 13
    Last Post: 14th May 2007, 22:53
  2. Convert from iso-8859-1 to... Something else :-)
    By Nyphel in forum Qt Programming
    Replies: 4
    Last Post: 7th March 2007, 17:59
  3. How to pass a QString to another class ?
    By probine in forum Qt Programming
    Replies: 9
    Last Post: 9th December 2006, 20:16
  4. QSqlQueryModel + set Write
    By raphaelf in forum Qt Programming
    Replies: 7
    Last Post: 5th June 2006, 08:55
  5. [SOLVED] Widget plugin ... how to ?
    By yellowmat in forum Newbie
    Replies: 10
    Last Post: 29th January 2006, 20:41

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.