Commit 11ff483c authored by Gabriel de Dietrich's avatar Gabriel de Dietrich Committed by J-P Nurmi
Browse files

TableViewStyle: Fix and document styleData.hasActiveFocus property


The property has been present since 5.1 for rowDelegate and missing for
itemDelegate. Also, the property was incorrectly bound to the table
having active focus instead of the row.

Change-Id: I43a93975dffd849b37cfee6363343f8aef57d11b
Reviewed-by: default avatarJ-P Nurmi <jpnurmi@theqtcompany.com>
parent 01b85cc9
Branches
Tags
No related merge requests found
Showing with 10 additions and 7 deletions
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Quick Controls module of the Qt Toolkit.
......@@ -110,7 +110,7 @@ ScrollViewStyle {
*/
property Component rowDelegate: Rectangle {
height: Math.round(TextSingleton.implicitHeight * 1.2)
property color selectedColor: styleData.hasActiveFocus ? "#07c" : "#999"
property color selectedColor: control.activeFocus ? "#07c" : "#999"
color: styleData.selected ? selectedColor :
!styleData.alternate ? alternateBackgroundColor : backgroundColor
}
......
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Quick Controls module of the Qt Toolkit.
......@@ -82,7 +82,7 @@ ScrollViewStyle {
visible: styleData.selected || styleData.alternate
source: "image://__tablerow/" + (styleData.alternate ? "alternate_" : "")
+ (styleData.selected ? "selected_" : "")
+ (styleData.hasActiveFocus ? "active" : "")
+ (control.activeFocus ? "active" : "")
height: Math.max(16, RowItemSingleton.implicitHeight)
border.left: 4 ; border.right: 4
}
......
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Quick Controls module of the Qt Toolkit.
......@@ -149,6 +149,7 @@ ScrollView {
\li styleData.elideMode - the elide mode of the column
\li styleData.textAlignment - the horizontal text alignment of the column
\li styleData.pressed - true when the item is pressed (since QtQuick.Controls 1.3)
\li styleData.hasActiveFocus - true when the row has focus (since QtQuick.Controls 1.3)
\endlist
Example:
......@@ -179,6 +180,7 @@ ScrollView {
\li styleData.alternate - true when the row uses the alternate background color
\li styleData.selected - true when the row is currently selected
\li styleData.row - the index of the row
\li styleData.hasActiveFocus - true when the row has focus
\li styleData.pressed - true when the row is pressed (since QtQuick.Controls 1.3)
\endlist
......@@ -761,7 +763,7 @@ ScrollView {
property QtObject styleData: QtObject {
readonly property bool alternate: (index + rowCount) % 2 === 1
readonly property bool selected: false
readonly property bool hasActiveFocus: root.activeFocus
readonly property bool hasActiveFocus: false
readonly property bool pressed: false
}
readonly property var model: listView.model
......@@ -924,7 +926,7 @@ ScrollView {
readonly property int row: rowitem.rowIndex
readonly property bool alternate: rowitem.alternate
readonly property bool selected: rowitem.itemSelected
readonly property bool hasActiveFocus: root.activeFocus
readonly property bool hasActiveFocus: rowitem.activeFocus
readonly property bool pressed: rowitem.rowIndex === mousearea.pressedRow
}
readonly property var model: listView.model
......@@ -955,6 +957,7 @@ ScrollView {
readonly property int elideMode: columnItem.elideMode
readonly property int textAlignment: columnItem.horizontalAlignment
readonly property bool selected: rowitem.itemSelected
readonly property bool hasActiveFocus: rowitem.activeFocus
readonly property bool pressed: row === mousearea.pressedRow && column === mousearea.pressedColumn
readonly property color textColor: rowitem.itemTextColor
readonly property string role: columnItem.role
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment