PDA

View Full Version : Help plz! I’m stuck with these delegates



codeaddict
15th August 2008, 23:25
I need to control items individually in a QTableWidget , I’m using Delegates, I have a column with a QTimeEdit and I want to be able to use this QTimeEdit as a Timer (Chronometer) I want t be able to start a specifique one depending on the selected Row
Thanks a lot guys :)

codeaddict
16th August 2008, 17:28
Any solution PLZ?

jpn
18th August 2008, 08:42
Could you elaborate? What did you try so far and what's the problem you're facing?

codeaddict
18th August 2008, 11:51
Thanks jpn , I just want to control a specific item (the item will be defined by a row and a column) in a QTableWidget, right now I can only control a specific column, again, I’m using Delegates, Thanks:)

jpn
18th August 2008, 12:59
I just want to control a specific item (the item will be defined by a row and a column) in a QTableWidget
Well, this is exactly what QTableWidgetItem is for. :) Anyway, the keyword here is "control". Exactly what do you mean with it?


right now I can only control a specific column, again, I’m using Delegates
Why would delegates be restricted to a specific column?

codeaddict
19th August 2008, 13:04
Thanks again JPN,


Why would delegates be restricted to a specific column?

Well, that’s the question men, How can’ I define an index with a row and a column? Is that possible just with QModelIndex or I should subclass QAbstractModelIndex to do it?
Look at this:

http://www.qtcentre.org/forum/attachment.php?attachmentid=2475&stc=1&d=1219147101

For example I want to be able to use those QTimeEdit in column 1 as Timers (Chronometers)
And I want for example to start just that one on row 1

wysota
19th August 2008, 20:26
There is no such thing as an abstract model index. You can do a thing similar to this:


QWidget *XX::createEditor(... index ... ){
if(index.row()==7 && index.column()=1) return new QTimeEdit;
return QItemDelegate::createEditor(...);
}

codeaddict
19th August 2008, 21:33
Thanks man I really appreciate your help, I got the idea, Thanks a lot