Commit d8cb025b authored by Carsten Fuhrmann's avatar Carsten Fuhrmann

trying to sort

parent 0889b855
......@@ -22,7 +22,8 @@ ChannelListWidget::ChannelListWidget()
ChannelListWidget::~ChannelListWidget()
{
//m_parent->deleteLater();
setParent(NULL);
m_parent->deleteLater();
}
void ChannelListWidget::mousePressEvent(QMouseEvent * event)
......
......@@ -16,6 +16,7 @@ struct channelInfo {
QString name;
uint64 parent;
QTreeWidgetItem* entry;
int order;
};
enum nodeType {
......@@ -232,6 +233,7 @@ void OverlayController::displayChannelList()
tmp.id = channelIDList[i];
tmp.name = channelID2Name(m_SCHID, channelIDList[i]);
ts3.getChannelVariableAsInt(m_SCHID, tmp.id, CHANNEL_ORDER, &tmp.order);
ts3.getParentChannelOfChannel(m_SCHID, channelIDList[i], &tmp.parent);
tmp.entry = new QTreeWidgetItem;
......@@ -246,6 +248,8 @@ void OverlayController::displayChannelList()
i++;
}
qSort(channelList.begin(), channelList.end(), [](const channelInfo& a, const channelInfo& b) { return a.order < b.order; });
// build tree structure
for (auto& it : channelList)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment