- enhancement: Sort symbols by their declaration pos in the Class Browser, if not sort by alpha order.
This commit is contained in:
parent
bd768552c0
commit
b65ad80235
1
NEWS.md
1
NEWS.md
|
@ -27,6 +27,7 @@ Red Panda C++ Version 2.23
|
|||
- enhancement: Show code completion suggestion after "typedef" and "const".
|
||||
- fix: GLFW project template.
|
||||
- fix: Inherited class/struct members are not correctly shown in the completion suggestions.
|
||||
- enhancement: Sort symbols by their declaration pos in the Class Browser, if not sort by alpha order.
|
||||
|
||||
Red Panda C++ Version 2.22
|
||||
|
||||
|
|
|
@ -295,6 +295,25 @@ void ClassBrowserModel::addMembers()
|
|||
|
||||
void ClassBrowserModel::sortNode(ClassBrowserNode *node)
|
||||
{
|
||||
if (!pSettings->ui().classBrowserSortAlpha()) {
|
||||
if (mClassBrowserType==ProjectClassBrowserType::CurrentFile) {
|
||||
std::sort(node->children.begin(),node->children.end(),
|
||||
[](ClassBrowserNode* node1,ClassBrowserNode* node2) {
|
||||
return (node1->statement->line < node2->statement->line);
|
||||
});
|
||||
} else {
|
||||
std::sort(node->children.begin(),node->children.end(),
|
||||
[](ClassBrowserNode* node1,ClassBrowserNode* node2) {
|
||||
int comp=QString::compare(node1->statement->fileName, node2->statement->fileName);
|
||||
if (comp<0)
|
||||
return true;
|
||||
else if (comp==0)
|
||||
return (node1->statement->line < node2->statement->line);
|
||||
return false;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
if (pSettings->ui().classBrowserSortAlpha()
|
||||
&& pSettings->ui().classBrowserSortType()) {
|
||||
std::sort(node->children.begin(),node->children.end(),
|
||||
|
|
Loading…
Reference in New Issue