Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main.cpp:
- #include <QGuiApplication>
- #include <QQmlApplicationEngine>
- #include <QQuickView>
- #include <QString>
- #include <QtQml>
- #include <QObject>
- #include <QQuickItem>
- int main(int argc, char *argv[])
- {
- QGuiApplication app(argc, argv);
- QQuickView view;
- view.setSource(QUrl(QStringLiteral("qrc:///main.qml")));
- view.setResizeMode(QQuickView::SizeRootObjectToView);
- QObject *rootObject = view.rootObject();
- rootObject->setProperty("text1Text",QVariant("Casdasdasda."));
- view.show();
- int returnVal = app.exec();
- delete rootObject;
- return returnVal;
- }
- main.qml:
- import QtQuick 2.0
- import Ubuntu.Components 1.1
- import QtQuick.LocalStorage 2.0
- import QtQuick.Controls 1.1
- import QtQuick.Dialogs 1.1
- import QtQuick.Window 2.1
- import QtQuick.Layouts 1.1
- MainView {
- // objectName for functional testing purposes (autopilot-qt5)
- objectName: "mainView"
- // Note! applicationName needs to match the "name" field of the click manifest
- applicationName: "com.ubuntu.dev.project_n.project"
- /*
- This property enables the application to change orientation
- when the device is rotated. The default is false.
- */
- //automaticOrientation: true
- // Removes the old toolbar and enables new features of the new header.
- useDeprecatedToolbar: false
- width: units.gu(100)
- height: units.gu(75)
- Page {
- y: 76
- anchors.rightMargin: 0
- anchors.bottomMargin: 0
- anchors.leftMargin: 0
- title: "project name"
- Column {
- enabled: true
- anchors.rightMargin: 16
- anchors.bottomMargin: 0
- anchors.leftMargin: 16
- anchors.topMargin: 16
- spacing: units.gu(1)
- anchors {
- margins: units.gu(2)
- fill: parent
- }
- }
- Item {
- property alias text1Text: text1.text
- Rectangle {
- id: rectangle
- x: 16
- y: 362
- width: 768
- height: 114
- color: "#000000"
- z: 1
- visible: true
- TextArea {
- id: text1
- selectByMouse: true
- x: 0
- y: 0
- width: 768
- height: 114
- text: "This text should change.."
- highlightOnFocus: false
- tabChangesFocus: false
- activeFocusOnPress: true
- readOnly: true
- textColor: "#ffffff"
- font.pixelSize: 12
- backgroundVisible: false
- // onLineCountChanged: {
- // outputText.focus = false;
- // Qt.inputMethod.hide();
- // root.textChanged(outputText.text)
- // }
- //anchors.left: lineColumn.right
- //anchors.right: parent.right
- //anchors.top: parent.top
- //anchors.bottom: parent.bottom
- }
- }
- }//end rectangle item
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement