mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2026-02-08 00:32:27 +00:00
Fix terminal size not displayed when resizing.
This commit is contained in:
@@ -27,7 +27,7 @@ import QMLTermWidget 2.0
|
||||
import "menus"
|
||||
import "utils.js" as Utils
|
||||
|
||||
Item{
|
||||
Item {
|
||||
id: preprocessedTerminal
|
||||
signal sessionFinished()
|
||||
|
||||
|
||||
@@ -21,15 +21,13 @@ import QtQuick 2.2
|
||||
|
||||
Rectangle {
|
||||
property size terminalSize
|
||||
property real topOpacity: 0.6
|
||||
property real topOpacity: 0.5
|
||||
|
||||
width: textSize.width * 2
|
||||
height: textSize.height * 2
|
||||
radius: 5
|
||||
border.width: 2
|
||||
border.color: "white"
|
||||
color: "black"
|
||||
opacity: sizetimer.running ? 0.6 : 0.0
|
||||
opacity: sizetimer.running ? 0.5 : 0.0
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQml.Models
|
||||
|
||||
Item {
|
||||
id: tabsRoot
|
||||
|
||||
readonly property int innerPadding: 6
|
||||
readonly property string currentTitle: tabsModel.get(currentIndex).title ?? "cool-retro-term"
|
||||
readonly property size terminalSize: stack.currentItem ? stack.currentItem.terminalSize : Qt.size(0, 0)
|
||||
property alias currentIndex: tabBar.currentIndex
|
||||
readonly property int count: tabsModel.count
|
||||
property var hostWindow
|
||||
property size terminalSize: Qt.size(0, 0)
|
||||
|
||||
function normalizeTitle(rawTitle) {
|
||||
if (rawTitle === undefined || rawTitle === null) {
|
||||
@@ -45,7 +45,7 @@ Item {
|
||||
|
||||
function closeTab(index) {
|
||||
if (tabsModel.count <= 1) {
|
||||
hostWindow.close()
|
||||
terminalWindow.close()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -132,10 +132,20 @@ Item {
|
||||
TerminalContainer {
|
||||
id: terminalContainer
|
||||
hasFocus: terminalWindow.active && StackLayout.isCurrentItem
|
||||
|
||||
onTerminalSizeChanged: updateTerminalSize()
|
||||
|
||||
onTitleChanged: tabsModel.setProperty(index, "title", normalizeTitle(title))
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
onSessionFinished: tabsRoot.closeTab(index)
|
||||
|
||||
function updateTerminalSize() {
|
||||
// Every tab will have the same size so we can simply take the first one.
|
||||
if (index == 0) {
|
||||
tabsRoot.terminalSize = terminalSize
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ ApplicationWindow {
|
||||
id: terminalTabs
|
||||
width: parent.width
|
||||
height: (parent.height + Math.abs(y))
|
||||
hostWindow: terminalWindow
|
||||
}
|
||||
Loader {
|
||||
anchors.centerIn: parent
|
||||
|
||||
Reference in New Issue
Block a user