Results 1 to 7 of 7

Thread: Qt codecompletion etc. without a project.

  1. #1
    Join Date
    Sep 2010
    Location
    Norway
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt codecompletion etc. without a project.

    Is it possible to get qt code completion in qt creator without working in a project.

    1. Open qt-creator.
    2. drag a cpp file into the editor.
    3. req.1 - Verify that you have F1 (help) for all Qxxx
    4. req.2 - Verify that you have completion for all Qxxx

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt codecompletion etc. without a project.

    As far as I remember code works based on files included by the current file so all you have to do is to add #include statements to your code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2010
    Location
    Norway
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt codecompletion etc. without a project.

    It doesn't work for me. I don't get Qt code completion, but in some cases i get completion between files i drag in and are listed in "Open Documents". Are there a setting or syntax I'm missing?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt codecompletion etc. without a project.

    Quote Originally Posted by mrandreas View Post
    It doesn't work for me. I don't get Qt code completion, but in some cases i get completion between files i drag in and are listed in "Open Documents". Are there a setting or syntax I'm missing?
    Are the include files from Qt underlined with green and when you hover over them Creator says it can't find the respective file?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Sep 2010
    Location
    Norway
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt codecompletion etc. without a project.

    The green classes and namespaces has code completion (etc). The Qxxx (Qt classes) however is not green. I have only made it work when I reference the qt include path in a projectname.includes. The code files I'm working on is always on a mapped drive. The path to the qt path is somthing like L:/thirdParty/qt/winxp_vc/release/include/. I'm using another building system.


    Added after 1 5 minutes:


    I just noticed that when I check in the file in clearcase (verson control program) the code complition disappear and the green text is gone...
    Last edited by mrandreas; 30th December 2010 at 14:38.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt codecompletion etc. without a project.

    Quote Originally Posted by mrandreas View Post
    The green classes and namespaces has code completion (etc). The Qxxx (Qt classes) however is not green.
    I don't mean the font color but rather the wavy line under the text.

    I have only made it work when I reference the qt include path in a projectname.includes.
    It seems I'm right then. The problem is that Qt includes are usually not in the default place for include files in your system so Creator can't find them without pointing it to them. When you use qmake (or some other project management tool), it adds appropriate directories to the search path so that the files can be found. If you use another build tool, you should mimic the same behaviour. Unfortunately you have to do it in Creator compliant way - either by generating a Makefile and pointing Creator to it or by writing a plugin for Creator to handle your custom build tool.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    May 2008
    Posts
    155
    Thanked 15 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt codecompletion etc. without a project.

    You need at least a dummy project to have a "file collection". You can create one easily using "qmake -project", and you do not have to use this dummy project for building (just remove the build steps in the build settings)

Similar Threads

  1. Qt project management - bigger project
    By Peppy in forum Qt Programming
    Replies: 11
    Last Post: 24th December 2010, 13:50
  2. cannot run the project
    By kazal in forum Qwt
    Replies: 0
    Last Post: 24th May 2010, 08:18
  3. Replies: 1
    Last Post: 3rd December 2009, 23:34
  4. Bug in my project
    By phast in forum Qt Programming
    Replies: 1
    Last Post: 21st December 2008, 07:10
  5. Project generation on linux from QT Project
    By darpan in forum Qt Programming
    Replies: 6
    Last Post: 11th December 2006, 09:43

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.