Remaining bug: Hover when sort

This commit is contained in:
Zach Fox 2016-12-30 12:55:46 -08:00
parent f26b7c0134
commit ea40582afb

View file

@ -118,19 +118,6 @@ Item {
verticalAlignment: Text.AlignTop verticalAlignment: Text.AlignTop
} }
} }
// Separator between user and admin functions
Rectangle {
// Size
width: 2
height: table.height
// Anchors
anchors.left: adminTab.left
anchors.top: table.top
// Properties
z: 100
visible: iAmAdmin
color: hifi.colors.lightGrayText
}
// This TableView refers to the table (below the current user's NameCard) // This TableView refers to the table (below the current user's NameCard)
HifiControls.Table { HifiControls.Table {
id: table id: table
@ -249,6 +236,18 @@ Item {
} }
} }
} }
// Separator between user and admin functions
Rectangle {
// Size
width: 2
height: table.height
// Anchors
anchors.left: adminTab.left
anchors.top: table.top
// Properties
visible: iAmAdmin
color: hifi.colors.lightGrayText
}
// Refresh button // Refresh button
Rectangle { Rectangle {
// Size // Size
@ -390,6 +389,7 @@ Item {
datum.userIndex = userIndex++; datum.userIndex = userIndex++;
userModel.append(datum); userModel.append(datum);
}); });
sortModel();
break; break;
case 'select': case 'select':
var sessionId = message.params[0]; var sessionId = message.params[0];
@ -438,11 +438,9 @@ Item {
} }
function sortModel() { function sortModel() {
var sortedList = []; var sortedList = [];
console.log('sortedList before:', JSON.stringify(sortedList));
for (var i = 0; i < userModel.count; i++) { for (var i = 0; i < userModel.count; i++) {
sortedList.push(userModel.get(i)); sortedList.push(userModel.get(i));
} }
console.log('sortedList:', JSON.stringify(sortedList));
var sortProperty = table.getColumn(table.sortIndicatorColumn).role; var sortProperty = table.getColumn(table.sortIndicatorColumn).role;
var before = (table.sortIndicatorOrder === Qt.AscendingOrder) ? -1 : 1; var before = (table.sortIndicatorOrder === Qt.AscendingOrder) ? -1 : 1;
@ -456,18 +454,18 @@ Item {
} }
}); });
table.selection.clear(); table.selection.clear();
userModel.clear(); var currentUserIndex = 0;
var userIndex = 0; for (var i = 0; i < sortedList.length; i++) {
sortedList.forEach(function (datum) { function init(prop) {
function init(property) { if (sortedList[i][prop] === undefined) {
if (datum[property] === undefined) { sortedList[i][prop] = false;
datum[property] = false;
} }
} }
sortedList[i].userIndex = currentUserIndex++;
['personalMute', 'ignore', 'mute', 'kick'].forEach(init); ['personalMute', 'ignore', 'mute', 'kick'].forEach(init);
datum.userIndex = userIndex++; userModel.append(sortedList[i]);
userModel.append(datum); }
}); userModel.remove(0, sortedList.length);
} }
signal sendToScript(var message); signal sendToScript(var message);
function noticeSelection() { function noticeSelection() {