Loose a Placeholder due to a loader qml
-
Loose a Placeholder due to a Loader qml.
I have a qml File that works just perfect and its the following
import QtQuick 2.0
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1Rectangle {
width : 1024
height : 768
Image{
source: "image/bg1.jpg"
width: 1024
height: 768
}
Rectangle{
width : parent.width0.25
height : parent.height0.07
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: parent.height*0.32
radius: 8TextField{ id: username anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter width: parent.width *0.9 height: parent.height *0.9 horizontalAlignment: TextInput.AlignHCenter verticalAlignment: TextInput.AlignVCenter placeholderText: "Ingrese su Usuario" //echoMode: TextInput.Password style: TextFieldStyle { font.pointSize: 18 textColor: "black" background: Rectangle{ color: "white" border.width: 0 } } } } Rectangle{ width : parent.width*0.25 height : parent.height*0.07 anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: parent.height*0.42 radius: 8 TextField{ id: password anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter width: parent.width *0.9 height: parent.height *0.9 horizontalAlignment: TextInput.AlignHCenter verticalAlignment: TextInput.AlignVCenter placeholderText: "Ingrese su Contraseña" echoMode: TextInput.Password style: TextFieldStyle { font.pointSize: 18 textColor: "black" background: Rectangle{ color: "white" border.width: 0 } } } } Rectangle{ id: btn_login width : parent.width*0.25 height : parent.height*0.07 anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: parent.height*0.588 radius: 8 color: "transparent" MouseArea{ anchors.fill: parent onClicked: { } } }
}
No problems with it the Placeholder works perfect but when im trying to run the same qml from a loader like this one
import QtQuick 2.0
import QtQuick.LocalStorage 2.0
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.1ApplicationWindow
{
id: root;visible: true; width: 1024; height: 768; //property alias fuente: font_Eurostile.name; //FontLoader {id: font_Eurostile; source: "img/Eurostile.ttf";} Loader { id: content_qml; anchors.fill: parent; //height: parent.height; //width: parent.width; source: "index.qml"; } onClosing: { //close.accepted = false; } //BuzzFeed Foodl function sendData(url, data, callback, callbackError) { var nom_fun = url; url = '/velneo/' + url + "?"; var request_n1 = new XMLHttpRequest(); request_n1.responseType = 'json'; request_n1.onreadystatechange = function() { if(request_n1.readyState == 4) { if(request_n1.responseText != "" && request_n1.response) { callback(request_n1.response); } else { if (callbackError != undefined) callbackError(); else { if(root != undefined) console.log(url); } } } else if (request_n1.readyState == 404){ console.log("se jodio se jodio, el proceso se jodio"); } } request_n1.open("GET", url, true); var contentType = "application/x-www-form-urlencoded; charset=utf-8"; request_n1.setRequestHeader('Content-type', contentType) request_n1.send(); } Component.onCompleted: { }
}
in this case the placeholder of my user and password area ... that says enter username here and enter password here dissapeared so i need help with this please!
-
It could be a issue with width and height when u load through loader. Just for testing hard code the value of width and height in textfield and check if it works