Results 1 to 4 of 4

Thread: QTextEdit does not hold Object Id behind

  1. #1
    Join Date
    Feb 2008
    Posts
    36
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QTextEdit does not hold Object Id behind

    I must use QtextEdit to fill and select object.I want to show name of object in QtextEdit and I want to use Id of Object but QtextEdit does not hold Id behind.
    How can I do or not?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit does not hold Object Id behind

    What exactly that "object" is? Is it some class instance or a record in a database?

  3. #3
    Join Date
    Feb 2008
    Posts
    36
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTextEdit does not hold Object Id behind

    For example I have a XMl file

    <Students>
    <Student ID="1">
    <Name>joo<Name/>
    </Student>

    Student ID="2">
    <Name>foo<Name/>
    </Student>

    </Students>

    I read xml file and I write names of student into QtextEdit .When I want to update in name of a student , I select a name from QTextEdit.I parse Xml according to student ID so I hold ID of student behind. How I can do this.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit does not hold Object Id behind

    In that case I would use one of the QxxxView or QxxxWidget classes instead of QTextEdit. This way you won't have any problems in selecting particular items and you can easily store additional data for example in a model (in case of QxxxView classes) or member variables (in case of QxxxWidget classes).

    Take a look at QTableWidgetItem.

Similar Threads

  1. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  2. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03
  3. Replies: 4
    Last Post: 10th May 2006, 22:37
  4. QTextEdit Justify align making work
    By dec0ding in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2006, 12:02

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.