Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, February 2007
Non-editable item in QTableView


Message 1 in thread

Hi Everyone,
I have a QStandardItemModel and a QTableView to display it.
But I want to forbid user modification on specific item, such as
row 2 column 2.

How can I do that ?

Regards,
Pagan


--
 [ signature omitted ] 

Message 2 in thread

On 06.02.07 10:21:21, Pagan Chou wrote:
> Hi Everyone,
> I have a QStandardItemModel and a QTableView to display it.
> But I want to forbid user modification on specific item, such as
> row 2 column 2.
> 
> How can I do that ?

By reading the QStandardItem documentation, there's a method to change
that.

Andreas

-- 
 [ signature omitted ] 

Message 3 in thread

Hi Everyone,
Sorry I didn't clarify my QT version. My QT version is 4.1.4.

There is no QStandardItem class in QT 4.1.4.

I checked all the documentation in QT 4.1.4. I found the only way to
set item flag of a QStandItemModel is to inherit from QStandItemModel
and override the QStandardItemModel::flag.

Is it true ?? Is there other way to set a item flag to non-editable ??

Regards,
Pagan



"Andreas Pakulat" <apaku@xxxxxx> ???
news:20070206083125.GC11879@xxxxxxxxxxxxxxxxxxxxxxxxxxx ???...
> On 06.02.07 10:21:21, Pagan Chou wrote:
> > Hi Everyone,
> > I have a QStandardItemModel and a QTableView to display it.
> > But I want to forbid user modification on specific item, such as
> > row 2 column 2.
> >
> > How can I do that ?
>
> By reading the QStandardItem documentation, there's a method to change
> that.
>
> Andreas
>
> -- 
> Beware of Bigfoot!
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/


--
 [ signature omitted ] 

Message 4 in thread

On Friday 09 February 2007 07:35, Pagan Chou wrote:
> Hi Everyone,
> Sorry I didn't clarify my QT version. My QT version is 4.1.4.
>
> There is no QStandardItem class in QT 4.1.4.
>
> I checked all the documentation in QT 4.1.4. I found the only way to
> set item flag of a QStandItemModel is to inherit from QStandItemModel
> and override the QStandardItemModel::flag.
>
> Is it true ?? Is there other way to set a item flag to non-editable ??
>
> Regards,
> Pagan

That is correct, in 4.1.4 you need to subclass QStandardItemModel.

-Benjamin Meyer

--
 [ signature omitted ] 

Message 5 in thread

On 09.02.07 14:35:02, Pagan Chou wrote:
> Hi Everyone,
> Sorry I didn't clarify my QT version. My QT version is 4.1.4.
> 
> There is no QStandardItem class in QT 4.1.4.

Right, it was added in Qt4.2 it seems. So one way would be to upgrade to
4.2

> I checked all the documentation in QT 4.1.4. I found the only way to
> set item flag of a QStandItemModel is to inherit from QStandItemModel
> and override the QStandardItemModel::flag.
> 
> Is it true ?? Is there other way to set a item flag to non-editable ??

No, thats what you need to do if you want to stick with
QStandardItemModel and Qt 4.1.4

Andreas

-- 
 [ signature omitted ]