From 1f208792b7e8a863bf6ea624340288856976f180 Mon Sep 17 00:00:00 2001 From: kateleet Date: Sat, 25 Dec 2021 01:48:50 +0800 Subject: [PATCH] feat(tabbar): add modified status --- qml/TextEditor.qml | 2 ++ qml/main.qml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/qml/TextEditor.qml b/qml/TextEditor.qml index 8513c65..ed803cf 100644 --- a/qml/TextEditor.qml +++ b/qml/TextEditor.qml @@ -9,6 +9,8 @@ import Cutefish.TextEditor 1.0 Item { id: control + property var tabName: document.fileName + (document.modified ? " *" : "") + property alias fileUrl: document.fileUrl property alias fileName: document.fileName property bool showLineNumbers: true diff --git a/qml/main.qml b/qml/main.qml index 150e6c1..dcadcc2 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -43,7 +43,7 @@ FishUI.Window { delegate: FishUI.TabButton { id: _tabBtn - text: _tabView.contentModel.get(index).fileName + text: _tabView.contentModel.get(index).tabName implicitHeight: _tabbar.height implicitWidth: Math.min(_tabbar.width / _tabbar.count, _tabBtn.contentWidth)