i have looked up for this problem in the QT Document ,but i can't find any solutions ,plz help me![]()
i have looked up for this problem in the QT Document ,but i can't find any solutions ,plz help me![]()
What label?
You have to set the item flags, as needed:
Qt Code:
model->item(0,0)->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);To copy to clipboard, switch view to plain text mode
i set the lable model as this below ,however ,the lable still can be edit,i can't find any properties to stop this!
when i double clicked the item ,the lable can be renamed
Qt Code:
model->setData(model->index(0,0),tr("This is input well data file"),Qt::WhatsThisRole| Qt::ItemIsEditable);To copy to clipboard, switch view to plain text mode
Last edited by xiongxiongchuan; 5th June 2010 at 12:50.
If you dont want the item editable, shouldnt you be using NOT of Qt::ItemIsEditable ( ~Qt::ItemIsEditable)![]()
i using the code as this ,however,it did't display the lable ,and still can be editedQt Code:
model->setData(model->index(0, 0), tr("Well Data"), Qt::DisplayRole|~Qt::ItemIsEditable);To copy to clipboard, switch view to plain text mode![]()
You have to set flags, not data.
Ginsengelf
As far as I remember, I guess the flags are stored in standard item with (Qt::UserRole - 1)
could you give me some more details ,thanks !
try this code:
Qt Code:
To copy to clipboard, switch view to plain text mode
Bookmarks