Improve opening time of terminal strip editor window

Need serious refactoring of codes who use the method
Element::actualLabel() and also actualLabel itself.
This part of code is crappy.
This commit is contained in:
joshua
2022-06-22 17:34:05 +02:00
parent 2e15372aab
commit fe19b270f9
3 changed files with 17 additions and 8 deletions

View File

@@ -26,6 +26,7 @@
#include "../realterminal.h"
#include "../../qetgraphicsitem/terminalelement.h"
#include "../terminalstrip.h"
#include "../../qetinformation.h"
TerminalStripTreeDockWidget::TerminalStripTreeDockWidget(QETProject *project, QWidget *parent) :
QDockWidget(parent),
@@ -305,8 +306,11 @@ void TerminalStripTreeDockWidget::addFreeTerminal()
}
//Sort the terminal element by label
std::sort(vector_.begin(), vector_.end(), [](TerminalElement *a, TerminalElement *b) {
return a->actualLabel() < b->actualLabel();
std::sort(vector_.begin(), vector_.end(), [](TerminalElement *a, TerminalElement *b)
{
return a->elementData().m_informations.value(QETInformation::ELMT_LABEL).toString()
<
b->elementData().m_informations.value(QETInformation::ELMT_LABEL).toString();
});
auto free_terminal_item = ui->m_tree_view->topLevelItem(1);