1
0
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:
Filippo Scognamiglio
2026-01-19 00:13:45 +01:00
parent a6a7768e42
commit 09f813a7e0
4 changed files with 16 additions and 9 deletions

View File

@@ -27,7 +27,7 @@ import QMLTermWidget 2.0
import "menus"
import "utils.js" as Utils
Item{
Item {
id: preprocessedTerminal
signal sessionFinished()

View File

@@ -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 {

View File

@@ -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
}
}
}
}
}

View File

@@ -73,7 +73,6 @@ ApplicationWindow {
id: terminalTabs
width: parent.width
height: (parent.height + Math.abs(y))
hostWindow: terminalWindow
}
Loader {
anchors.centerIn: parent