Scripting bug in QML ?



  • Hi;

    By the following, when I click the button, first time is OK. But second click closes all the windows with out any exception, error etc...

    Any one can try it on own codes ?

    ....
    onClicked:
    {
    function CChRSMFile()
    {
    }

    CChRSMFile.prototype.ChPut = function(
    	ChData)
    {
    	print("It's OK...");
    }
    
    var ChBuffer = "";
    
    for (var i = 0; i < 8192; i++)
    	ChBuffer += ".";
    
    for (var i = 0; i < 50; i++)
    	ChRSMFile.ChPut(
    		ChBuffer );
    

    }
    ...


  • Lifetime Qt Champion

    Hi,

    You should post a complete example if you want people to be able to reproduce your situation.

    You should also add the Qt version you are using as well as platform you are running on.



  • @SGaist Yes, you are right ! I am trying to minimize and localize the problem to understand by others... But at this point I can say this is very interresting problem...



  • Simplized codes are following;

    main code;

    import QtQuick 2.9
    import QtQuick.Controls 2.3
    import QtQuick.Controls.Material 2.1
    import QtQuick.Layouts 1.3

    import Qt.labs.settings 1.0

    import Content 1.0

    ApplicationWindow
    {
    id : window
    width : 1024
    height : 768
    visible : true
    title : "Quasar"

    SwipeView
    {
    	id	: chSwipeView
    
    	anchors
    	{
    		fill	: parent
    	}
    
    	Component
    	{
    		id	: chComponent
    
    		Loader
    		{
    			asynchronous	: true			
    		}
    	}
    
    	Timer
    	{
    		interval	: 500
    		running		: true
    		repeat		: false
    
    		onTriggered	:
    			{
    				var	ChItem;
    
    				ChItem = chComponent.createObject();
    
    				if (
    					chComponent.status == Loader.Ready)
    				{
    					ChItem.source = "Content/ChPageTest.ui.qml";
    
    					chSwipeView.addItem(
    						ChItem);
    
    					chSwipeView.currentIndex = chSwipeView.count - 1;
    				}
    			}
    	}
    }
    

    }

    Content/ChPageTest.ui.qml code;

    import QtQuick 2.9
    import QtQuick.Layouts 1.3
    import QtQuick.Controls 2.3

    Item
    {
    anchors.fill : parent

    Button
    {
    	text:"test me"
    
    	onClicked:
    	{
    		var ChRSMFile;
    
    		function CChRSMFile()
    		{
    		}
    
    		CChRSMFile.prototype.ChPut = function(
    			ChData)
    		{
    			print("test");
    		}
    
    		ChRSMFile = new CChRSMFile();
    
    		var s = "";
    
    		for (var i = 0; i < 65535; i++) s+="a";
    
    		for (var i = 0; i < 50; i++)
    			ChRSMFile.ChPut(
    				s);
    	}
    }
    

    }



  • I solved, do not forget to give parent item to createObject.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.