1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-07 22:15:38 -05:00

Update Notepad Rendering

This commit is contained in:
purian23
2025-11-08 22:23:30 -05:00
parent 84e19f8565
commit c8e382e2dd
5 changed files with 16 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ pragma ComponentBehavior: Bound
Item { Item {
id: root id: root
property real devicePixelRatio: 1
property bool fileDialogOpen: false property bool fileDialogOpen: false
property string currentFileName: "" property string currentFileName: ""
property url currentFileUrl property url currentFileUrl
@@ -150,6 +151,7 @@ Item {
id: tabBar id: tabBar
width: parent.width width: parent.width
contentLoaded: textEditor.contentLoaded contentLoaded: textEditor.contentLoaded
devicePixelRatio: root.devicePixelRatio
onTabSwitched: (tabIndex) => { onTabSwitched: (tabIndex) => {
switchToTab(tabIndex) switchToTab(tabIndex)
@@ -168,6 +170,7 @@ Item {
id: textEditor id: textEditor
width: parent.width width: parent.width
height: parent.height - tabBar.height - Theme.spacingM * 2 height: parent.height - tabBar.height - Theme.spacingM * 2
devicePixelRatio: root.devicePixelRatio
onSaveRequested: { onSaveRequested: {
if (currentTab && !currentTab.isTemporary && currentTab.filePath) { if (currentTab && !currentTab.isTemporary && currentTab.filePath) {
@@ -214,6 +217,7 @@ Item {
id: notepadSettings id: notepadSettings
anchors.fill: parent anchors.fill: parent
isVisible: showSettingsMenu isVisible: showSettingsMenu
devicePixelRatio: root.devicePixelRatio
onSettingsRequested: showSettingsMenu = !showSettingsMenu onSettingsRequested: showSettingsMenu = !showSettingsMenu
onFindRequested: { onFindRequested: {
showSettingsMenu = false showSettingsMenu = false

View File

@@ -9,6 +9,7 @@ pragma ComponentBehavior: Bound
Item { Item {
id: root id: root
property real devicePixelRatio: 1
property bool isVisible: false property bool isVisible: false
property var cachedFontFamilies: [] property var cachedFontFamilies: []
property var cachedMonoFamilies: [] property var cachedMonoFamilies: []

View File

@@ -9,6 +9,7 @@ pragma ComponentBehavior: Bound
Column { Column {
id: root id: root
property real devicePixelRatio: 1
property var currentTab: NotepadStorageService.tabs.length > NotepadStorageService.currentTabIndex ? NotepadStorageService.tabs[NotepadStorageService.currentTabIndex] : null property var currentTab: NotepadStorageService.tabs.length > NotepadStorageService.currentTabIndex ? NotepadStorageService.tabs[NotepadStorageService.currentTabIndex] : null
property bool contentLoaded: false property bool contentLoaded: false

View File

@@ -11,6 +11,7 @@ pragma ComponentBehavior: Bound
Column { Column {
id: root id: root
property real devicePixelRatio: 1
property alias text: textArea.text property alias text: textArea.text
property alias textArea: textArea property alias textArea: textArea
property bool contentLoaded: false property bool contentLoaded: false

View File

@@ -3,6 +3,7 @@ import QtQuick.Controls
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import qs.Common import qs.Common
import qs.Services
import qs.Widgets import qs.Widgets
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
@@ -83,7 +84,7 @@ PanelWindow {
StyledRect { StyledRect {
id: contentRect id: contentRect
readonly property real dpr: root.modelData?.devicePixelRatio || 1 readonly property real dpr: CompositorService.getScreenScale(root.modelData)
layer.enabled: true layer.enabled: true
layer.smooth: false layer.smooth: false
layer.textureSize: Qt.size(width * dpr, height * dpr) layer.textureSize: Qt.size(width * dpr, height * dpr)
@@ -182,8 +183,15 @@ PanelWindow {
anchors.bottomMargin: Theme.spacingL anchors.bottomMargin: Theme.spacingL
Loader { Loader {
id: contentLoader
anchors.fill: parent anchors.fill: parent
sourceComponent: root.content sourceComponent: root.content
onLoaded: {
if (item && "devicePixelRatio" in item) {
item.devicePixelRatio = contentRect.dpr
}
}
} }
} }
} }