diff options
| author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2014-08-04 17:41:11 +0200 |
|---|---|---|
| committer | J-P Nurmi <jpnurmi@digia.com> | 2014-08-08 06:07:18 +0200 |
| commit | ba0febc4319f172f072f04bf37f71432c70b70ca (patch) | |
| tree | 83494b6c7bc50a399e66e4b132f80698814c8beb /src | |
| parent | c68806dd9101009e3f5492316c6e8972539b49e7 (diff) | |
TableViewStyle: Add header delegate for Android style
The whole TableView concept doesn't map very nicely on Android
(and in mobile in general). However, for completeness, we provide
a fully implemented TableViewStyle.
For the header delegate, we re-used the design for section headers
which is close enough, specially since it's not uncommon to see
sticky section headers in mobile applications.
This change depends on another change in qtbase, which takes care
of extracting the 'listSeparatorTextViewStyle' element.
Change-Id: I9c50e4c7cabdc6b0ea864cef3da55ae3d7337d79
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/controls/Styles/Android/TableViewStyle.qml | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/controls/Styles/Android/TableViewStyle.qml b/src/controls/Styles/Android/TableViewStyle.qml index aab1ddda0..dd352af44 100644 --- a/src/controls/Styles/Android/TableViewStyle.qml +++ b/src/controls/Styles/Android/TableViewStyle.qml @@ -57,7 +57,33 @@ ScrollViewStyle { visible: false } - property Component headerDelegate: null + property Component headerDelegate: Rectangle { + color: AndroidStyle.colorValue(styleDef.defaultBackgroundColor) + height: Math.max(styleDef.View_minHeight || 0, headerLabel.implicitHeight) + + readonly property var styleDef: AndroidStyle.styleDef.listSeparatorTextViewStyle + readonly property real paddingStart: styleDef.View_paddingStart || styleDef.View_paddingLeft || 0 + readonly property real paddingEnd: styleDef.View_paddingEnd || styleDef.View_paddingRight || 0 + + DrawableLoader { + id: bg + anchors.fill: parent + window_focused: control.window && control.window.active + styleDef: parent.styleDef.View_background + } + + LabelStyle { + id: headerLabel + text: styleData.value !== undefined ? styleData.value : "" + horizontalAlignment: styleData.textAlignment + pressed: styleData.pressed + window_focused: control.window && control.window.active + styleDef: parent.styleDef + anchors.fill: parent + anchors.leftMargin: paddingStart + anchors.rightMargin: paddingEnd + } + } property Component rowDelegate: Rectangle { readonly property var styleDef: AndroidStyle.styleDef.simple_list_item |
