Browse Source

added improved time edit

pull/2/head
Skycoder42 7 years ago
parent
commit
133129651e
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 6
      src/imports/mvvmquick/TimeEdit.qml
  2. 32
      src/imports/mvvmquick/TimeTumbler.qml
  3. 3
      src/imports/mvvmquick/mvvmquick.pro
  4. 2
      src/imports/mvvmquick/qmldir

6
src/imports/mvvmquick/TimeEdit.qml

@ -46,7 +46,7 @@ RowLayout {
Layout.preferredWidth: 0 Layout.preferredWidth: 0
} }
Tumbler { TimeTumbler {
id: _hourTumbler id: _hourTumbler
model: { model: {
var model = new Array(is24Hours ? 24 : 12); var model = new Array(is24Hours ? 24 : 12);
@ -65,7 +65,7 @@ RowLayout {
Layout.minimumWidth: implicitWidth Layout.minimumWidth: implicitWidth
} }
Tumbler { TimeTumbler {
id: _minuteTumbler id: _minuteTumbler
model: { model: {
var mod = new Array(60) var mod = new Array(60)
@ -79,7 +79,7 @@ RowLayout {
onCurrentIndexChanged: Qt.callLater(recalcTime) onCurrentIndexChanged: Qt.callLater(recalcTime)
} }
Tumbler { TimeTumbler {
id: _amPmTumbler id: _amPmTumbler
visible: !is24Hours visible: !is24Hours
model: [ model: [

32
src/imports/mvvmquick/TimeTumbler.qml

@ -0,0 +1,32 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import de.skycoder42.QtMvvm.Quick 1.1
Tumbler {
id: _timeTumbler
function highlightColor() {
if(QuickPresenter.currentStyle === "Material")
return Material.accentColor;
else if(QuickPresenter.currentStyle === "Universal")
return Universal.accent;
else
return palette.highlight;
}
Rectangle {
anchors.centerIn: parent
anchors.verticalCenterOffset: -0.5 * currentItem.height
width: currentItem.width * 0.8
height: 1
color: parent.enabled ? highlightColor() : palette.text
}
Rectangle {
anchors.centerIn: parent
anchors.verticalCenterOffset: 0.5 * currentItem.height
width: currentItem.width * 0.8
height: 1
color: parent.enabled ? highlightColor() : palette.text
}
}

3
src/imports/mvvmquick/mvvmquick.pro

@ -54,7 +54,8 @@ QML_FILES += \
RoundMenuButton.qml \ RoundMenuButton.qml \
DecorLabel.qml \ DecorLabel.qml \
MsgDelegate.qml \ MsgDelegate.qml \
TimeEdit.qml TimeEdit.qml \
TimeTumbler.qml
RESOURCES += \ RESOURCES += \
qtmvvmquick_plugin.qrc qtmvvmquick_plugin.qrc

2
src/imports/mvvmquick/qmldir

@ -16,6 +16,8 @@ internal ListSection ListSection.qml
internal SectionListView SectionListView.qml internal SectionListView SectionListView.qml
internal OverviewListView OverviewListView.qml internal OverviewListView OverviewListView.qml
internal TimeTumbler TimeTumbler.qml
AlertDialog 1.0 AlertDialog.qml AlertDialog 1.0 AlertDialog.qml
ContrastToolBar 1.0 ContrastToolBar.qml ContrastToolBar 1.0 ContrastToolBar.qml
ToolBarLabel 1.0 ToolBarLabel.qml ToolBarLabel 1.0 ToolBarLabel.qml

Loading…
Cancel
Save