Repository navigation
Bar widget group #6961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
GeekyRiolu
wants to merge
20
commits into
omacom:quattro
Choose a base branch
from
GeekyRiolu:bar-widget-group
base: quattro
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Bar widget group #6961
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
998bff3
Add collapsible bar widget groups
GeekyRiolu b2d23b9
Migrate the tray drawer onto BarCollapsible
GeekyRiolu 45fdbaa
Give the widget group a distinct chevron from the tray
GeekyRiolu 3dd061b
Apply suggestions from code review
GeekyRiolu cb9d477
Return a real Array from groupItems() for cross-realm items
GeekyRiolu b87f5e2
Center the collapsible drawer content on the cross axis
GeekyRiolu 7795006
Loosen the collapsible animation test to tolerate reformatting
GeekyRiolu 2f7f16e
Seed the collapsible pinned state once, don't track collapsedByDefault
GeekyRiolu 81fb5b0
Align group detection in layout normalization with BarModel
GeekyRiolu 05ec0ff
Size the tray drawers explicitly
GeekyRiolu fc9424d
Return a fresh array from groupItems()
GeekyRiolu 9f662bc
Restore OMARCHY_PATH to its exact prior state in the group acceptance…
GeekyRiolu fdc41fa
Clarify the expandOnHover wording in the bar README
GeekyRiolu 0ad476e
Keep pinnedOpen a live binding so collapsed:false groups start expanded
GeekyRiolu e017902
Detect OMARCHY_PATH by presence, not value, in the group acceptance test
GeekyRiolu 2947f6d
Document why the group test uses source-regex structural checks
GeekyRiolu db2bb31
Merge upstream/quattro into bar-widget-group
GeekyRiolu b81e980
Assert real collapse behavior in the bar group acceptance test
GeekyRiolu 6fbb908
Merge upstream/quattro into bar-widget-group
GeekyRiolu cea31d8
Merge upstream/quattro into bar-widget-group
GeekyRiolu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| import QtQuick | ||
| import qs.Commons | ||
|
|
||
| // Collapsible bar container. Hides its content behind a chevron and reveals it | ||
| // with a hover-to-expand slide, the same gesture the system tray drawer uses. | ||
| // Collapsed, the container is only the chevron; it grows to fit its content as | ||
| // it opens, so a collapsed group costs no more bar space than its chevron. | ||
| // | ||
| // Content is supplied as a Component (not default children) so the chevron and | ||
| // clip below are not swallowed by a default-property alias, and so the loaded | ||
| // item is available to measure for the drawer extent. | ||
| Item { | ||
| id: root | ||
|
|
||
| // Host bar, injected by the caller. Supplies vertical / barSize / theming for | ||
| // the chevron. Left null the component still lays out with Style fallbacks. | ||
| property var bar: null | ||
| readonly property bool vertical: bar ? bar.vertical : false | ||
| readonly property int barSize: bar ? bar.barSize : Style.bar.sizeHorizontal | ||
|
|
||
| // The content to reveal. Its implicit size along the bar axis is the extent | ||
| // the drawer opens to. | ||
| property Component contentComponent: null | ||
| readonly property Item body: contentLoader.item | ||
|
|
||
| property bool collapsedByDefault: true | ||
| property bool expandOnHover: true | ||
| // Chevron glyph. Escaped codepoint on purpose: raw Nerd Font glyphs can be | ||
| // mangled by file tooling, so the default stays stable this way. | ||
| property string icon: "" | ||
| property int animationDuration: 600 | ||
|
|
||
| // A hover reveals transiently; a chevron click pins the drawer open so it | ||
| // survives the pointer leaving. pinnedOpen follows collapsedByDefault until the | ||
| // first chevron click breaks the binding and hands control to the user. It must | ||
| // stay a live binding: BarGroup sets the group's entry — and thus | ||
| // collapsedByDefault — right after load, so freezing on completion would lock in | ||
| // the pre-entry default and ignore a configured collapsed: false. | ||
| property bool pinnedOpen: !collapsedByDefault | ||
| property bool hovered: false | ||
| readonly property bool open: pinnedOpen || (expandOnHover && hovered) | ||
|
|
||
| readonly property real drawerExtent: body ? (vertical ? body.implicitHeight : body.implicitWidth) : 0 | ||
| property real revealProgress: open ? 1 : 0 | ||
| readonly property real revealExtent: drawerExtent * revealProgress | ||
|
|
||
| Behavior on revealProgress { | ||
| NumberAnimation { duration: Style.duration(root.animationDuration); easing.type: Easing.OutCubic } | ||
| } | ||
|
|
||
| implicitWidth: vertical ? barSize : Math.round(chevron.implicitWidth + revealExtent) | ||
| implicitHeight: vertical ? Math.round(chevron.implicitHeight + revealExtent) : barSize | ||
|
|
||
| // Whole-container hover drives the transient reveal. A HoverHandler on the | ||
| // root sees the chevron and the revealed content as one region, so sliding | ||
| // from the chevron onto the content does not collapse it mid-motion. | ||
| HoverHandler { | ||
| enabled: root.expandOnHover | ||
| onHoveredChanged: root.hovered = hovered | ||
| } | ||
|
|
||
| BarIconButton { | ||
| id: chevron | ||
| bar: root.bar | ||
| width: implicitWidth | ||
| height: implicitHeight | ||
| text: root.icon | ||
| textRotation: root.vertical ? 90 : 0 | ||
| onPressed: function(button) { | ||
| if (button === Qt.LeftButton) root.pinnedOpen = !root.pinnedOpen | ||
| } | ||
| } | ||
|
|
||
| // The revealed slice. Clipped so the content is wiped in from the chevron as | ||
| // the slice grows, and so a partially-open drawer never paints past its edge. | ||
| Item { | ||
| id: revealClip | ||
| x: root.vertical ? 0 : chevron.implicitWidth | ||
| y: root.vertical ? chevron.implicitHeight : 0 | ||
| width: root.vertical ? root.barSize : Math.round(root.revealExtent) | ||
| height: root.vertical ? Math.round(root.revealExtent) : root.barSize | ||
| clip: true | ||
|
|
||
| // The content is laid out at its full extent regardless of how far the | ||
| // drawer has opened, so its widgets never reflow as it animates. On the | ||
| // cross axis it is sized to the content and centered, so content shorter | ||
| // than the bar sits centered rather than top/left-aligned. | ||
| Loader { | ||
| id: contentLoader | ||
| sourceComponent: root.contentComponent | ||
| x: root.vertical ? Math.round((root.barSize - implicitWidth) / 2) : 0 | ||
| y: root.vertical ? 0 : Math.round((root.barSize - implicitHeight) / 2) | ||
| width: root.vertical ? implicitWidth : root.drawerExtent | ||
| height: root.vertical ? root.drawerExtent : implicitHeight | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import QtQuick | ||
| import qs.Ui | ||
| import "BarModel.js" as BarModel | ||
|
|
||
| // A collapsible group of bar widgets. Kept in its own file rather than an inline | ||
| // component of Bar.qml on purpose: a group contains widget slots, and a widget | ||
| // slot may itself be a group, so an inline component would make Bar.qml's | ||
| // components form a resolution cycle — which QML forbids ("Inline components | ||
| // form a cycle!"). A file type can be referenced recursively, so the recursion | ||
| // lives here. | ||
| // | ||
| // The children are rendered by a ModuleList handed in as `listComponent` (a | ||
| // runtime Component created by Bar.qml), so this file never names the bar's | ||
| // inline ModuleList / ModuleSlot types and the cycle stays broken. | ||
| Item { | ||
| id: root | ||
|
|
||
| property var bar: null | ||
| property var entry: null | ||
| property string region: "" | ||
| // A bare ModuleList component supplied by the bar; its entries/region are | ||
| // filled once it loads. | ||
| property Component listComponent: null | ||
|
|
||
| readonly property var groupSettings: BarModel.entrySettings(entry) | ||
|
|
||
| implicitWidth: collapsible.implicitWidth | ||
| implicitHeight: collapsible.implicitHeight | ||
|
|
||
| BarCollapsible { | ||
| id: collapsible | ||
| anchors.fill: parent | ||
| bar: root.bar | ||
| collapsedByDefault: root.groupSettings.collapsed !== false | ||
| expandOnHover: root.groupSettings.expandOnHover !== false | ||
| // A distinct default glyph so a group next to the tray drawer does not read | ||
| // as a second tray; an entry may override it via "icon". | ||
| icon: root.groupSettings.icon !== undefined && root.groupSettings.icon !== null | ||
| ? String(root.groupSettings.icon) : "\uf141" | ||
|
|
||
| contentComponent: Component { | ||
| Loader { | ||
| sourceComponent: root.listComponent | ||
| onLoaded: { | ||
| if (!item) return | ||
| item.entries = BarModel.groupItems(root.entry) | ||
| item.region = root.region | ||
| item.draggable = false | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.