Advertisement
Guest User

page.qml

a guest
Oct 9th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 1.85 KB | None | 0 0
  1. import QtQuick 2.0
  2. import Sailfish.Silica 1.0
  3. import io.thp.pyotherside 1.4
  4.  
  5.  
  6. Page {
  7.     id: page
  8.  
  9.     // To enable PullDownMenu, place our content in a SilicaFlickable
  10.     SilicaFlickable {
  11.         anchors.fill: parent
  12.  
  13.         // PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
  14.         PullDownMenu {
  15.             MenuItem {
  16.                 text: qsTr("Show Page 2")
  17.                 onClicked: pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
  18.             }
  19.         }
  20.  
  21.         // Tell SilicaFlickable the height of its content.
  22.         contentHeight: column.height
  23.  
  24.         // Place our content in a Column.  The PageHeader is always placed at the top
  25.         // of the page, followed by our content.
  26.         Column {
  27.             id: column
  28.  
  29.             width: page.width
  30.             spacing: Theme.paddingLarge
  31.             PageHeader {
  32.                 title: qsTr("Python Image provider")
  33.             }
  34.             Label {
  35.                 x: Theme.paddingLarge
  36.                 text: qsTr("Hello Sailors")
  37.                 color: Theme.secondaryHighlightColor
  38.                 font.pixelSize: Theme.fontSizeExtraLarge
  39.             }
  40.             Image {
  41.                 id: image
  42.                 width: 500
  43.                 height: 500
  44.  
  45.  
  46.                 Python {
  47.                     Component.onCompleted: {
  48.                         // Add the directory of this .qml file to the search path
  49.                         addImportPath(Qt.resolvedUrl('.'));
  50.  
  51.                         importModule('image_provider', function () {
  52.                             image.source = "image://python/http://i.4cdn.org/hr/1443801118614.png";
  53.                         });
  54.                     }
  55.  
  56.                     onError: console.log('Python error: ' + traceback)
  57.                 }
  58.             }
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement