Files
z-bar-qt/Modules/Settings/Controls/SettingsPage.qml
T
zach 578a10c950
Python / lint-format (pull_request) Successful in 27s
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 30s
Python / test (pull_request) Successful in 32s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m6s
clipboard preview leading tab trimming while preserving indentation + proper width calculations
2026-06-15 18:23:56 +02:00

77 lines
1.6 KiB
QML

import QtQuick
import QtQuick.Controls
import qs.Components
import qs.Config
import qs.Helpers
Item {
id: root
default property alias contentData: clayout.data
function scrollToSectionAndHighlight(sectionId: string, settingName: string): bool {
for (let i = 0; i < clayout.children.length; i++) {
const section = clayout.children[i];
if (section.sectionId === sectionId) {
const targetY = section.y - Appearance.padding.normal;
flickable.contentY = Math.max(0, Math.min(targetY, flickable.contentHeight - flickable.height));
SettingsHighlight.highlight(settingName);
return true;
}
}
return false;
}
CustomFlickable {
id: flickable
anchors.fill: parent
// for future:
// anchors.leftMargin: Appearance.padding.extraLarge
// anchors.rightMargin: Appearance.padding.extraLarge
clip: true
contentHeight: clayout.implicitHeight + clayout.anchors.margins * 2
CustomScrollBar.vertical: CustomScrollBar {
flickable: flickable
}
TapHandler {
acceptedButtons: Qt.LeftButton
onTapped: function (eventPoint) {
const menu = SettingsDropdowns.activeMenu;
if (!menu)
return;
const p = eventPoint.scenePosition;
if (SettingsDropdowns.hit(SettingsDropdowns.activeTrigger, p))
return;
if (SettingsDropdowns.hit(menu, p))
return;
SettingsDropdowns.closeActive();
}
}
Column {
id: clayout
anchors.left: parent.left
anchors.margins: Appearance.padding.extraSmall
anchors.right: parent.right
anchors.top: parent.top
spacing: Appearance.spacing.small
// move: Transition {
// Anim {
// properties: "y"
// }
// }
}
}
}