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. TextEdit in a ListView delegate
Forum Updated to NodeBB v4.3 + New Features

TextEdit in a ListView delegate

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 2.2k Views 1 Watching
  • 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
    jech
    wrote on last edited by
    #1

    Hi,

    I'm trying to implement a list of text items. The text is editable, the delegate component contains a TextEdit item.

    The behavior should be following:

    1. As soon as the text changes from the initial value a save buttonto store the cahnges appears (this is already implemented).
    2. When I click on another item, the change will not be saved and the TextEdit.text will return to the initial value.

    I don't know how should I implement the second part. Do you have any idea?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      Did you implement method setModelData() of the delegate? This is called in case the view ends the edit process in order to transfer the edit widgets contents to the model.

      (oops ... it's about Qt Quick, dunno, if that applies here too.)

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jech
        wrote on last edited by
        #3

        I solved the problem easily with a completely different approach then what I was trying first. I use Python (PySide) for the application logic and I didn't realize that I only need to call changed signal of a list item and the data will revert to the original values.

        Sometimes it is better to take a day off and then look at the problem from a different side.

        1 Reply Last reply
        0

        • Login

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