Great cleanup

This commit is contained in:
Zach Fox 2016-12-20 11:37:10 -08:00
parent 7999e14ecf
commit db2da8f06b
2 changed files with 30 additions and 7 deletions

View file

@ -20,6 +20,7 @@ TableView {
property int colorScheme: hifi.colorSchemes.light property int colorScheme: hifi.colorSchemes.light
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
property bool expandSelectedRow: false property bool expandSelectedRow: false
property bool centerHeaderText: false
model: ListModel { } model: ListModel { }
@ -34,9 +35,12 @@ TableView {
size: hifi.fontSizes.tableHeading size: hifi.fontSizes.tableHeading
font.capitalization: Font.AllUppercase font.capitalization: Font.AllUppercase
color: hifi.colors.baseGrayHighlight color: hifi.colors.baseGrayHighlight
horizontalAlignment: (centerHeaderText ? Text.AlignHCenter : Text.AlignLeft)
anchors { anchors {
left: parent.left left: parent.left
leftMargin: hifi.dimensions.tablePadding leftMargin: hifi.dimensions.tablePadding
right: parent.right
rightMargin: hifi.dimensions.tablePadding
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
} }

View file

@ -31,7 +31,7 @@ import QtQuick.Controls 1.4
import "../styles-uit" import "../styles-uit"
import "../controls-uit" as HifiControls import "../controls-uit" as HifiControls
Rectangle { Item {
id: pal; id: pal;
// Size // Size
width: parent.width; width: parent.width;
@ -40,18 +40,19 @@ Rectangle {
property int myCardHeight: 70; property int myCardHeight: 70;
property int rowHeight: 70; property int rowHeight: 70;
property int separatorColWidth: 10; property int separatorColWidth: 10;
property int actionButtonWidth: 55; property int actionButtonWidth: 70;
property int nameCardWidth: width - separatorColWidth- actionButtonWidth*(table.columnCount - 2); // "-2" for Name and Separator cols; property int nameCardWidth: width - (iAmAdmin ? separatorColWidth : 0) - actionButtonWidth*(iAmAdmin ? 4 : 2);
// This contains the current user's NameCard and will contain other information in the future // This contains the current user's NameCard and will contain other information in the future
Item { Rectangle {
id: myInfo; id: myInfo;
// Size // Size
width: pal.width; width: pal.width;
height: myCardHeight; height: myCardHeight;
// Anchors // Anchors
anchors.top: pal.top; anchors.top: pal.top;
anchors.left: pal.left; // Properties
radius: hifi.dimensions.borderRadius;
// This NameCard refers to the current user's NameCard (the one above the table) // This NameCard refers to the current user's NameCard (the one above the table)
NameCard { NameCard {
id: myCard; id: myCard;
@ -65,17 +66,34 @@ Rectangle {
anchors.left: parent.left; anchors.left: parent.left;
} }
} }
// Rectangles used to cover up rounded edges on bottom of MyInfo Rectangle
Rectangle {
color: "#FFFFFF";
width: pal.width;
height: 10;
anchors.top: myInfo.bottom;
anchors.left: parent.left;
}
Rectangle {
color: "#FFFFFF";
width: pal.width;
height: 10;
anchors.bottom: table.top;
anchors.left: parent.left;
}
// 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;
// Size // Size
height: pal.height - myInfo.height; height: pal.height - myInfo.height;
width: pal.width; width: pal.width - 4;
// Anchors // Anchors
anchors.left: parent.left;
anchors.top: myInfo.bottom; anchors.top: myInfo.bottom;
// Properties // Properties
frameVisible: false; centerHeaderText: true;
sortIndicatorVisible: true; sortIndicatorVisible: true;
headerVisible: true;
onSortIndicatorColumnChanged: sortModel(); onSortIndicatorColumnChanged: sortModel();
onSortIndicatorOrderChanged: sortModel(); onSortIndicatorOrderChanged: sortModel();
@ -98,6 +116,7 @@ Rectangle {
movable: false; movable: false;
} }
TableViewColumn { TableViewColumn {
visible: iAmAdmin;
title: ""; title: "";
width: separatorColWidth; width: separatorColWidth;
resizable: false; resizable: false;