Inconsistent javascript var values - Desktop vs Arm Kit - Qt 5.6
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
qtcreator (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Hi all,
I'm working on a simple Ubuntu phone app with Qt Creator 3.5.1
I should mention I'm running ubuntu-sdk on Linux Mint 18 Sarah.Kernel version #37-Ubuntu SMP
After recently (9/7) updating the Build Kits (UbuntuSDK for armhf (GCC ubuntu-
When building and running the app with the Desktop Kit, I'm getting different javascript var values (which are incorrect) than when building and running on a phone with the armhf kit.
In the below function getAddress(type) the variables stip1, stip2, stip3, stip4 return inconsitent values.
Example output:
(Desktop)
input: 192.168.127.64/26
Start IP Address: 192.168.64.64
(Arm Kit on Phone)
input: 192.168.127.64/26
Start IP Address: 192.168.127.64 <-- correct
Thanks,
Bob
Main.qml code:
import QtQuick 2.4
import Ubuntu.Components 1.3
/*!
\brief MainView with a Label and Button elements.
*/
MainView {
// objectName for functional testing purposes (autopilot-qt5)
objectName: "mainView"
id:root
// Note! applicationName needs to match the "name" field of the click manifest
application
// useDeprecatedTo
width: units.gu(100)
height: units.gu(75)
property real margins: units.gu(2)
function getAddress(type) {
var ip1 = ip1Text.text ? parseInt(
var ip2 = ip2Text.text ? parseInt(
var ip3 = ip3Text.text ? parseInt(
var ip4 = ip4Text.text ? parseInt(
var cidr = cidrText.text ? parseInt(
var stip1 = ip1; var stip2 = ip2; var stip3 = ip3; var stip4 = ip4;
var enip1 = ip1; var enip2 = ip2; var enip3 = ip3; var enip4 = ip4;
var sm1=255; var sm2=255; var sm3=255;var sm4=255
if (cidr < 8)
{
var x = Math.pow(2, (8 - cidr)) - 1
sm1 -= x
sm2 = 0
sm3 = 0
sm4 = 0
stip1 = sm1 & ip1
enip1 = stip1 | x
stip2 = 0; stip3 = 0; stip4 = 0
enip2 = 255; enip3 = 255; enip4 = 255
} else if (cidr < 16)
{
var x = Math.pow(2, (16 - cidr)) - 1
sm2 -= x
sm3 = 0
sm4 = 0
stip2 = sm2 & ip2
enip2 = stip2 | x
stip3 = 0; stip4 = 0
enip3 = 255; enip4 = 255
} else if (cidr < 24)
{
var x = Math.pow(2, (24 - cidr)) - 1
sm3 -= x
sm4 = 0
stip3 = sm3 & ip3
enip3 = stip3 | x
stip4 = 0
enip4 = 255
} else if (cidr < 32)
{
var x = Math.pow(2, (32 - cidr)) - 1
sm4 -= x
stip4 = sm4 & ip4
enip4 = stip4 | x
}
{
case "start":
if (hexButton.hex == true) {
}
var result = stip1 + "." + stip2 + "." + stip3 + "." + stip4;
return result
case "end" :
if (hexButton.hex == true) {
}
return enip1 + "." + enip2 + "." + enip3 + "." + enip4
case "subnet" :
if (hexButton.hex == true) {
}
return sm1 + "." + sm2 + "." + sm3 + "." + sm4
default:
return "oops"
}
}
Page {
id:pageView
//title: i18n.tr("IP Calc")
header: PageHeader {
id: pageHeader
title: i18n.tr("IP Address Calculator")
}
}
Column {
id: pageLayout
anchors {
// margins: root.margins
top: pageHeader.bottom
}
Row {
// anchors.topMargin: 5
}
}
}
}
}
}
}
}
}
}
Row {
}
}
Row {
}
}
Row {
}
}
}
Column {
Row {
}
}
}
}
}
}
}