Commit 10478246 authored by Aurindam Jana's avatar Aurindam Jana
Browse files

QtMessageLogHandler: Insert child items in alphabetical order



Change-Id: I644207f5e8b149364e73abf7512240e918260072
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent 3d1f5bd8
......@@ -1309,7 +1309,7 @@ QtMessageLogItem *QmlEngine::constructLogItemTree(
QtMessageLogItem *child = constructLogItemTree(item,
i.value(), i.key());
if (child)
item->insertChild(item->childCount(), child);
item->insertChildSorted(child);
}
} else if (result.type() == QVariant::List) {
if (key.isEmpty())
......@@ -1321,7 +1321,7 @@ QtMessageLogItem *QmlEngine::constructLogItemTree(
QtMessageLogItem *child = constructLogItemTree(item, resultList.at(i),
QString::number(i));
if (child)
item->insertChild(item->childCount(), child);
item->insertChildSorted(child);
}
} else if (result.canConvert(QVariant::String)) {
item->text = result.toString();
......
......@@ -995,7 +995,7 @@ QtMessageLogItem *QmlV8DebuggerClientPrivate::constructLogItemTree(
QtMessageLogItem *child = constructLogItemTree(
item, extractData(property, refsVal), refsVal);
if (child)
item->insertChild(item->childCount(), child);
item->insertChildSorted(child);
}
return item;
......
......@@ -94,6 +94,17 @@ bool QtMessageLogItem::insertChildren(int position, int count)
return true;
}
void QtMessageLogItem::insertChildSorted(QtMessageLogItem *item)
{
int i = 0;
for (; i < m_childItems.count(); i++) {
if (item->text < m_childItems[i]->text) {
break;
}
}
m_childItems.insert(i, item);
}
bool QtMessageLogItem::insertChild(int position, QtMessageLogItem *item)
{
if (position < 0 || position > m_childItems.size())
......
......@@ -126,6 +126,7 @@ public:
QtMessageLogItem *child(int number);
int childCount() const;
bool insertChildren(int position, int count);
void insertChildSorted(QtMessageLogItem *item);
bool insertChild(int position, QtMessageLogItem *item);
QtMessageLogItem *parent();
bool removeChildren(int position, int count);
......
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