Guest User

Untitled

a guest
Dec 15th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. /*
  2. * main.qml - Example Barcode Reader
  3. *
  4. * Copyright (c) 2011, Tom Swindell <t.swindell@rubyx.co.uk>
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. All advertising materials mentioning features or use of this software
  15. * must display the following acknowledgement:
  16. * This product includes software developed by the <organization>.
  17. * 4. Neither the name of the <organization> nor the
  18. * names of its contributors may be used to endorse or promote products
  19. * derived from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ''AS IS'' AND ANY
  22. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  23. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  24. * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  25. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  26. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  27. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  28. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  30. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. */
  32. import QtQuick 1.0
  33. import stage.rubyx.BarcodeReader 1.0
  34.  
  35. Item {
  36. id:main
  37. width:800;height:480
  38.  
  39. Component.onCompleted: reader.start();
  40.  
  41. BarcodeReader {
  42. id:reader
  43. viewport:viewport
  44.  
  45. onDecode: {
  46. indicator.text = 'Type: ' + type + "\n" + 'Data: ' + data;
  47. reader.stop();
  48. }
  49. }
  50.  
  51. BarcodeViewport {
  52. id:viewport
  53. anchors.fill:parent
  54.  
  55. MouseArea {
  56. anchors.fill:parent
  57. onClicked: {
  58. indicator.text = '';
  59. reader.start();
  60. }
  61. }
  62. }
  63.  
  64. Text {
  65. id:indicator
  66. anchors {top:parent.top;horizontalCenter:parent.horizontalCenter;margins:10}
  67. font.pixelSize:24
  68. color:'white'
  69. }
  70. }
Add Comment
Please, Sign In to add comment