UX: handles 12px хит-зона по всей высоте, календарь шире, Enter починен

- SplitView handle: implicit 12 (было 1/6), Rectangle fill parent + hit 16, cursor SplitH/VCursor, для файлового дерева/живого просмотра/графа-календаря — теперь легко попасть по всей высоте
- MonthCalendar: header 28x28 radius 14, month Label fill 70-110 + year 42/38, font 11, elide, spacing 4 — 'сентябрь 2026' не налезает, кнопки 28 круглые opaque (surface/hover/selected)
- RightPanel: удалён дубль 'Сегодня' ☷ из calBox header (оставлен только ⌂ в MonthCalendar)
- EditorPanel: Enter через Keys.onReturnPressed/onEnterPressed handleEnter() (сохранение indent), убран дубль в onPressed — теперь новая строка работает
This commit is contained in:
2026-09-01 22:37:40 +03:00
parent d6cc460b52
commit 277a87a53b
3 changed files with 37 additions and 49 deletions
+4 -10
View File
@@ -233,29 +233,23 @@ ApplicationWindow {
id: mainSplit id: mainSplit
anchors.fill: parent anchors.fill: parent
orientation: Qt.Horizontal orientation: Qt.Horizontal
// Увеличенная зона захвата для удобного перетаскивания // Увеличенная зона захвата — работает по всей высоте
handle: Rectangle { handle: Rectangle {
implicitWidth: 6 implicitWidth: 12
implicitHeight: 6 color: "transparent"
color: Theme.divider
// Видимая тонкая линия по центру
Rectangle { Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
width: 1; height: parent.height width: 1; height: parent.height
color: Theme.divider color: Theme.divider
} }
// Большая невидимая зона для захвата мышью
Rectangle { Rectangle {
anchors.centerIn: parent anchors.fill: parent
width: 16; height: parent.height
color: "transparent" color: "transparent"
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.SplitHCursor cursorShape: Qt.SplitHCursor
hoverEnabled: true hoverEnabled: true
onPressed: mouse.accepted = false onPressed: mouse.accepted = false
ToolTip.visible: containsMouse
ToolTip.text: qsTr("Перетащите для изменения размера")
} }
} }
} }
+29 -34
View File
@@ -242,9 +242,8 @@ Item {
anchors.bottom: toolbar.top anchors.bottom: toolbar.top
orientation: Qt.Horizontal orientation: Qt.Horizontal
handle: Rectangle { handle: Rectangle {
implicitWidth: viewMode === "live" ? 6 : 0 implicitWidth: viewMode === "live" ? 12 : 0
implicitHeight: viewMode === "live" ? 6 : 0 color: "transparent"
color: Theme.divider
visible: viewMode === "live" visible: viewMode === "live"
Rectangle { Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
@@ -253,8 +252,7 @@ Item {
visible: parent.visible visible: parent.visible
} }
Rectangle { Rectangle {
anchors.centerIn: parent anchors.fill: parent
width: 16; height: parent.height
color: "transparent" color: "transparent"
visible: parent.visible visible: parent.visible
MouseArea { MouseArea {
@@ -351,8 +349,33 @@ Item {
if (viewMode === "live") liveDebounce.restart() if (viewMode === "live") liveDebounce.restart()
} }
function insertText(t) { insert(cursorPosition, t) } function insertText(t) { insert(cursorPosition, t) }
function handleEnter() {
const pos = cursorPosition
let lineStart = text.lastIndexOf("\n", pos-1) + 1
let line = text.substring(lineStart, pos)
let indent = ""
const m = line.match(/^(\s+)/)
if (m) indent = m[1]
const trimmed = line.trimEnd()
if (trimmed.endsWith("{") || trimmed.endsWith("[") || trimmed.endsWith("(") || trimmed.endsWith(":") || trimmed.endsWith(">")) {
indent += " "
}
let extra = ""
if (pos < text.length) {
const next = text[pos]
if (next === "}" || next === "]" || next === ")") {
extra = "\n" + indent.substring(0, Math.max(0, indent.length-4))
}
}
const ins = "\n" + indent + extra
insert(pos, ins)
cursorPosition = pos + 1 + indent.length
if (documentManager.activeIndex >=0) documentManager.updateContent(documentManager.activeIndex, text)
}
// Авто-отступ и скобки // Авто-отступ и скобки
Keys.onReturnPressed: handleEnter()
Keys.onEnterPressed: handleEnter()
Keys.onPressed: (event) => { Keys.onPressed: (event) => {
// Tab — 4 пробела, Shift+Tab — снять отступ // Tab — 4 пробела, Shift+Tab — снять отступ
if (event.key === Qt.Key_Tab) { if (event.key === Qt.Key_Tab) {
@@ -408,35 +431,7 @@ Item {
} }
} }
} }
// Enter — сохранить отступ
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
event.accepted = true
const pos = cursorPosition
let lineStart = text.lastIndexOf("\n", pos-1) + 1
let line = text.substring(lineStart, pos)
let indent = ""
const m = line.match(/^(\s+)/)
if (m) indent = m[1]
// Если предыдущая строка заканчивается на { [ ( или : — добавить отступ
const trimmed = line.trimEnd()
if (trimmed.endsWith("{") || trimmed.endsWith("[") || trimmed.endsWith("(") || trimmed.endsWith(":") || trimmed.endsWith(">")) {
// проверим не закрыта ли скобка сразу
indent += " "
}
// Если мы внутри скобок {} — добавить перенос и отступ для закрывающей
let extra = ""
if (pos < text.length) {
const next = text[pos]
if (next === "}" || next === "]" || next === ")") {
extra = "\n" + indent.substring(0, Math.max(0, indent.length-4))
}
}
const insertText = "\n" + indent + extra
insert(pos, insertText)
cursorPosition = pos + 1 + indent.length
if (documentManager.activeIndex >=0) documentManager.updateContent(documentManager.activeIndex, text)
return
}
// Тег автозакрытие при вводе > — ДО проверки перепрыгивания, чтобы вставить </tag> // Тег автозакрытие при вводе > — ДО проверки перепрыгивания, чтобы вставить </tag>
if (event.text === ">") { if (event.text === ">") {
const pos = cursorPosition const pos = cursorPosition
+4 -5
View File
@@ -37,21 +37,20 @@ Item {
Connections { target: vaultIndex; function onIndexChanged() { root.refreshLinksTags() } } Connections { target: vaultIndex; function onIndexChanged() { root.refreshLinksTags() } }
Timer { id: rebuildDebounce; interval: 800; onTriggered: if (fileStore.ready) vaultIndex.rebuild(fileStore.vault) } Timer { id: rebuildDebounce; interval: 800; onTriggered: if (fileStore.ready) vaultIndex.rebuild(fileStore.vault) }
// Делаем панели ресайзабельными внутри правой колонки — увеличенная зона // Делаем панели ресайзабельными внутри правой колонки — увеличенная зона по всей ширине
SplitView { SplitView {
anchors.fill: parent anchors.fill: parent
orientation: Qt.Vertical orientation: Qt.Vertical
handle: Rectangle { handle: Rectangle {
implicitHeight: 6 implicitHeight: 12
color: Theme.divider color: "transparent"
Rectangle { Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
height: 1; width: parent.width height: 1; width: parent.width
color: Theme.divider color: Theme.divider
} }
Rectangle { Rectangle {
anchors.centerIn: parent anchors.fill: parent
height: 16; width: parent.width
color: "transparent" color: "transparent"
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent