Browse Source

use scrollview everywhere

partially untested for datasync
pull/2/head
Skycoder42 7 years ago
parent
commit
bb00d47b21
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 94
      src/imports/mvvmdatasyncquick/ChangeRemoteView.qml
  2. 133
      src/imports/mvvmdatasyncquick/DataSyncView.qml
  3. 56
      src/imports/mvvmdatasyncquick/NetworkExchangeView.qml
  4. 9
      src/imports/mvvmquick/ListSection.qml
  5. 12
      src/imports/mvvmquick/SettingsView.qml

94
src/imports/mvvmdatasyncquick/ChangeRemoteView.qml

@ -143,67 +143,69 @@ Page {
Label { Label {
text: qsTr("Extra Headers:") text: qsTr("Extra Headers:")
Layout.fillWidth: true Layout.fillWidth: true
color: _headerList.focus ? _accessKeyEdit.selectionColor : palette.text color: _headerScrollView.focus ? _accessKeyEdit.selectionColor : palette.text
opacity: _headerList.focus ? 1 : 0.5 opacity: _headerScrollView.focus ? 1 : 0.5
} }
ListView { ScrollView {
id: _headerList id: _headerScrollView
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
clip: true clip: true
model: viewModel.headerModel ListView {
id: _headerList
ScrollBar.vertical: ScrollBar {} model: viewModel.headerModel
delegate: ItemDelegate { delegate: ItemDelegate {
width: parent.width width: _headerScrollView.width
text: qsTr("%1: %2").arg(key).arg(value) text: qsTr("%1: %2").arg(key).arg(value)
Button { Button {
id: _rmButton id: _rmButton
flat: true flat: true
icon.width: 24 icon.width: 24
icon.height: 24 icon.height: 24
icon.name: "user-trash" icon.name: "user-trash"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_delete_forever.svg" icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_delete_forever.svg"
anchors.right: parent.right anchors.right: parent.right
implicitHeight: parent.height implicitHeight: parent.height
implicitWidth: implicitHeight implicitWidth: implicitHeight
onClicked: viewModel.removeHeaderConfig(index) onClicked: viewModel.removeHeaderConfig(index)
}
} }
}
footer: RowLayout { footer: RowLayout {
width: parent.width width: _headerScrollView.width
TextField { TextField {
id: _keyEdit id: _keyEdit
placeholderText: qsTr("Key") placeholderText: qsTr("Key")
Layout.fillWidth: true Layout.fillWidth: true
} }
TextField { TextField {
id: _valueEdit id: _valueEdit
placeholderText: qsTr("Value") placeholderText: qsTr("Value")
Layout.fillWidth: true Layout.fillWidth: true
} }
Button { Button {
id: _addButton id: _addButton
flat: true flat: true
enabled: _keyEdit.text !== "" enabled: _keyEdit.text !== ""
icon.width: 24 icon.width: 24
icon.height: 24 icon.height: 24
icon.name: "list-add" icon.name: "list-add"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_add.svg" icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_add.svg"
onClicked: { onClicked: {
viewModel.addHeaderConfig(_keyEdit.text, _valueEdit.text); viewModel.addHeaderConfig(_keyEdit.text, _valueEdit.text);
_keyEdit.clear(); _keyEdit.clear();
_valueEdit.clear(); _valueEdit.clear();
}
} }
} }
} }

133
src/imports/mvvmdatasyncquick/DataSyncView.qml

@ -161,87 +161,90 @@ Page {
text: qsTr("Other Devices:") text: qsTr("Other Devices:")
} }
ListView { ScrollView {
id: _devicesList id: _devicesScrollView
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
clip: true clip: true
model: viewModel.sortedModel
ScrollBar.vertical: ScrollBar {} ListView {
id: _devicesList
delegate: SwipeDelegate { model: viewModel.sortedModel
id: _swipeDelegate delegate: SwipeDelegate {
width: parent.width id: _swipeDelegate
width: _devicesScrollView.width
contentItem: ColumnLayout { contentItem: ColumnLayout {
id: _delegateLayout id: _delegateLayout
spacing: 8 spacing: 8
Label { Label {
id: _nameLabel id: _nameLabel
Layout.fillWidth: true Layout.fillWidth: true
text: name text: name
} }
Label { Label {
id: _fpLabel id: _fpLabel
font.pointSize: _nameLabel.font.pointSize * 0.8 font.pointSize: _nameLabel.font.pointSize * 0.8
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 8 Layout.leftMargin: 8
text: fingerPrint text: fingerPrint
elide: Text.ElideMiddle elide: Text.ElideMiddle
opacity: 0.75 opacity: 0.75
}
} }
}
ListView.onRemove: SequentialAnimation { ListView.onRemove: SequentialAnimation {
PropertyAction { PropertyAction {
target: _swipeDelegate target: _swipeDelegate
property: "ListView.delayRemove" property: "ListView.delayRemove"
value: true value: true
} }
NumberAnimation { NumberAnimation {
target: _swipeDelegate target: _swipeDelegate
property: "height" property: "height"
to: 0 to: 0
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
PropertyAction { PropertyAction {
target: _swipeDelegate target: _swipeDelegate
property: "ListView.delayRemove" property: "ListView.delayRemove"
value: false value: false
}
} }
}
swipe.right: Rectangle { swipe.right: Rectangle {
height: parent.height height: _devicesScrollView.height
width: height width: height
anchors.right: parent.right anchors.right: parent.right
color: { color: {
if(QuickPresenter.currentStyle === "Material") if(QuickPresenter.currentStyle === "Material")
return Material.color(Material.Red); return Material.color(Material.Red);
else if(QuickPresenter.currentStyle === "Universal") else if(QuickPresenter.currentStyle === "Universal")
return Universal.color(Universal.Red); return Universal.color(Universal.Red);
else else
return "#FF0000"; return "#FF0000";
} }
ActionButton { ActionButton {
anchors.centerIn: parent anchors.centerIn: parent
implicitHeight: parent.height implicitHeight: parent.height
implicitWidth: parent.width implicitWidth: parent.width
icon.name: "user-trash" icon.name: "user-trash"
icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_delete_forever.svg" icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_delete_forever.svg"
text: qsTr("Remove Device") text: qsTr("Remove Device")
Material.foreground: "white" Material.foreground: "white"
Universal.foreground: "white" Universal.foreground: "white"
onClicked: { onClicked: {
_swipeDelegate.swipe.close(); _swipeDelegate.swipe.close();
viewModel.removeDevice(index) viewModel.removeDevice(index)
}
} }
} }
} }

56
src/imports/mvvmdatasyncquick/NetworkExchangeView.qml

@ -114,40 +114,42 @@ Page {
} }
} }
ListView { ScrollView {
id: _exchangeList id: _exchangeScrollView
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
clip: true clip: true
model: viewModel.sortedModel ListView {
id: _exchangeList
ScrollBar.vertical: ScrollBar {}
model: viewModel.sortedModel
delegate: ItemDelegate { delegate: ItemDelegate {
width: parent.width width: _exchangeScrollView.width
contentItem: ColumnLayout { contentItem: ColumnLayout {
id: _delegateLayout id: _delegateLayout
spacing: 8 spacing: 8
Label { Label {
id: _nameLabel id: _nameLabel
Layout.fillWidth: true Layout.fillWidth: true
text: name text: name
}
Label {
id: _addressLabel
font.pointSize: _nameLabel.font.pointSize * 0.8
Layout.fillWidth: true
Layout.leftMargin: 8
text: address
opacity: 0.75
}
} }
Label { onClicked: viewModel.exportTo(index)
id: _addressLabel
font.pointSize: _nameLabel.font.pointSize * 0.8
Layout.fillWidth: true
Layout.leftMargin: 8
text: address
opacity: 0.75
}
} }
onClicked: viewModel.exportTo(index)
} }
} }
} }

9
src/imports/mvvmquick/ListSection.qml

@ -16,14 +16,7 @@ Label {
background: Rectangle { background: Rectangle {
anchors.fill: parent anchors.fill: parent
color: { color: "transparent"
if(QuickPresenter.currentStyle === "Material")
return Material.background;
else if(QuickPresenter.currentStyle === "Universal")
return Universal.background;
else
return "white";
}
Rectangle { Rectangle {
anchors.left: parent.left anchors.left: parent.left

12
src/imports/mvvmquick/SettingsView.qml

@ -231,17 +231,17 @@ Page {
id: _overviewComponent id: _overviewComponent
ScrollView { ScrollView {
id: __ovScrollView
property alias model: __ovListView.model property alias model: __ovListView.model
property alias showSections: __ovListView.showSections property alias showSections: __ovListView.showSections
anchors.fill: parent
clip: true clip: true
OverviewListView { OverviewListView {
id: __ovListView id: __ovListView
builder: _builder builder: _builder
Component.onCompleted: _settingsStack.push(__ovListView)
} }
Component.onCompleted: _settingsStack.push(__ovScrollView)
} }
} }
@ -249,16 +249,16 @@ Page {
id: _sectionViewComponent id: _sectionViewComponent
ScrollView { ScrollView {
id: __secScrollView
property alias model: __secListView.model property alias model: __secListView.model
anchors.fill: parent
clip: true clip: true
SectionListView { SectionListView {
id: __secListView id: __secListView
builder: _builder builder: _builder
Component.onCompleted: _settingsStack.push(__secListView)
} }
Component.onCompleted: _settingsStack.push(__secScrollView)
} }
} }

Loading…
Cancel
Save