Advertisement
Guest User

Untitled

a guest
Jun 10th, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. import QtQuick 2.0
  2. import Sailfish.Silica 1.0
  3. import "../common"
  4.  
  5. Page {
  6. id: searchPage
  7.  
  8. onStatusChanged: {
  9. if (status == PageStatus.Active)
  10. searchPage.forceActiveFocus()
  11. }
  12.  
  13. SilicaListView {
  14. id: list
  15.  
  16. anchors.fill: parent
  17. currentIndex: -1
  18.  
  19. header: Item {
  20. width: list.width
  21. height: headerBox.implicitHeight
  22. }
  23.  
  24. model: genreModel
  25.  
  26. delegate: ListItem {
  27. id: listItem
  28.  
  29. Label {
  30. anchors {
  31. left: parent.left
  32. leftMargin: Theme.paddingLarge
  33.  
  34. right: parent.right
  35. rightMargin: Theme.paddingLarge
  36.  
  37. verticalCenter: parent.verticalCenter
  38. }
  39.  
  40. //text: stationModel.hasFilter ? Theme.highlightText(model.title, stationModel.filter, Theme.highlightColor) : model.title //!listItem.filtering ? name : Theme.highlightText(name, view.searchField.text, Theme.highlightColor)
  41. text: model.Name
  42. font.pixelSize: Theme.fontSizeMedium
  43.  
  44. color: listItem.highlighted ? Theme.highlightColor : Theme.primaryColor
  45. }
  46. }
  47.  
  48. // header: PageHeader {
  49. // id: header
  50. // title: qsTr("Genres")
  51. // }
  52.  
  53. ViewPlaceholder {
  54. text: qsTr("No genres available.")
  55. enabled: list.count == 0
  56. }
  57.  
  58. VerticalScrollDecorator {}
  59. }
  60.  
  61. Column {
  62. id: headerBox
  63. parent: list.headerItem ? list.headerItem : searchPage
  64.  
  65. anchors {
  66. left: parent.left
  67. right: parent.right
  68. }
  69.  
  70. PageHeader {
  71. title: qsTr("Search")
  72. }
  73.  
  74. SearchField {
  75. id: searchField
  76. anchors {
  77. left: parent.left
  78. right: parent.right
  79. }
  80.  
  81. placeholderText: qsTr("Search")
  82.  
  83. onTextChanged: {
  84. //stationModel.filter = text
  85. if (text)
  86. genreModel.qxFetchByQuery_("where name LIKE '%" + text +"%'")
  87. else
  88. genreModel.qxFetchAll_();
  89. }
  90. }
  91. }
  92.  
  93. RemorsePopup {
  94. id: remorse
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement