Results 1 to 9 of 9

Thread: Qt Creator IDE doesn't suggest the methods

  1. #1
    Join Date
    Dec 2012
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Qt Creator IDE doesn't suggest the methods

    I'm a total newbie to OOP but I know this, whenever I type "." next to an object, IDE nicely shows me all of it's methods and functions. But not in this case:
    Qt Code:
    1. void Widget::on_Start_clicked()
    2. {
    3. ...
    4. QTextStream stream(&file);
    5. QString content = stream.readAll();
    6. QStringList lines = content.split("\\n");
    7. lines.at(0).
    To copy to clipboard, switch view to plain text mode 
    but if I do this:
    Qt Code:
    1. void Widget::on_Start_clicked()
    2. {
    3. ...
    4. QTextStream stream(&file);
    5. QString content = stream.readAll();
    6. QStringList lines = content.split("\\n");
    7. QString line = lines.at(0);
    8. line.
    To copy to clipboard, switch view to plain text mode 
    it works.

    So .. what's going on?

  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: Qt Creator IDE doesn't suggest the methods

    The editor probably cannot see a full definition of QStringList, just a forward declaration, so it has no idea that QStringList::at() exists and returns QString. If you #include <QStringList> you should see a change.

  3. #3
    Join Date
    Dec 2012
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt Creator IDE doesn't suggest the methods

    No, it does suggest the methods for the QStringList object, but it does not suggest the methods for the QString object inside the QStringList object.
    Basically what I need to write is lines.at(0).toInt(); , and toInt() is not suggested.
    I did include QString and QStringList, but that didn't do the trick.

  4. #4
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt Creator IDE doesn't suggest the methods

    Both examples work without any problem here (using Qt Creator 2.4.1 on Ubuntu Linux).

  5. The following user says thank you to boudie for this useful post:

    expert_vision (5th January 2013)

  6. #5
    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: Qt Creator IDE doesn't suggest the methods

    Which Qt Creator version?
    Does the code actually compile? Qt Creator can be a bit fussy if there are earlier broken bits of code in the file: they break the parser. Older versions of Creator are fussier.

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

    expert_vision (5th January 2013)

  8. #6
    Join Date
    Dec 2012
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt Creator IDE doesn't suggest the methods

    I use Qt Creator 2.0.1 with Qt 4.7.0 on Ubuntu 64-bit.
    Yes, the code still compiles if I type it down myself.
    I should probably upgrade, but I'm a bit afraid I might broke Qt, and that would be very unfortunate. :P
    Anyway, maybe I'll try install the suggested Qt Creator on a new VM.

  9. #7
    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: Qt Creator IDE doesn't suggest the methods

    You don't need to upgrade the Qt libraries, just Qt Creator.

  10. #8
    Join Date
    Jan 2013
    Posts
    2
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt Creator IDE doesn't suggest the methods

    Quote Originally Posted by ChrisW67 View Post
    You don't need to upgrade the Qt libraries, just Qt Creator.
    Unfortunately Creator is not very good with templates, so upgrading Creator will not help here

    There is work ongoing to finally fix this by using a clang-based c++ parser. While that fixes this issue it is unfortunately too slow for now (it can not take the shortcuts the current parser takes which e.g. break most templates). So we need to come up with some way to cache the code model data in some way or another or speed up clang for the use-case of Qt Creator.

  11. #9
    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: Qt Creator IDE doesn't suggest the methods

    Creator is not very good with templates, so upgrading Creator will not help here
    Really? Qt Creator 2.6.1 with the example the OP gave works just fine here (as was pointed out earlier by boudie for Creator 2.4.1). What is certain is that if you don't upgrade Qt Creator you will not see the benefit of improvements.
    see.png

Similar Threads

  1. Qt Creator doesn't stop at breakpoints ?
    By edsonmcz in forum Qt Programming
    Replies: 21
    Last Post: 26th June 2019, 17:04
  2. Replies: 0
    Last Post: 10th September 2012, 13:18
  3. Suggest me a container
    By giantdragon in forum Newbie
    Replies: 6
    Last Post: 12th September 2011, 10:44
  4. Qt Creator QT Creator doesn`t create main.moc.
    By malootki in forum Qt Tools
    Replies: 10
    Last Post: 13th September 2010, 00:03
  5. Qt Creator doesn't stop at breakpoints
    By TheSaw in forum Qt Tools
    Replies: 3
    Last Post: 12th May 2009, 15:53

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.