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:
@@ -21,15 +21,13 @@ import QtQuick 2.2
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
property size terminalSize
|
property size terminalSize
|
||||||
property real topOpacity: 0.6
|
property real topOpacity: 0.5
|
||||||
|
|
||||||
width: textSize.width * 2
|
width: textSize.width * 2
|
||||||
height: textSize.height * 2
|
height: textSize.height * 2
|
||||||
radius: 5
|
radius: 5
|
||||||
border.width: 2
|
|
||||||
border.color: "white"
|
|
||||||
color: "black"
|
color: "black"
|
||||||
opacity: sizetimer.running ? 0.6 : 0.0
|
opacity: sizetimer.running ? 0.5 : 0.0
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
|||||||
@@ -20,16 +20,16 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import QtQml.Models
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: tabsRoot
|
id: tabsRoot
|
||||||
|
|
||||||
readonly property int innerPadding: 6
|
readonly property int innerPadding: 6
|
||||||
readonly property string currentTitle: tabsModel.get(currentIndex).title ?? "cool-retro-term"
|
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
|
property alias currentIndex: tabBar.currentIndex
|
||||||
readonly property int count: tabsModel.count
|
readonly property int count: tabsModel.count
|
||||||
property var hostWindow
|
property size terminalSize: Qt.size(0, 0)
|
||||||
|
|
||||||
function normalizeTitle(rawTitle) {
|
function normalizeTitle(rawTitle) {
|
||||||
if (rawTitle === undefined || rawTitle === null) {
|
if (rawTitle === undefined || rawTitle === null) {
|
||||||
@@ -45,7 +45,7 @@ Item {
|
|||||||
|
|
||||||
function closeTab(index) {
|
function closeTab(index) {
|
||||||
if (tabsModel.count <= 1) {
|
if (tabsModel.count <= 1) {
|
||||||
hostWindow.close()
|
terminalWindow.close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,10 +132,20 @@ Item {
|
|||||||
TerminalContainer {
|
TerminalContainer {
|
||||||
id: terminalContainer
|
id: terminalContainer
|
||||||
hasFocus: terminalWindow.active && StackLayout.isCurrentItem
|
hasFocus: terminalWindow.active && StackLayout.isCurrentItem
|
||||||
|
|
||||||
|
onTerminalSizeChanged: updateTerminalSize()
|
||||||
|
|
||||||
onTitleChanged: tabsModel.setProperty(index, "title", normalizeTitle(title))
|
onTitleChanged: tabsModel.setProperty(index, "title", normalizeTitle(title))
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
onSessionFinished: tabsRoot.closeTab(index)
|
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
|
id: terminalTabs
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: (parent.height + Math.abs(y))
|
height: (parent.height + Math.abs(y))
|
||||||
hostWindow: terminalWindow
|
|
||||||
}
|
}
|
||||||
Loader {
|
Loader {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|||||||
Reference in New Issue
Block a user