fix: 无 IP 地址时网卡名在接口信息区垂直居中

接口信息区改为外层 Item 固定高度 + 内层 ColumnLayout anchors.centerIn,
无 IP 地址时单行内容在区域内垂直居中,避免贴顶偏上
This commit is contained in:
2026-08-08 20:54:10 +08:00
parent e7f0200da4
commit 7ebfa5b74e
+12 -5
View File
@@ -122,13 +122,20 @@ Control {
// ==================== 分区1:接口信息 ====================
// 类型图标 + 接口名 + IPv4 一行,IPv6 截断显示一行
ColumnLayout {
// 外层 Item 固定高度 + 内层 ColumnLayout anchors.centerIn:
// 无 IP 地址时内容在区域内垂直居中,避免单行内容贴顶导致网卡名偏上
Item {
Layout.fillWidth: true
// 最小高度防止无 IP 地址时区域塌陷导致间距比例失调
Layout.minimumHeight: 40
spacing: 4
// preferredHeight 40 为无 IP 时的最小高度;有 IP/IPv6 时内容自然撑高
Layout.preferredHeight: Math.max(40, ifaceCol.implicitHeight)
visible: popup.ready
ColumnLayout {
id: ifaceCol
anchors.centerIn: parent
width: parent.width
spacing: 4
// 行1:类型图标 + 接口名 + · + IPv4
// 拆分为独立 Text 元素,使接口名用 primaryText 跟随用户 textColor,
// 图标和 IPv4 保持系统主题色(tertiaryText/secondaryText),层次分明
@@ -162,7 +169,6 @@ Control {
// 行2:IPv6 地址(超长截断 + hover tooltip 显示完整地址)
Text {
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.maximumWidth: 300
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Math.round(12 * popup.fontScale)
@@ -183,6 +189,7 @@ Control {
}
}
}
}
// 分隔线1
Rectangle {