Results 1 to 4 of 4

Thread: What's the charactor ‘^' mean in the qmake file?

  1. #1
    Join Date
    Nov 2011
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question What's the charactor ‘^' mean in the qmake file?

    Recently i read the source of qt creator. However I found a lot of doubtable codes. Have look at the codes below:
    Qt Code:
    1. defineReplace(cleanPath) {
    2. win32:1 ~= s|\\\\|/|g
    3. contains(1, ^/.*):pfx = /
    4. else:pfx =
    5. segs = $$split(1, /)
    6. out =
    7. for(seg, segs) {
    8. equals(seg, ..):out = $$member(out, 0, -2)
    9. else:!equals(seg, .):out += $$seg
    10. }
    11. return($$join(out, /, $$pfx))
    12. }
    To copy to clipboard, switch view to plain text mode 
    What do the four backslashs mean? and also the '|g', '^' ? I can't find anything useful in the document.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: What's the charactor ‘^' mean in the qmake file?

    Four backslashes represents two literal backslashes. The backslash character escapes the special meaning of the character following it, just like you see in C++ code where you wanted two literal backslashes.

    The syntax on line 2 is documented on this page. The regular expression syntax is Perl-esque. The carets are part of a regular expression, meaning "match at start" and the g modifier means find all matches in the target value. That particular line is replacing backslashes with forward slashes.

    Line 3 is checking if the path begins with a '/' followed by any number of other characters and setting a variable accordingly.

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

    Michael_BJFU (3rd October 2012)

  4. #3
    Join Date
    Nov 2011
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: What's the charactor ‘^' mean in the qmake file?

    There is a function in qmake file in the source of qt creator called re_escape(), what does it mean ?Do I need to learn something about Perl in order to learn more about Qt?

  5. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What's the charactor ‘^' mean in the qmake file?

    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. It is possible to rename file with qmake
    By themean in forum Newbie
    Replies: 4
    Last Post: 20th December 2012, 10:11
  2. qmake: does no generate .h file from .ui file
    By miodas007 in forum Newbie
    Replies: 7
    Last Post: 18th April 2011, 22:57
  3. qmake and *.pro file
    By Teuniz in forum Qt Programming
    Replies: 2
    Last Post: 20th October 2009, 12:40
  4. qmake file info
    By Lodorot in forum Qt Programming
    Replies: 1
    Last Post: 4th September 2009, 22:23
  5. help needed regarding qmake and pro file
    By Benjamin in forum Qt Tools
    Replies: 0
    Last Post: 24th February 2009, 13:27

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.