sort signals in dbc editor by start bit

This commit is contained in:
Leopixelo
2026-06-08 15:13:12 +02:00
parent cae3ec29ea
commit d24738eb7c
2 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -462,7 +462,7 @@ QString DBCMainEditor::createSignalText(DBC_SIGNAL *sig)
//Signals can have a hierarchial relationship with other signals so this function is separate and calls itself recursively to build the tree
void DBCMainEditor::processSignalToTree(QTreeWidgetItem *parent, DBC_SIGNAL *sig)
{
QTreeWidgetItem *sigItem = new QTreeWidgetItem(parent);
QTreeWidgetSignalItem *sigItem = new QTreeWidgetSignalItem(parent);
QString sigInfo = createSignalText(sig);
sigItem->setText(0, sigInfo);
if (sig->isMultiplexor) sigItem->setIcon(0, multiplexorSignalIcon);
+14
View File
@@ -18,6 +18,20 @@ namespace Ui {
class DBCMainEditor;
}
class QTreeWidgetSignalItem : public QTreeWidgetItem
{
public:
using QTreeWidgetItem::QTreeWidgetItem;
// DBCSignalHandler::getSignalsAsList returns a list sorted by start bit
// becuase C++ uses a stable sorting algorithm (also for sorting QTreeWidgetItems) the order is not changed if the comparison function always returns false
bool operator<(const QTreeWidgetItem &other) const override
{
Q_UNUSED(other);
return false;
}
};
enum DBCItemTypes
{
NODE = 1,