You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.5 KiB
QML

5 years ago
import QtQuick 2.15
import QtQuick.Window 2.15
5 years ago
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
5 years ago
import FishUI 1.0 as FishUI
FishUI.Window {
width: 640
height: 480
5 years ago
minimumWidth: 300
minimumHeight: 300
5 years ago
visible: true
5 years ago
title: qsTr("Text Editor")
5 years ago
5 years ago
headerItem: Item {
TabBar {
anchors.fill: parent
5 years ago
anchors.margins: FishUI.Units.smallSpacing / 2
5 years ago
5 years ago
currentIndex : _tabView.currentIndex
5 years ago
Repeater {
id: _repeater
5 years ago
model: _tabView.count
5 years ago
TabButton {
5 years ago
text: _tabView.contentModel.get(index).fileName
5 years ago
implicitHeight: parent.height
implicitWidth: Math.max(parent.width / _repeater.count, 200)
ToolTip.delay: 1000
ToolTip.timeout: 5000
hoverEnabled: true
ToolTip.visible: hovered
5 years ago
ToolTip.text: _tabView.contentModel.get(index).fileUrl
5 years ago
leftPadding: FishUI.Units.smallSpacing
rightPadding: FishUI.Units.smallSpacing
onClicked: {
5 years ago
_tabView.currentIndex = index
_tabView.currentItem.forceActiveFocus()
5 years ago
}
}
}
}
}
ColumnLayout {
5 years ago
anchors.fill: parent
5 years ago
spacing: 0
5 years ago
TabView {
id: _tabView
5 years ago
Layout.fillWidth: true
Layout.fillHeight: true
}
Item {
5 years ago
id: _bottomItem
z: 999
5 years ago
Layout.fillWidth: true
5 years ago
Layout.preferredHeight: 20 + FishUI.Units.smallSpacing
Rectangle {
anchors.fill: parent
color: FishUI.Theme.backgroundColor
}
5 years ago
ColumnLayout {
anchors.fill: parent
5 years ago
anchors.leftMargin: FishUI.Units.smallSpacing
anchors.rightMargin: FishUI.Units.smallSpacing
anchors.bottomMargin: FishUI.Units.smallSpacing
Label {
text: qsTr("Characters %1").arg(_tabView.currentItem.characterCount)
}
5 years ago
}
}
}
function addTab() {
5 years ago
_tabView.addTab(textEditorCompeont, {})
5 years ago
}
Component {
id: textEditorCompeont
TextEditor {
fileUrl: "file:///home/reion/Cutefish/core/notificationd/view.cpp"
}
}
Component.onCompleted: {
addTab()
addTab()
addTab()
5 years ago
}
}