-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
199 additions
and
55 deletions.
There are no files selected for viewing
This file contains 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 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 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,71 @@ | ||
import QtQuick 2.15 | ||
|
||
import ThemeEngine 1.0 | ||
|
||
Item { | ||
id: selectorGrid | ||
|
||
implicitWidth: 512 | ||
implicitHeight: 40 | ||
|
||
width: parent.width | ||
height: (selectorGrid.btnRows * btnHeight) + (selectorGrid.btnRows * contentPositioner.spacing) | ||
|
||
opacity: enabled ? 1 : 0.4 | ||
|
||
property int btnCols: 4 | ||
property int btnRows: 3 | ||
property int btnWidth: width / selectorGrid.btnCols | ||
property int btnHeight: 40 | ||
|
||
signal menuSelected(var index) | ||
property int currentSelection: 0 | ||
|
||
property var model: null | ||
|
||
//////////////// | ||
|
||
Rectangle { // background | ||
anchors.fill: parent | ||
radius: Theme.componentRadius | ||
color: Theme.colorComponentBackground | ||
} | ||
|
||
//////////////// | ||
|
||
Grid { | ||
id: contentPositioner | ||
anchors.fill: parent | ||
anchors.margins: 0 | ||
spacing: 1 | ||
|
||
columns: selectorGrid.btnCols | ||
rows: selectorGrid.btnRows | ||
|
||
Repeater { | ||
model: selectorGrid.model | ||
delegate: SelectorGridItem { | ||
width: selectorGrid.btnWidth | ||
height: selectorGrid.btnHeight | ||
|
||
highlighted: (selectorGrid.currentSelection === idx) | ||
index: idx ?? 0 | ||
text: txt ?? "" | ||
onClicked: selectorGrid.menuSelected(idx) | ||
} | ||
} | ||
} | ||
|
||
//////////////// | ||
|
||
Rectangle { // foreground border | ||
anchors.fill: parent | ||
radius: Theme.componentRadius | ||
|
||
color: "transparent" | ||
border.width: Theme.componentBorderWidth | ||
border.color: Theme.colorComponentBorder | ||
} | ||
|
||
//////////////// | ||
} |
This file contains 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,82 @@ | ||
import QtQuick 2.15 | ||
import QtQuick.Controls.impl 2.15 | ||
import QtQuick.Templates 2.15 as T | ||
|
||
import ThemeEngine 1.0 | ||
|
||
T.Button { | ||
id: control | ||
|
||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, | ||
implicitContentWidth + leftPadding + rightPadding) | ||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, | ||
implicitContentHeight + topPadding + bottomPadding) | ||
|
||
leftPadding: 16 | ||
rightPadding: 16 | ||
|
||
focusPolicy: Qt.NoFocus | ||
|
||
// settings | ||
property int index | ||
property url source | ||
property int sourceSize: 32 | ||
|
||
// colors | ||
property string colorContent: Theme.colorComponentText | ||
property string colorContentHighlight: Theme.colorComponentContent | ||
property string colorBackgroundHighlight: Theme.colorComponentDown | ||
|
||
//////////////// | ||
|
||
background: Rectangle { | ||
implicitWidth: 32 | ||
implicitHeight: 32 | ||
radius: Theme.componentRadius | ||
|
||
color: control.colorBackgroundHighlight | ||
opacity: { | ||
if (control.hovered && control.highlighted) return 0.9 | ||
else if (control.highlighted) return 0.7 | ||
else if (control.hovered) return 0.5 | ||
return 0 | ||
} | ||
Behavior on opacity { OpacityAnimator { duration: 133 } } | ||
} | ||
|
||
//////////////// | ||
|
||
contentItem: Item { | ||
Row { | ||
anchors.centerIn: parent | ||
spacing: 4 | ||
|
||
IconSvg { // contentImage | ||
anchors.verticalCenter: parent.verticalCenter | ||
visible: control.source.toString().length | ||
|
||
width: control.sourceSize | ||
height: control.sourceSize | ||
|
||
source: control.source | ||
color: control.highlighted ? control.colorContentHighlight : control.colorContent | ||
opacity: control.highlighted ? 1 : 0.5 | ||
} | ||
|
||
Text { // contentText | ||
anchors.verticalCenter: parent.verticalCenter | ||
visible: control.text | ||
|
||
text: control.text | ||
textFormat: Text.PlainText | ||
font: control.font | ||
verticalAlignment: Text.AlignVCenter | ||
|
||
color: control.highlighted ? control.colorContentHighlight : control.colorContent | ||
opacity: control.highlighted ? 1 : 0.66 | ||
} | ||
} | ||
} | ||
|
||
//////////////// | ||
} |
This file contains 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 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 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