Qt Forum

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

    Call for Presentations - Qt World Summit

    Solved Scripting bug in QML ?

    QML and Qt Quick
    2
    5
    465
    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.
    • V
      VeNToR last edited by

      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 );
      

      }
      ...

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        V 1 Reply Last reply Reply Quote 1
        • V
          VeNToR @SGaist last edited by

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

          1 Reply Last reply Reply Quote 0
          • V
            VeNToR last edited by

            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);
            	}
            }
            

            }

            1 Reply Last reply Reply Quote 0
            • V
              VeNToR last edited by

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

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