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. Scripting bug in QML ?

Scripting bug in QML ?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 728 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.
  • V Offline
    V Offline
    VeNToR
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      1
      • SGaistS SGaist

        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.

        V Offline
        V Offline
        VeNToR
        wrote on last edited by
        #3

        @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
        0
        • V Offline
          V Offline
          VeNToR
          wrote on last edited by
          #4

          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
          0
          • V Offline
            V Offline
            VeNToR
            wrote on last edited by
            #5

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

            1 Reply Last reply
            1

            • Login

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