Results 1 to 5 of 5

Thread: QCompleter extract from Assistant

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QCompleter extract from Assistant

    If you say a way to extract a QStringList words from class to insert on QCompleter?
    or interact from assistant search on a model?

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

    Default Re: QCompleter extract from Assistant

    Could you rephrase your question? I have difficulties understanding what your question means.

  3. #3
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QCompleter extract from Assistant

    Quote Originally Posted by wysota View Post
    Could you rephrase your question? I have difficulties understanding what your question means.
    My question is only how to extract QT4 class name on a qstringlist to add on a QCompleter?
    Or cast direct from assistant... is here a way?



    Qt Code:
    1. TextEdit::TextEdit(QWidget *parent)
    2. : QTextEdit(parent), c(0)
    3. {
    4. highlighter = new Highlighter(document()); /* Highlighter *highlighter; */
    5. completerbase = new QCompleter();
    6. completerbase->setModel(modelFromFile(":img/qtclass.txt"));
    7. completerbase->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
    8. completerbase->setCaseSensitivity(Qt::CaseInsensitive);
    9. completerbase->setWrapAround(false);
    10. setCompleter(completerbase);
    11.  
    12. }
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

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

    Default Re: QCompleter extract from Assistant

    Extract from assistant? Assistant saves its index in a file that's probably in your $HOME/.assistant/. I don't know the format, but it should be easy to retrieve it by looking at assistant source code.

  5. #5
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QCompleter extract from Assistant

    Quote Originally Posted by wysota View Post
    Extract from assistant? Assistant saves its index in a file that's probably in your $HOME/.assistant/. I don't know the format, but it should be easy to retrieve it by looking at assistant source code.

    I tidy to xml the file http://doc.trolltech.com/4.3/functions.html


    Qt Code:
    1. QString errorStr, obname;
    2. int errorLine, errorColumn;
    3. QFile f("function.xml");
    4. if (!doc.setContent(&f,false, &errorStr, &errorLine, &errorColumn)) {
    5. return 0;
    6. }
    7.  
    8. int sumfunction = 0;
    9.  
    10. QDomElement root = doc.documentElement();
    11. QDomElement group = root.firstChildElement("ul");
    12. QDomElement listing = group.firstChildElement("li");
    13. while (!listing.isNull()) {
    14. QDomElement pagelink = listing.firstChildElement("a");
    15. obname = pagelink.firstChildElement("span").text();
    16. if (obname !="") {
    17. sumfunction++;
    18. std::cout << sumfunction << ") qtfu: ->" << qPrintable(obname) << std::endl;
    19. }
    20. listing = listing.nextSiblingElement("li");
    21. }
    22.  
    23. /* summfunction qt4 rc1 6028.. */
    To copy to clipboard, switch view to plain text mode 

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.