Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 72 additions & 81 deletions resources/ObservationTabComponents/ObservationTable.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ColumnLayout {
"pointSize": Constants.largePointSize
})
property variant avgWidth: parent.width / 8
property variant columnWidths: [parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 8]
property variant columnWidths: [parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 8, parent.width / 16, 3 * parent.width / 16]
property variant columnNames: ["PRN", "Pseudorange (m)", "Carrier Phase (cycles)", "C/N0 (dB-Hz)", "Meas. Doppler (Hz)", "Comp. Doppler (Hz)", "Lock", "Flags"]
property real mouse_x: 0

Expand Down Expand Up @@ -112,55 +112,61 @@ ColumnLayout {

}

Item {
id: headerItem

Layout.fillWidth: true
implicitHeight: header.implicitHeight
clip: true

Row {
id: header

Layout.fillWidth: true
x: -innerTable.contentX
z: 1
spacing: innerTable.columnSpacing

Repeater {
id: headerRepeater

model: observationTableModel ? observationTableModel.columnCount() : 0

Rectangle {
implicitWidth: columnWidths[index]
implicitHeight: Constants.genericTable.cellHeight
border.color: Constants.genericTable.borderColor

Text {
width: parent.width
anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: columnNames[index]
elide: Text.ElideRight
clip: true
font.family: Constants.genericTable.fontFamily
}

gradient: Gradient {
GradientStop {
position: 0
color: Constants.genericTable.cellColor
}
HorizontalHeaderView {
id: horizontalHeader

interactive: false
syncView: innerTable
z: Constants.genericTable.headerZOffset

delegate: Rectangle {
implicitWidth: columnWidths[index]
implicitHeight: Constants.genericTable.cellHeight
border.color: Constants.genericTable.borderColor

Label {
width: parent.width
anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: columnNames[index]
elide: Text.ElideRight
clip: true
font.family: Constants.genericTable.fontFamily
font.pointSize: Constants.largePointSize
}

GradientStop {
position: 1
color: Constants.genericTable.gradientColor
MouseArea {
width: Constants.genericTable.mouseAreaResizeWidth
height: parent.height
anchors.right: parent.right
cursorShape: Qt.SizeHorCursor
onPressed: {
mouse_x = mouseX;
}
onPositionChanged: {
if (pressed) {
var delta_x = (mouseX - mouse_x);
var next_idx = (index + 1) % 8;
var min_width = innerTable.width / 12;
if (columnWidths[index] + delta_x > min_width && columnWidths[next_idx] - delta_x > min_width) {
columnWidths[index] += delta_x;
columnWidths[next_idx] -= delta_x;
}

innerTable.forceLayout();
}
}
}

gradient: Gradient {
GradientStop {
position: 0
color: Constants.genericTable.cellColor
}

GradientStop {
position: 1
color: Constants.genericTable.gradientColor
}

}
Expand All @@ -169,47 +175,32 @@ ColumnLayout {

}

Rectangle {
id: tableRect
TableView {
id: innerTable

height: 2000 // This is the only way I've been able to make it grow to take up the whole space
Layout.fillHeight: true
width: observationTable.width
Layout.fillWidth: true
color: "white"
border.color: "#dcdcdc"
border.width: 1

TableView {
id: innerTable

anchors.top: tableRect.top
Layout.fillHeight: true
Layout.fillWidth: true
width: observationTable.width
height: tableRect.height
rowSpacing: -1
clip: true
boundsBehavior: Flickable.StopAtBounds
columnWidthProvider: function(column) {
return columnWidths[column];
}
onWidthChanged: {
forceLayout();
}
model: observationTableModel

delegate: TableCellDelegate {
implicitHeight: Constants.genericTable.cellHeight
font: tableFont
}
columnSpacing: -1
rowSpacing: -1
clip: true
boundsBehavior: Flickable.StopAtBounds
columnWidthProvider: function(column) {
return columnWidths[column];
}
onWidthChanged: {
forceLayout();
}
model: observationTableModel

ScrollBar.horizontal: ScrollBar {
}
delegate: TableCellDelegate {
implicitHeight: Constants.genericTable.cellHeight
font: tableFont
}

ScrollBar.vertical: ScrollBar {
}
ScrollBar.horizontal: ScrollBar {
}

ScrollBar.vertical: ScrollBar {
}

}
Expand Down