added ui navigation highlight property

This commit is contained in:
Igor Korsukov 2021-12-13 15:34:42 +02:00
parent b88b060e12
commit dc026e68db
8 changed files with 21 additions and 11 deletions

View file

@ -97,7 +97,7 @@ Rectangle {
Rectangle {
anchors.fill: parent
color: item.section.enabled ? "#fcaf3e" : "#eeeeec"
border.width: item.section.active ? 2 : 0
border.width: item.section.highlight ? 2 : 0
border.color: ui.theme.focusColor
}
@ -139,7 +139,7 @@ Rectangle {
Rectangle {
anchors.fill: parent
color: subitem.panel.enabled ? "#729fcf" : "#eeeeec"
border.width: subitem.panel.active ? 2 : 0
border.width: subitem.panel.highlight ? 2 : 0
border.color: ui.theme.focusColor
}
@ -178,8 +178,8 @@ Rectangle {
radius: 4
color: control.enabled ? "#73d216" : "#eeeeec"
enabled: control.enabled
border.width: control.active ? 2 : 1
border.color: control.active ? ui.theme.focusColor : "#2e3436"
border.width: control.highlight ? 2 : 1
border.color: control.highlight ? ui.theme.focusColor : "#2e3436"
Column {
anchors.fill: parent

View file

@ -164,6 +164,7 @@ void AbstractNavigation::setActive(bool active)
m_active = active;
emit activeChanged(m_active);
emit highlightChanged();
if (m_activeChanged.isConnected()) {
m_activeChanged.send(m_active);
@ -222,3 +223,8 @@ void AbstractNavigation::setAccessibleParent(AccessibleItem* p)
m_accessible->setAccessibleParent(p);
}
}
bool AbstractNavigation::highlight() const
{
return active();
}

View file

@ -43,6 +43,7 @@ class AbstractNavigation : public QObject, public QQmlParserStatus
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(bool active READ active NOTIFY activeChanged)
Q_PROPERTY(bool highlight READ highlight NOTIFY highlightChanged)
Q_PROPERTY(AccessibleItem * accessible READ accessible WRITE setAccessible NOTIFY accessibleChanged)
@ -66,6 +67,8 @@ public:
bool active() const;
async::Channel<bool> activeChanged() const;
bool highlight() const;
AccessibleItem* accessible() const;
void setAccessibleParent(AccessibleItem* p);
@ -91,6 +94,7 @@ signals:
void rowChanged(int row);
void enabledChanged(bool enabled);
void activeChanged(bool active);
void highlightChanged();
void accessibleChanged();
void navigationEvent(QVariant event);

View file

@ -32,7 +32,7 @@ Rectangle {
anchors.fill: parent
anchors.margins: drawOutsideParent ? -border.width : 0
visible: navigationCtrl ? navigationCtrl.active : false
visible: navigationCtrl ? navigationCtrl.highlight : false
color: "transparent"

View file

@ -73,8 +73,8 @@ RadioDelegate {
color: ui.theme.backgroundPrimaryColor
opacity: ui.theme.buttonOpacityNormal
border.color: navCtrl.active ? ui.theme.fontPrimaryColor : ui.theme.strokeColor
border.width: navCtrl.active ? ui.theme.navCtrlBorderWidth : ui.theme.borderWidth
border.color: navCtrl.highlight ? ui.theme.fontPrimaryColor : ui.theme.strokeColor
border.width: navCtrl.highlight ? ui.theme.navCtrlBorderWidth : ui.theme.borderWidth
Rectangle {
id: line

View file

@ -124,7 +124,7 @@ Item {
id: background
anchors.fill: parent
anchors.margins: navCtrl.active ? ui.theme.navCtrlBorderWidth : 0
anchors.margins: navCtrl.highlight ? ui.theme.navCtrlBorderWidth : 0
color: ui.theme.backgroundPrimaryColor
opacity: 1

View file

@ -90,8 +90,8 @@ FocusScope {
color: "transparent"
radius: parent.radius
border.color: navCtrl.active ? ui.theme.focusColor : ui.theme.strokeColor
border.width: navCtrl.active ? 2 : parent.borderWidth
border.color: navCtrl.highlight ? ui.theme.focusColor : ui.theme.strokeColor
border.width: navCtrl.highlight ? 2 : parent.borderWidth
}
states: [

View file

@ -42,7 +42,7 @@ Item {
property bool resourcePickingActive: false
property bool showAdditionalButtons: rootMouseArea.containsMouse || (navigationPanel ? navigationPanel.active : true)
property bool showAdditionalButtons: rootMouseArea.containsMouse || (navigationPanel ? navigationPanel.highlight : true)
property NavigationPanel navigationPanel: null
property int navigationRowStart: 0