SettingsPanel: converted to layout
This commit is contained in:
parent
cbffc1a14c
commit
9a14a5cc10
1 changed files with 232 additions and 202 deletions
|
|
@ -267,9 +267,18 @@ NPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
panelContent: Rectangle {
|
panelContent: Rectangle {
|
||||||
|
color: Color.transparent
|
||||||
|
|
||||||
|
// Main layout container that fills the panel
|
||||||
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Style.marginL * scaling
|
anchors.margins: Style.marginL * scaling
|
||||||
color: Color.transparent
|
spacing: 0
|
||||||
|
|
||||||
|
// Keyboard shortcuts container
|
||||||
|
Item {
|
||||||
|
Layout.preferredWidth: 0
|
||||||
|
Layout.preferredHeight: 0
|
||||||
|
|
||||||
// Scrolling via keyboard
|
// Scrolling via keyboard
|
||||||
Shortcut {
|
Shortcut {
|
||||||
|
|
@ -320,15 +329,20 @@ NPanel {
|
||||||
onActivated: root.selectPreviousTab()
|
onActivated: root.selectPreviousTab()
|
||||||
enabled: root.opened
|
enabled: root.opened
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main content area
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
spacing: Style.marginM * scaling
|
spacing: Style.marginM * scaling
|
||||||
|
|
||||||
|
// Sidebar
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: sidebar
|
id: sidebar
|
||||||
Layout.preferredWidth: 220 * scaling
|
Layout.preferredWidth: 220 * scaling
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
color: Color.mSurfaceVariant
|
color: Color.mSurfaceVariant
|
||||||
border.color: Color.mOutline
|
border.color: Color.mOutline
|
||||||
border.width: Math.max(1, Style.borderS * scaling)
|
border.width: Math.max(1, Style.borderS * scaling)
|
||||||
|
|
@ -351,7 +365,7 @@ NPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Style.marginS * scaling
|
anchors.margins: Style.marginS * scaling
|
||||||
spacing: Style.marginXS * 1.5 * scaling
|
spacing: Style.marginXS * 1.5 * scaling
|
||||||
|
|
@ -361,8 +375,8 @@ NPanel {
|
||||||
model: root.tabsModel
|
model: root.tabsModel
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
id: tabItem
|
id: tabItem
|
||||||
width: parent.width
|
Layout.fillWidth: true
|
||||||
height: 32 * scaling
|
Layout.preferredHeight: tabEntryRow.implicitHeight + Style.marginS * scaling * 2
|
||||||
radius: Style.radiusS * scaling
|
radius: Style.radiusS * scaling
|
||||||
color: selected ? Color.mPrimary : (tabItem.hovering ? Color.mTertiary : Color.transparent)
|
color: selected ? Color.mPrimary : (tabItem.hovering ? Color.mTertiary : Color.transparent)
|
||||||
readonly property bool selected: index === currentTabIndex
|
readonly property bool selected: index === currentTabIndex
|
||||||
|
|
@ -382,17 +396,19 @@ NPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
id: tabEntryRow
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: Style.marginS * scaling
|
anchors.margins: Style.marginS * scaling
|
||||||
anchors.rightMargin: Style.marginS * scaling
|
|
||||||
spacing: Style.marginS * scaling
|
spacing: Style.marginS * scaling
|
||||||
// Tab icon on the left side
|
|
||||||
|
// Tab icon
|
||||||
NIcon {
|
NIcon {
|
||||||
text: modelData.icon
|
text: modelData.icon
|
||||||
color: tabTextColor
|
color: tabTextColor
|
||||||
font.pointSize: Style.fontSizeL * scaling
|
font.pointSize: Style.fontSizeL * scaling
|
||||||
}
|
}
|
||||||
// Tab label on the left side
|
|
||||||
|
// Tab label
|
||||||
NText {
|
NText {
|
||||||
text: modelData.label
|
text: modelData.label
|
||||||
color: tabTextColor
|
color: tabTextColor
|
||||||
|
|
@ -401,6 +417,7 @@ NPanel {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
@ -412,14 +429,19 @@ NPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillHeight: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Content
|
// Content pane
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: contentPane
|
id: contentPane
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
radius: Style.radiusM * scaling
|
radius: Style.radiusM * scaling
|
||||||
color: Color.mSurfaceVariant
|
color: Color.mSurfaceVariant
|
||||||
border.color: Color.mOutline
|
border.color: Color.mOutline
|
||||||
|
|
@ -432,19 +454,23 @@ NPanel {
|
||||||
anchors.margins: Style.marginL * scaling
|
anchors.margins: Style.marginL * scaling
|
||||||
spacing: Style.marginS * scaling
|
spacing: Style.marginS * scaling
|
||||||
|
|
||||||
|
// Header row
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: headerRow
|
id: headerRow
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: Style.marginS * scaling
|
spacing: Style.marginS * scaling
|
||||||
|
|
||||||
// Tab label on the main right side
|
// Tab title
|
||||||
NText {
|
NText {
|
||||||
text: root.tabsModel[currentTabIndex].label
|
text: root.tabsModel[currentTabIndex]?.label || ""
|
||||||
font.pointSize: Style.fontSizeXL * scaling
|
font.pointSize: Style.fontSizeXL * scaling
|
||||||
font.weight: Style.fontWeightBold
|
font.weight: Style.fontWeightBold
|
||||||
color: Color.mPrimary
|
color: Color.mPrimary
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close button
|
||||||
NIconButton {
|
NIconButton {
|
||||||
icon: "close"
|
icon: "close"
|
||||||
tooltipText: "Close"
|
tooltipText: "Close"
|
||||||
|
|
@ -453,13 +479,16 @@ NPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Divider
|
||||||
NDivider {
|
NDivider {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
// Tab content area
|
||||||
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
color: Color.transparent
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: root.tabsModel
|
model: root.tabsModel
|
||||||
|
|
@ -479,7 +508,7 @@ NPanel {
|
||||||
|
|
||||||
sourceComponent: Flickable {
|
sourceComponent: Flickable {
|
||||||
// Using a Flickable here with a pressDelay to fix conflict between
|
// Using a Flickable here with a pressDelay to fix conflict between
|
||||||
// ScrollView and NTextInput. This fix the weird text selection issue.
|
// ScrollView and NTextInput. This fixes the weird text selection issue.
|
||||||
id: flickable
|
id: flickable
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
pressDelay: 200
|
pressDelay: 200
|
||||||
|
|
@ -498,7 +527,7 @@ NPanel {
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
active: true
|
active: true
|
||||||
sourceComponent: root.tabsModel[index].source
|
sourceComponent: root.tabsModel[index]?.source
|
||||||
width: scrollView.availableWidth
|
width: scrollView.availableWidth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -511,3 +540,4 @@ NPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue