daily pastebin goal
9%
SHARE
TWEET

Untitled

aqibp Jan 12th, 2015 (edited) 31 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. main.cpp:
  2.  
  3.  
  4. #include <QGuiApplication>
  5. #include <QQmlApplicationEngine>
  6. #include <QQuickView>
  7. #include <QString>
  8. #include <QtQml>
  9. #include <QObject>
  10. #include <QQuickItem>
  11.  
  12. int main(int argc, char *argv[])
  13. {
  14.     QGuiApplication app(argc, argv);
  15.         QQuickView view;
  16.         view.setSource(QUrl(QStringLiteral("qrc:///main.qml")));
  17.         view.setResizeMode(QQuickView::SizeRootObjectToView);
  18.         QObject *rootObject = view.rootObject();
  19.         rootObject->setProperty("text1Text",QVariant("Casdasdasda."));
  20.         view.show();
  21.         int returnVal = app.exec();
  22.         delete rootObject;
  23.         return returnVal;
  24.         }
  25.  
  26.  
  27.  
  28. main.qml:
  29.  
  30. import QtQuick 2.0
  31. import Ubuntu.Components 1.1
  32. import QtQuick.LocalStorage 2.0
  33. import QtQuick.Controls 1.1
  34. import QtQuick.Dialogs 1.1
  35. import QtQuick.Window 2.1
  36. import QtQuick.Layouts 1.1
  37.  
  38.  
  39. MainView {
  40.     // objectName for functional testing purposes (autopilot-qt5)
  41.     objectName: "mainView"
  42.  
  43.     // Note! applicationName needs to match the "name" field of the click manifest
  44.     applicationName: "com.ubuntu.dev.project_n.project"
  45.  
  46.     /*
  47.      This property enables the application to change orientation
  48.      when the device is rotated. The default is false.
  49.     */
  50.     //automaticOrientation: true
  51.  
  52.     // Removes the old toolbar and enables new features of the new header.
  53.     useDeprecatedToolbar: false
  54.  
  55.     width: units.gu(100)
  56.     height: units.gu(75)
  57.  
  58.     Page {
  59.         y: 76
  60.         anchors.rightMargin: 0
  61.         anchors.bottomMargin: 0
  62.         anchors.leftMargin: 0
  63.         title: "project name"
  64.         Column {
  65.             enabled: true
  66.             anchors.rightMargin: 16
  67.             anchors.bottomMargin: 0
  68.             anchors.leftMargin: 16
  69.             anchors.topMargin: 16
  70.             spacing: units.gu(1)
  71.             anchors {
  72.                 margins: units.gu(2)
  73.                 fill: parent
  74.             }
  75.         }
  76.  
  77.  
  78.  
  79.  
  80.         Item {
  81.  
  82.             property alias text1Text: text1.text
  83.         Rectangle {
  84.             id: rectangle
  85.             x: 16
  86.             y: 362
  87.             width: 768
  88.             height: 114
  89.             color: "#000000"
  90.             z: 1
  91.             visible: true
  92.  
  93.             TextArea {
  94.                 id: text1
  95.                 selectByMouse: true
  96.                 x: 0
  97.                 y: 0
  98.                 width: 768
  99.                 height: 114
  100.                 text: "This text should change.."
  101.                 highlightOnFocus: false
  102.                 tabChangesFocus: false
  103.                 activeFocusOnPress: true
  104.                 readOnly: true
  105.                 textColor: "#ffffff"
  106.                 font.pixelSize: 12
  107.                 backgroundVisible: false
  108.  
  109.                // onLineCountChanged:  {
  110.  
  111.                  //   outputText.focus = false;
  112.                    // Qt.inputMethod.hide();
  113.                    // root.textChanged(outputText.text)
  114.  
  115.               //  }
  116.  
  117.                 //anchors.left: lineColumn.right
  118.                 //anchors.right: parent.right
  119.                 //anchors.top: parent.top
  120.                 //anchors.bottom: parent.bottom
  121.             }
  122.         }
  123.  
  124.     }//end rectangle item
  125.  
  126.     }
  127. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top