New Suggestion for Code Folding



  • 1. Partitioning Code
    add something that start with @Region"smt"@ and end with @endRegion@ that the code between these tag can fold and display "smt" in the summery of the folded code.it's very use full for access to your code faster!
    2. Remember code folding
    when a user save a code the fold state save and restore in next launch



  • bijanbina, could you clarify your idea a bit? Do you want code folding on DevNet, or in Creator? Anyway, it is probably best to file a suggestion in "Jira":http://bugreports.qt.nokia.com for this.



  • i want this feature add to QT Creator for code editing.
    for example your code is:
    @#include <iostream>

    using namespace std;

    void hello();
    void bye();

    void hello()
    {
    cout << "Hi" << endl;
    }

    void bye()
    {
    cout << "Good Bye" << endl;
    }

    int main(int argc, char *argv[])
    {
    int i = 0;
    hello()
    cout << "argc is " << argc << endl;
    for (i = 1;i<argc;i++)
    {
    cout << "the argumet number is " << i << " and the value is " << argv[i] << endl;
    }
    bye();
    return 0;
    }@

    and then you change it to

    @#include <iostream>

    using namespace std;

    Region "Prototypes"
    void hello();
    void bye();
    endRegion

    void hello()
    {
    cout << "Hi" << endl;
    }

    void bye()
    {
    cout << "Good Bye" << endl;
    }

    int main(int argc, char *argv[])
    {
    int i = 0;
    hello()
    cout << "argc is " << argc << endl;
    for (i = 1;i<argc;i++)
    {
    cout << "the argumet number is " << i << " and the value is " << argv[i] << endl;
    }
    bye();
    return 0;
    }
    @

    now you can fold your code like this
    @#include <iostream>

    using namespace std;

    ["Prototypes"]

    void hello()
    {
    cout << "Hi" << endl;
    }

    void bye()
    {
    cout << "Good Bye" << endl;
    }

    int main(int argc, char *argv[])
    {
    int i = 0;
    hello()
    cout << "argc is " << argc << endl;
    for (i = 1;i<argc;i++)
    {
    cout << "the argumet number is " << i << " and the value is " << argv[i] << endl;
    }
    bye();
    return 0;
    }
    @



  • So, you want it like MSVS does it (see "MSDN":http://msdn.microsoft.com/en-us/library/b6xkz944(v=VS.80) ) ?

    @
    // pragma_directives_region.cpp
    #pragma region Region_1
    void Test() {}
    void Test2() {}
    void Test3() {}
    #pragma endregion Region_1

    int main() {}
    @



  • yes it is actually i want



  • Such a thing, as long as it is not overused, might be useful, I guess.
    One solution might be to define a macro Q_CODE_REGION (or something like that), and let Qt Creator's code parser use that for code folding. For MSVC, it might expand to #pragma region, but AFAIK GCC does not have such a thing, so it should probably expand to nothing there.



  • yes you can create a define in qt like
    @#define Q_CODE_REGION //@
    and qt detect it for fold it's no problem for gcc and other compiler



  • So... did you file that suggestion yet in Jira?



  • yes you can find it "here":http://bugreports.qt.nokia.com/browse/QTCREATORBUG-5170

    i just add my first post to it


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.