Results 1 to 3 of 3

Thread: QtCreator custom "macro" or alias for automative text creation

  1. #1
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default QtCreator custom "macro" or alias for automative text creation

    Hello,
    First sorry for hazy title, but I don't exactly know how this is properly named.

    What I want to ask is:
    does QtCreator supporting "aliases" definition?

    Explanation:
    Lets say I want to print debug message, so normally I write
    Qt Code:
    1. qDebug() << "some message";
    To copy to clipboard, switch view to plain text mode 
    but I would like to print that message only in debug mode, so i type:
    Qt Code:
    1. #ifdef QT_DEBUG
    2. qDebug() << "some message";
    3. #endif
    To copy to clipboard, switch view to plain text mode 
    but typing those 3 lines is time consuming, so I would like to i.e. type "mydebug <enter>", then QtCreator would look in "aliases" definition and create for me structure #ifdef...

    Is there something similar in functionality available in QtCretor? (I looked but didn't found anything)

    BTW. I saw something like this in Eclipse, so that's why I ask.

    PS. I don't ask about macros and key bindings.

    Thanks for reply
    Last edited by Talei; 16th December 2011 at 02:47.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QtCreator custom "macro" or alias for automative text creation

    If that is your real problem, then forget about it, because qDebug only shows the message only if you have build the application in debug mode. So no #if is required.
    This function does nothing if QT_NO_DEBUG_OUTPUT was defined during compilation.
    Else have a look at preferences -> text editor -> snippets.

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

    Talei (17th December 2011)

  4. #3
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QtCreator custom "macro" or alias for automative text creation

    No qDebug() was merely an example (poorly chosen to add).

    Snippets is what I was looking for.

    Thanks.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

Similar Threads

  1. Replies: 3
    Last Post: 8th December 2011, 19:21
  2. Replies: 1
    Last Post: 19th February 2011, 13:32
  3. Replies: 2
    Last Post: 23rd June 2010, 22:00
  4. Replies: 4
    Last Post: 5th March 2010, 18:03
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

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.