Results 1 to 8 of 8

Thread: modify a QML Text from C++

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: modify a QML Text from C++

    Quote Originally Posted by neda View Post
    > I am surprised that this works.
    Why? Which part of the code is illogical?
    You load the QML file before setting the context property but the QML code accesses the context property.
    I would have expect that to cause the QML file to fail loading.

    Usually one would set the context property before loading.

    Quote Originally Posted by neda View Post
    > In any case you should not call MyDisplay::setText()
    Why?
    It is OK now, I didn't see you had removed the usage of QThread.

    Quote Originally Posted by neda View Post
    > from the secondary thread
    secondary thread? I did not use thread.
    Right, you had thread usage earlier, didn't see that this changed.

    That also makes the signal/slot approach unnecessary.

    Since you are not using threading anymore you could even add the property to the MySerialPort class and set its instance as the context property.

    Cheers,
    _

  2. The following user says thank you to anda_skoa for this useful post:

    neda (17th February 2016)

Similar Threads

  1. Replies: 1
    Last Post: 11th May 2014, 08:29
  2. Replies: 6
    Last Post: 3rd August 2012, 06:48
  3. Replies: 1
    Last Post: 24th April 2010, 15:31
  4. How to modify the content of text file
    By grsandeep85 in forum Qt Programming
    Replies: 3
    Last Post: 31st July 2009, 10:23
  5. how to modify the text of node in xml docment?
    By GChen in forum Qt Programming
    Replies: 5
    Last Post: 26th February 2009, 10:48

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.