3rdparty/RibbonUI: Update.

This commit is contained in:
Mentalflow 2024-04-01 23:44:00 +08:00
parent 491961daf1
commit f1f44c0d2d
Signed by: Mentalflow
GPG Key ID: 5AE68D4401A2EE71
5 changed files with 2 additions and 126 deletions

2
3rdparty/RibbonUI vendored

@ -1 +1 @@
Subproject commit 97c6b7cb0d43c068eba9db14beda88e645df0e2b
Subproject commit 95ddf6da9a56ca169b481e3deb2a435d7c70f324

View File

@ -44,7 +44,6 @@ set(
set(
qml_files qml/Main.qml qml/components/ZigBeeFrame.qml
qml/components/RibbonMessageListView.qml qml/components/RibbonMessage.qml
qml/components/ZigBeeMessage.qml qml/components/SerialPortAssistant.qml
qml/components/ZigBeeDataView.qml qml/components/TabBar.qml qml/components/CenterView.qml
qml/components/ListTable.qml qml/components/DeviceList.qml qml/components/KeysList.qml

View File

@ -1,55 +0,0 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import RibbonUI
Rectangle{
id: bubble
color: "transparent"
property double padding: 10
default property alias content: message_layout.data
property var data_model: model
property int font_size: 13
property string sender_text: "sender"
width: ListView.view.width
height: bubble_layout.height + padding*2
ColumnLayout{
id: bubble_layout
anchors{
top: parent.top
topMargin: parent.padding
}
layoutDirection: data_model.recieved ? Qt.LeftToRight : Qt.RightToLeft
Component.onCompleted: {
if (data_model.recieved)
{
anchors.left = parent.left
anchors.leftMargin = parent.padding
}
else{
anchors.right = parent.right
anchors.rightMargin = parent.padding
}
}
RibbonText{
id: sender_text
text: bubble.sender_text
padding: bubble.padding
color: RibbonTheme.dark_mode ? "white" : "black"
}
RibbonRectangle{
id: bubble_bg
color: data_model.recieved ? RibbonTheme.dark_mode ? "#202020" : "#FFFFFF" : RibbonTheme.dark_mode ? "#272727" : "#4397F7"
height: message_layout.height + bubble.padding*2
width: message_layout.width + bubble.padding*2
radius: 10
topLeftRadius: data_model.recieved ? 2 : bubble.padding
topRightRadius: !data_model.recieved ? 2 : bubble.padding
ColumnLayout{
id: message_layout
anchors.centerIn: parent
}
}
}
}

View File

@ -1,64 +0,0 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import RibbonUI
RibbonView{
id: view
anchors{
top: parent.top
bottom: parent.bottom
}
spacing: 0
property int max_msg_num: 10
property bool auto_scroll_to_bottom: false
property int animation_time: 200
property alias delegate: message_list.delegate
property alias message_model: message_model
property alias view: message_list
ListModel{
id: message_model
onCountChanged: auto_scroll_btn_timer.restart()
}
Timer{
id: auto_scroll_btn_timer
interval: animation_time
repeat: false
onTriggered: {
if(view.auto_scroll_to_bottom)
view.scroll_to_bottom()
}
}
ListView{
id: message_list
cacheBuffer: message_list.height * 2
Layout.alignment: Qt.AlignHCenter
Layout.preferredHeight: parent.height
Layout.preferredWidth: parent.width
model: message_model
add: Transition {
NumberAnimation {
properties: "y"
from: message_list.height
duration: animation_time
}
}
ScrollBar.vertical: RibbonScrollBar {
anchors.right: message_list.right
anchors.rightMargin: 2
}
}
function scroll_to_up(){
message_list.positionViewAtBeginning()
}
function scroll_to_bottom(){
message_list.positionViewAtEnd()
}
}

View File

@ -103,17 +103,13 @@ Item{
height: parent.height
RibbonMessageListView{
id: data_view
anchors.fill: parent
top_padding: control.top_padding + data_title_bar.height + (!RibbonTheme.modern_style ? 10 : 0)
bottom_padding: bottom_bar.height
width: parent.width / 2
delegate: ZigBeeMessage{
show_tooltip: control.show_tooltip
component_width: data_view.width / 2
}
view.onHeightChanged: {
if (control.auto_scroll_to_bottom)
scroll_to_bottom()
}
Event{
id:data_view_event
type: "zigbee_recv_data_view"