PDA

View Full Version : QTextEdit does not hold Object Id behind



validator
16th April 2008, 14:55
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?

jacek
16th April 2008, 21:27
What exactly that "object" is? Is it some class instance or a record in a database?

validator
18th April 2008, 07:55
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.

jacek
19th April 2008, 00:25
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.