Results 1 to 4 of 4

Thread: how to add multiple strings into the spinner

  1. #1
    Join Date
    May 2011
    Posts
    120
    Thanks
    33
    Qt products
    Qt4
    Platforms
    Windows

    Default how to add multiple strings into the spinner

    created an alarm using qml. we can't add 'am' and 'pm' to the last spinner. how can we add it?
    Qt Code:
    1. import Qt 4.7
    2. import "content"
    3.  
    4. Rectangle {
    5.  
    6. width:238; height:197
    7. property int hr
    8. property int min
    9. property int am
    10. signal titleBarClicked(int hr,int min,int am)
    11.  
    12.  
    13. Row {
    14. y: 0; x:0; spacing: 20
    15.  
    16.  
    17. Image {
    18. id: image1
    19. source: "content/spinner-bgc.png"
    20.  
    21. }
    22.  
    23. }
    24.  
    25.  
    26.  
    27. Row {
    28. y: 0; x: 7; spacing:20
    29.  
    30. Spinner {
    31. id: spinner
    32. width:70; height: 197
    33. focus: false
    34. model: 13
    35. itemHeight: 30
    36. delegate: Text { font.pixelSize: 25; text: index; height: 30;font.bold:true;}
    37.  
    38.  
    39. }
    40. }
    41. Row {
    42. y: 0; x:77; spacing: 20
    43.  
    44.  
    45. Image {
    46. id: image2
    47. source: "content/spinner-bgc.png"
    48. }
    49.  
    50. }
    51.  
    52.  
    53.  
    54.  
    55.  
    56.  
    57. Row {
    58. y: 0; x:84; spacing:20
    59.  
    60. Spinner {
    61. id: spinner2
    62. width:70; height: 197
    63. focus: true
    64. model: 60
    65. itemHeight: 30
    66. delegate: Text { font.pixelSize: 25; text: index; height: 30;font.bold:true;}
    67. }
    68.  
    69.  
    70.  
    71. }
    72. Row {
    73. y: 0; x:154; spacing: 20
    74.  
    75.  
    76. Image {
    77. id: image3
    78. source: "content/spinner-bgc.png"
    79. }
    80.  
    81. }
    82. Row {
    83. y: 0; x:161; spacing:20
    84.  
    85. Spinner {
    86. id: spinner3
    87. width:70; height: 197
    88. focus: true
    89. model: name
    90. itemHeight: 30
    91.  
    92. delegate: Text {font.pixelSize: 25; text: "PM"; height:30;font.bold:true;}
    93. Text {
    94. id: name
    95. text: ""
    96. }
    97.  
    98.  
    99.  
    100.  
    101.  
    102. }
    103.  
    104.  
    105.  
    106.  
    107.  
    108. }
    109. Row {
    110. y: 0; x:231; spacing: 20
    111.  
    112.  
    113. Image {
    114. id: image4
    115. source: "content/spinner-bgc.png"
    116. }
    117.  
    118. }
    119. Connections {
    120. target:titleBarClicked(spinner.currentIndex,spinner2.currentIndex,spinner3.currentIndex)
    121. }
    122.  
    123.  
    124. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how to add multiple strings into the spinner

    it is quite simple just think:
    Qt Code:
    1. Spinner {
    2. id: spinner3
    3. width:70; height: 197
    4. focus: true
    5. model: 2
    6. itemHeight: 30
    7.  
    8. delegate: Text {
    9. font.pixelSize: 25
    10. text: index==0?"AM":"PM"
    11. height:30
    12. font.bold:true;
    13. }
    14. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    May 2011
    Posts
    120
    Thanks
    33
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to add multiple strings into the spinner

    how can add more than 2strings to spinner

  4. #4
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how to add multiple strings into the spinner


Similar Threads

  1. Replies: 6
    Last Post: 22nd December 2010, 04:20
  2. Qmovie spinner.gif image Problem
    By pavanbarot in forum Qt Programming
    Replies: 0
    Last Post: 31st October 2010, 13:07
  3. Replies: 1
    Last Post: 7th May 2010, 16:01
  4. spinner (delay) button
    By addu in forum Qt Programming
    Replies: 3
    Last Post: 13th May 2009, 17:39
  5. Custom spinner - fast increment/decrement
    By MrGarbage in forum Qt Programming
    Replies: 2
    Last Post: 11th October 2007, 18:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.