Hi,

I have come across something I don't really understand and would be
grateful if someone could shed some light into my understanding of it.

In the documentation of the Qt4 libs in the page regarding the
QAbstractTableModel you find, to make the table editable, the
following:

Qt::ItemFlags StringListModel::flags(const QModelIndex &index) const
{
    if (!index.isValid())
        return Qt::ItemIsEnabled;

     return QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
}

Now I'm working with PySide, the Python bindings from Nokia and I
figured the
return in the function to be related with a parent
(QAbstractItemModel)
followed by the actual Flag that says: "yes the item, the index is
pointing
at, is actually editable". So translation of the C++ to Python would
be, and
it actually worked:

def flags(self, index):
    if not index.isValid():
        return Qt.ItemIsEnabled

    return super(self.__class__, self).flags(index) |
Qt.ItemIsEditable

Still I dont get how I am supposed to understand the pipe and its task/
idea/influece on control flow, of:
return <statement> | <statement>
??

Thankful if you could help me with this.

Kind regards,
Archard Lias
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to