new Suggestion for Code Folding
1. Partitioning Code
add something that start with
- Region"smt"
- endRegion
2. Remember code folding
when a user save a code the fold state save and restore in next launch
8 replies
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 [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 [msdn.microsoft.com]) ) ?
- // pragma_directives_region.cpp
- #pragma region Region_1
- void Test() {}
- void Test2() {}
- void Test3() {}
- #pragma endregion Region_1
- int main() {}
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 find it here [bugreports.qt.nokia.com]
i just add my first post to it
You must log in to post a reply. Not a member yet? Register here!


