Advertisement
Guest User

Untitled

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