sort signals in dbc editor by start bit
This commit is contained in:
@@ -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
|
//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)
|
void DBCMainEditor::processSignalToTree(QTreeWidgetItem *parent, DBC_SIGNAL *sig)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *sigItem = new QTreeWidgetItem(parent);
|
QTreeWidgetSignalItem *sigItem = new QTreeWidgetSignalItem(parent);
|
||||||
QString sigInfo = createSignalText(sig);
|
QString sigInfo = createSignalText(sig);
|
||||||
sigItem->setText(0, sigInfo);
|
sigItem->setText(0, sigInfo);
|
||||||
if (sig->isMultiplexor) sigItem->setIcon(0, multiplexorSignalIcon);
|
if (sig->isMultiplexor) sigItem->setIcon(0, multiplexorSignalIcon);
|
||||||
|
|||||||
@@ -18,6 +18,20 @@ namespace Ui {
|
|||||||
class DBCMainEditor;
|
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
|
enum DBCItemTypes
|
||||||
{
|
{
|
||||||
NODE = 1,
|
NODE = 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user