mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-10 07:25:37 -05:00
fix Notepad warning
This commit is contained in:
@@ -300,7 +300,7 @@ PanelWindow {
|
|||||||
ScrollBar.vertical.visible: false
|
ScrollBar.vertical.visible: false
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
spacing: Theme.spacingXXS
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: SessionData.notepadTabs
|
model: SessionData.notepadTabs
|
||||||
@@ -312,8 +312,15 @@ PanelWindow {
|
|||||||
readonly property bool isActive: SessionData.notepadCurrentTabIndex === index
|
readonly property bool isActive: SessionData.notepadCurrentTabIndex === index
|
||||||
readonly property bool tabHasChanges: modelData.content !== modelData.lastSavedContent
|
readonly property bool tabHasChanges: modelData.content !== modelData.lastSavedContent
|
||||||
readonly property bool isHovered: tabMouseArea.containsMouse && !closeMouseArea.containsMouse
|
readonly property bool isHovered: tabMouseArea.containsMouse && !closeMouseArea.containsMouse
|
||||||
|
readonly property real calculatedWidth: {
|
||||||
|
const textWidth = tabText.paintedWidth || 100
|
||||||
|
const closeButtonWidth = SessionData.notepadTabs.length > 1 ? 20 : 0
|
||||||
|
const spacing = Theme.spacingXS
|
||||||
|
const padding = Theme.spacingM * 2
|
||||||
|
return Math.max(120, Math.min(200, textWidth + closeButtonWidth + spacing + padding))
|
||||||
|
}
|
||||||
|
|
||||||
width: Math.max(120, Math.min(200, tabContent.implicitWidth + Theme.spacingM * 2))
|
width: calculatedWidth
|
||||||
height: 32
|
height: 32
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: isActive ? Theme.primaryPressed : isHovered ? Theme.primaryHoverLight : "transparent"
|
color: isActive ? Theme.primaryPressed : isHovered ? Theme.primaryHoverLight : "transparent"
|
||||||
@@ -336,6 +343,7 @@ PanelWindow {
|
|||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
id: tabText
|
||||||
text: (tabHasChanges ? "● " : "") + (modelData.title || "Untitled")
|
text: (tabHasChanges ? "● " : "") + (modelData.title || "Untitled")
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: isActive ? Theme.primary : Theme.surfaceText
|
color: isActive ? Theme.primary : Theme.surfaceText
|
||||||
|
|||||||
Reference in New Issue
Block a user