Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Loose a Placeholder due to a loader qml

    QML and Qt Quick
    placeholder loader qml
    3
    4
    1073
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      Juanjex last edited by

      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.1

      Rectangle {
      width : 1024
      height : 768
      Image{
      source: "image/bg1.jpg"
      width: 1024
      height: 768
      }
      Rectangle{
      width : parent.width0.25
      height : parent.height
      0.07
      anchors.horizontalCenter: parent.horizontalCenter
      anchors.top: parent.top
      anchors.topMargin: parent.height*0.32
      radius: 8

      	TextField{
      		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.1

      ApplicationWindow
      {
      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!

      1 Reply Last reply Reply Quote 0
      • dheerendra
        dheerendra Qt Champions 2022 last edited by dheerendra

        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

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply Reply Quote 3
        • J
          Juanjex last edited by

          Excellent ! now is working

          1 Reply Last reply Reply Quote 0
          • E
            Eddy last edited by

            Hi Junajex,

            Could you mark this topic as solved (topic tools on the bottom right > marks as solved)

            Thanks,

            Eddy

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply Reply Quote 0
            • First post
              Last post