Browse Source

made MsgDelegate a exported baseclass

pull/2/head
Skycoder42 7 years ago
parent
commit
33870ad561
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 62
      src/imports/mvvmquick/MsgDelegate.qml
  2. 3
      src/imports/mvvmquick/mvvmquick.pro
  3. 1
      src/imports/mvvmquick/qmldir
  4. 32
      src/mvvmquick/ListDelegate.qml
  5. 38
      src/mvvmquick/MsgDelegate.qml

62
src/imports/mvvmquick/MsgDelegate.qml

@ -0,0 +1,62 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Quick 1.1
ItemDelegate {
id: _msgDelegate
property alias sourceComponent: _indicator.sourceComponent
property alias source: _indicator.source
property string editDialogType: type
signal showInput(string key, string title, string type, var defaultValue, var properties);
text: title
ToolTip.visible: pressed && tooltip != ""
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: tooltip
onPressAndHold: QuickPresenter.hapticLongPress()
onClicked: showInput(key, title, editDialogType, inputValue, properties)
contentItem: GridLayout {
columns: 2
rows: 2
Label {
id: _titleLabel
text: _msgDelegate.text
Layout.row: 0
Layout.column: 0
font.bold: true
elide: Label.ElideRight
Layout.fillWidth: true
}
Label {
id: _peviewLabel
visible: preview
Layout.row: 1
Layout.column: 0
text: preview
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
Loader {
id: _indicator
visible: item
asynchronous: false
clip: true
Layout.row: 0
Layout.column: 1
Layout.rowSpan: 2
Layout.minimumWidth: item ? implicitWidth : 0
Layout.maximumWidth: item ? implicitWidth : 0
}
}
}

3
src/imports/mvvmquick/mvvmquick.pro

@ -52,7 +52,8 @@ QML_FILES += \
SettingsView11.qml \ SettingsView11.qml \
SearchBar.qml \ SearchBar.qml \
RoundMenuButton.qml \ RoundMenuButton.qml \
DecorLabel.qml DecorLabel.qml \
MsgDelegate.qml
RESOURCES += \ RESOURCES += \
qtmvvmquick_plugin.qrc qtmvvmquick_plugin.qrc

1
src/imports/mvvmquick/qmldir

@ -26,6 +26,7 @@ MenuButton 1.0 MenuButton.qml
SearchBar 1.1 SearchBar.qml SearchBar 1.1 SearchBar.qml
RoundMenuButton 1.1 RoundMenuButton.qml RoundMenuButton 1.1 RoundMenuButton.qml
DecorLabel 1.1 DecorLabel.qml DecorLabel 1.1 DecorLabel.qml
MsgDelegate 1.1 MsgDelegate.qml
PresenterProgress 1.0 PresenterProgress.qml PresenterProgress 1.0 PresenterProgress.qml
PresentingStackView 1.0 PresentingStackView.qml PresentingStackView 1.0 PresentingStackView.qml

32
src/mvvmquick/ListDelegate.qml

@ -3,35 +3,7 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Quick 1.1 import de.skycoder42.QtMvvm.Quick 1.1
ItemDelegate { MsgDelegate {
id: _listDelegate id: _listDelegate
editDialogType: "radiolist"
text: title
signal showInput(string key, string title, string type, var defaultValue, var properties);
ToolTip.visible: pressed && tooltip != ""
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: tooltip
onPressAndHold: QuickPresenter.hapticLongPress()
contentItem: ColumnLayout {
Label {
id: _titleLabel
text: _listDelegate.text
font.bold: true
elide: Label.ElideRight
Layout.fillWidth: true
}
Label {
id: _previewLabel
visible: preview
text: preview
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
}
onClicked: showInput(key, title, "radiolist", inputValue, properties)
} }

38
src/mvvmquick/MsgDelegate.qml

@ -1,37 +1,3 @@
import QtQuick 2.10 import de.skycoder42.QtMvvm.Quick 1.1 as QtMvvm
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Quick 1.1
ItemDelegate { QtMvvm.MsgDelegate {}
id: _msgDelegate
text: title
signal showInput(string key, string title, string type, var defaultValue, var properties);
ToolTip.visible: pressed && tooltip != ""
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: tooltip
onPressAndHold: QuickPresenter.hapticLongPress()
contentItem: ColumnLayout {
Label {
id: _titleLabel
text: _msgDelegate.text
font.bold: true
elide: Label.ElideRight
Layout.fillWidth: true
}
Label {
id: _previewLabel
visible: preview
text: preview
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
}
onClicked: showInput(key, title, type, inputValue, properties)
}

Loading…
Cancel
Save