Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Loose a Placeholder due to a loader qml
QtWS25 Last Chance

Loose a Placeholder due to a loader qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
placeholderloaderqml
4 Posts 3 Posters 1.5k Views
  • 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 Offline
    J Offline
    Juanjex
    wrote on 22 May 2017, 16:47 last edited by
    #1

    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
    0
    • D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 23 May 2017, 03:04 last edited by dheerendra
      #2

      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
      3
      • J Offline
        J Offline
        Juanjex
        wrote on 24 May 2017, 16:17 last edited by
        #3

        Excellent ! now is working

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on 25 May 2017, 05:19 last edited by
          #4

          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
          0

          1/4

          22 May 2017, 16:47

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved