summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-12-19 11:20:32 +0800
committerwang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>2018-12-19 11:20:32 +0800
commita102c3aac7cf2ec721d5a5039febdd05e303638a (patch)
tree4e5038cc429388438be52747d42606cb72b6f2ae
parentfe42b81570d9730042a52d02ba8715bf75686ca0 (diff)
change sample
-rw-r--r--app/Onscreen.qml3
-rw-r--r--onscreenapp.pro3
-rw-r--r--sample/app/main.cpp2
-rw-r--r--sample/app/main.qml325
4 files changed, 185 insertions, 148 deletions
diff --git a/app/Onscreen.qml b/app/Onscreen.qml
index 76538cf..4d5ec99 100644
--- a/app/Onscreen.qml
+++ b/app/Onscreen.qml
@@ -94,7 +94,6 @@ Rectangle {
id: btn1
visible: btn1Name == "" ? false : true
text: btn1Name
- highlighted: true
onClicked: {
eventHandler.onScreenReply(btn1.text)
}
@@ -105,7 +104,6 @@ Rectangle {
id: btn2
visible: btn2Name == "" ? false : true
text: btn2Name
- highlighted: true
onClicked: {
eventHandler.onScreenReply(btn2.text)
}
@@ -116,7 +114,6 @@ Rectangle {
id: btn3
visible: btn3Name == "" ? false : true
text: btn3Name
- highlighted: true
onClicked: {
eventHandler.onScreenReply(btn3.text)
}
diff --git a/onscreenapp.pro b/onscreenapp.pro
index 90b63a8..8d60f8b 100644
--- a/onscreenapp.pro
+++ b/onscreenapp.pro
@@ -18,6 +18,7 @@ load(configure)
SUBDIRS += \
package \
- app
+ app \
+ sample
package.depends += app
diff --git a/sample/app/main.cpp b/sample/app/main.cpp
index 399a5c9..7c7d6e3 100644
--- a/sample/app/main.cpp
+++ b/sample/app/main.cpp
@@ -27,8 +27,6 @@
int main(int argc, char *argv[])
{
- qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
- qputenv("QT_LOGGING_RULES", QByteArray("qt.virtualkeyboard=true"));
QGuiApplication app(argc, argv);
app.setApplicationName("onstestapp");
app.setApplicationVersion(QStringLiteral("3.99.3"));
diff --git a/sample/app/main.qml b/sample/app/main.qml
index 3225dcd..a575cb0 100644
--- a/sample/app/main.qml
+++ b/sample/app/main.qml
@@ -12,17 +12,23 @@ ApplicationWindow {
height: 1487
property string onsId: qsTr("onscreenapp")
- property string pri_path: qsTr("onstestapp/")
- property string filepath: pri_path + qsTr("vics.qml")
- property string msgdata: ""
- property string postmsg: ""
+ property string onsTitle: qsTr("One Button title")
+ property string onsType: "critical"
+ property string onsContents: qsTr("An operating system is a program that manages a computer’s hardware.")
+ property string onsButton1: qsTr("Yes")
+ property string onsButton2: qsTr("")
+ property string onsButton3: qsTr("")
+ property string postmsg: qsTr("")
+ property string btndata: qsTr("")
- Text {
+ Label {
id: title
width: parent.width
height: 40
text: "OnScreen Test App"
font.pixelSize: 40
+ font.bold: true
+ color: "white"
}
ColumnLayout {
@@ -35,14 +41,17 @@ ApplicationWindow {
Flickable {
id: flickable
width: 800
- height: 160
+ height: 320
Layout.alignment: Qt.AlignCenter
+ flickableDirection: Flickable.VerticalFlick
+ boundsBehavior: Flickable.StopAtBounds
TextArea.flickable: TextArea {
id: output
text: "show received reply information area\n...\n...\n...\n...\n"
- font.pixelSize: 20
+ font.pixelSize: 24
wrapMode: TextArea.Wrap
+ color: '#00ADDC'
}
ScrollBar.vertical: ScrollBar { }
@@ -50,9 +59,13 @@ ApplicationWindow {
// select onscreen type area
GroupBox {
- title: "Please select send OnScreen Type"
- font.pixelSize: 30
- font.bold: true
+ label: Label {
+ text: qsTr("Please select send OnScreen Message")
+ font.pixelSize: 32
+ font.bold: true
+ color: "white"
+ }
+
width: 800
height: 100
Layout.alignment: Qt.AlignLeft
@@ -60,36 +73,32 @@ ApplicationWindow {
RowLayout {
anchors.fill: parent
RadioButton {
- text: qsTr("VICS")
+ text: qsTr("One Button")
font.pixelSize: 20
checked: true
onClicked: {
- selectVICS();
- console.log("clicked:", "VICS")
+ selectOneButton();
}
}
RadioButton {
- text: qsTr("SYS")
+ text: qsTr("Two Buttons")
font.pixelSize: 20
onClicked: {
- selectSYS();
- console.log("clicked:", "SYS")
+ selectTwoButtons();
}
}
RadioButton {
- text: qsTr("TEL")
+ text: qsTr("Three Buttons")
font.pixelSize: 20
onClicked: {
- selectTEL();
- console.log("clicked:", "TEL")
+ selectThreeButtons();
}
}
RadioButton {
- text: qsTr("MSG")
+ text: qsTr("No Button")
font.pixelSize: 20
onClicked: {
- selectMSG();
- console.log("clicked:", "MSG")
+ selectNoButton();
}
}
}
@@ -97,106 +106,161 @@ ApplicationWindow {
// edit post message area
GroupBox {
- id : editarea
- title: "Please input parameter to onscreen"
- font.pixelSize: 30
- font.bold: true
+ label: Label {
+ text: qsTr("Post Infomations")
+ font.pixelSize: 32
+ font.bold: true
+ color: "white"
+ }
width: 800
height: 400
Layout.alignment: Qt.AlignLeft
+ Layout.maximumWidth: 800
+ Layout.maximumHeight: 400
ColumnLayout {
spacing: 20
RowLayout {
- id: line3
spacing: 20
Label {
- id: dataname1
+ id: ons_title
anchors.left: parent.left
anchors.leftMargin: 30
- text: qsTr("info")
+ text: qsTr("ons_title:")
font.pixelSize: 20
font.italic: true
color: '#00ADDC'
}
- TextInput {
- id: data1
- text: qsTr("tokyo vics information!")
+ Label {
+ id: ons_title_data
+ text: onsTitle
font.pixelSize: 20
font.italic: true
- anchors.left: dataname1.right
+ anchors.left: ons_title.right
anchors.leftMargin: 20
color: '#00ADDC'
- cursorVisible: true
- inputMethodHints: Qt.ImhNone
- onFocusChanged: {
- console.log("OnScreenData1")
- if(data1.focus)
- vkb.visible = true
- }
+ Layout.maximumWidth: 600
+ Layout.maximumHeight: 40
+ maximumLineCount: 1
+ wrapMode: Text.Wrap
+ elide: Text.ElideRight
+ horizontalAlignment: Label.AlignHCenter
+ verticalAlignment: Label.AlignVCenter
}
}
RowLayout {
- id: line4
- visible: false
spacing: 20
Label {
- id: dataname2
+ id: ons_type
anchors.left: parent.left
anchors.leftMargin: 30
- text: qsTr("")
+ text: qsTr("type:")
font.pixelSize: 20
font.italic: true
color: '#00ADDC'
}
- TextInput {
- id: data2
- text: qsTr("")
+ Label {
+ id: ons_type_data
+ text: onsType
font.pixelSize: 20
font.italic: true
- anchors.left: dataname2.right
+ anchors.left: ons_type.right
anchors.leftMargin: 20
color: '#00ADDC'
- cursorVisible: true
- inputMethodHints: Qt.ImhNone
- onFocusChanged: {
- console.log("OnScreenData2")
- if(data2.focus)
- vkb.visible = true
- }
}
}
RowLayout {
- id: line5
- visible: false
spacing: 20
Label {
- id: dataname3
+ id: ons_contents
anchors.left: parent.left
anchors.leftMargin: 30
- text: qsTr("")
+ text: qsTr("contents:")
+ font.pixelSize: 20
+ font.italic: true
+ color: '#00ADDC'
+ }
+ Label {
+ id: ons_contents_data
+ text: onsContents
+ font.pixelSize: 20
+ font.italic: true
+ anchors.left: ons_contents.right
+ anchors.leftMargin: 20
+ color: '#00ADDC'
+ Layout.maximumWidth: 600
+ Layout.maximumHeight: 200
+ maximumLineCount: 4
+ wrapMode: Text.Wrap
+ elide: Text.ElideRight
+ horizontalAlignment: Label.AlignLeft
+ verticalAlignment: Label.AlignVCenter
+ }
+ }
+ RowLayout {
+ spacing: 20
+ Label {
+ id: btn1
+ anchors.left: parent.left
+ anchors.leftMargin: 30
+ text: qsTr("Button1")
font.pixelSize: 20
font.italic: true
color: '#00ADDC'
}
- TextInput {
- id: data3
- text: qsTr("")
+ Label {
+ id: btn1_data
+ text: onsButton1
+ font.pixelSize: 20
+ font.italic: true
+ anchors.left: btn1.right
+ anchors.leftMargin: 20
+ color: '#00ADDC'
+ }
+ }
+ RowLayout {
+ spacing: 20
+ Label {
+ id: btn2
+ anchors.left: parent.left
+ anchors.leftMargin: 30
+ text: qsTr("Button2")
font.pixelSize: 20
font.italic: true
- anchors.left: dataname3.right
+ color: '#00ADDC'
+ }
+ Label {
+ id: btn2_data
+ text: onsButton2
+ font.pixelSize: 20
+ font.italic: true
+ anchors.left: btn2.right
+ anchors.leftMargin: 20
+ color: '#00ADDC'
+ }
+ }
+ RowLayout {
+ spacing: 20
+ Label {
+ id: btn3
+ anchors.left: parent.left
+ anchors.leftMargin: 30
+ text: qsTr("Button3")
+ font.pixelSize: 20
+ font.italic: true
+ color: '#00ADDC'
+ }
+ Label {
+ id: btn3_data
+ text: onsButton3
+ font.pixelSize: 20
+ font.italic: true
+ anchors.left: btn3.right
anchors.leftMargin: 20
color: '#00ADDC'
- cursorVisible: true
- inputMethodHints: Qt.ImhNone
- onFocusChanged: {
- console.log("OnScreenData3")
- if(data3.focus)
- vkb.visible = true
- }
}
}
}
@@ -208,93 +272,71 @@ ApplicationWindow {
text: "Post"
Layout.alignment: Qt.AlignCenter
onClicked: {
- console.log("poster pressed")
- if (onsId != "")
- postMessage();
+ postMessage();
}
}
}
- InputPanel {
- id: vkb
- visible: false
- anchors.right: parent.right
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- onActiveChanged: {
- if(!active) { visible = false; }
- }
+ function selectOneButton() {
+ console.log("select one button!")
+ onsTitle = qsTr("One Button title")
+ onsType = qsTr("critical")
+ onsContents = qsTr("An operating system is a program that manages a computer’s hardware.")
+ onsButton1 = qsTr("Yes")
+ onsButton2 = qsTr("")
+ onsButton3 = qsTr("")
}
- function selectVICS() {
- filepath = pri_path + "vics.qml";
- dataname1.text = "info"
- data1.text = "tokyo vics information!"
- dataname2.text = ""
- data2.text = ""
- dataname3.text = ""
- data3.text = ""
- line3.visible = true
- line4.visible = false
- line5.visible = false
+ function selectTwoButtons() {
+ console.log("select two buttons!")
+ onsTitle = qsTr("Two Buttons title")
+ onsType = qsTr("exclamation")
+ onsContents = qsTr("Beforewe can explore the details of computer system operation, we need to know something about system structure. We thus discuss the basic functions of system startup, I/O, and storage early in this chapter. We also describe the basic computer architecture that makes it possible to write a functional operating system.")
+ onsButton1 = qsTr("Yes")
+ onsButton2 = qsTr("No")
+ onsButton3 = qsTr("")
}
- function selectSYS() {
- filepath = pri_path + "system.qml";
- dataname1.text = "type"
- data1.text = "system error"
- dataname2.text = "text"
- data2.text = "System Error Occured!"
- dataname3.text = ""
- data3.text = ""
- line3.visible = true
- line4.visible = true
- line5.visible = false
+ function selectThreeButtons() {
+ console.log("select three buttons!")
+ onsTitle = qsTr("Three Buttons title")
+ onsType = qsTr("information")
+ onsContents = qsTr("We can also view a computer system as consisting of hardware, software,and data. The operating system provides the means for proper use of these resources in the operation of the computer system.")
+ onsButton1 = qsTr("Yes")
+ onsButton2 = qsTr("Abort")
+ onsButton3 = qsTr("No")
}
- function selectTEL() {
- filepath = pri_path + "phone.qml";
- dataname1.text = "status"
- data1.text = "Call Answered"
- dataname2.text = ""
- data2.text = ""
- dataname3.text = ""
- data3.text = ""
- line3.visible = true
- line4.visible = false
- line5.visible = false
- }
-
- function selectMSG() {
- filepath = pri_path + "msg.qml";
- dataname1.text = "data1"
- data1.text = "from testApp data1"
- dataname2.text = "data2"
- data2.text = "from testApp data2"
- dataname3.text = "data3"
- data3.text = "from testApp data3"
- line3.visible = true
- line4.visible = true
- line5.visible = true
+ function selectNoButton() {
+ console.log("select no button!")
+ onsTitle = qsTr("No Button title,very long title beyond screen wide which will show ellipsis at the end")
+ onsType = qsTr("question")
+ onsContents = qsTr("Recently, many varieties of mobile computers, such as smartphones and tablets, have come into fashion. Most mobile computers are standalone units for individual users. Quite often, they are connected to networks through cellular or other wireless technologies. Increasingly, these mobile devices are replacing desktop and laptop computers for people who are primarily interested in using computers for e-mail and web browsing. The user interface for mobile computers generally features a touch screen, where the user interacts with the system by pressing and swiping fingers across the screen rather than using a physical keyboard and mouse.")
+ onsButton1 = qsTr("")
+ onsButton2 = qsTr("")
+ onsButton3 = qsTr("")
}
function postMessage() {
- postmsg = "{\"file\": \"" + filepath + "\"";
- if (data1.text != "") {
- msgdata = "\"" + dataname1.text + "\":\"" + data1.text + "\"";
+ console.log("poster pressed")
+ btndata = ""
+ postmsg = "{\"title\": \"" + onsTitle + "\"," + "\"type\": \"" + onsType + "\"," + "\"contents\": \"" + onsContents + "\"";
+ if (onsButton1 != "") {
+ btndata = "\"" + onsButton1 + "\"";
}
- if (data2.text !="") {
- if (msgdata != "")
- msgdata += ",";
- msgdata += "\"" + dataname2.text + "\":\"" + data2.text + "\"";
+ if (onsButton2 != "") {
+ if (btndata != "")
+ btndata += ",";
+ btndata += "\"" + onsButton2 + "\"";
}
- if (data3.text !="") {
- if (msgdata != "")
- msgdata += ",";
- msgdata += "\"" + dataname3.text + "\":\"" + data3.text + "\"";
+ if (onsButton3 != "") {
+ if (btndata != "")
+ btndata += ",";
+ btndata += "\"" + onsButton3 + "\"";
}
- if(msgdata != "")
- postmsg += ",\"data\":{" + msgdata + "}}"
+
+ if(btndata != "")
+ postmsg += ",\"buttons\":[" + btndata + "]}"
else
postmsg += "}"
@@ -304,6 +346,5 @@ ApplicationWindow {
function qmlOnReplyShowWindow(text) {
console.log("onstestapp received:",text);
output.text = text;
- eventHandler.hideWindow(onsId);
}
}