Thanks.  That got rid of the checkboxes, but it still looks a little
different.  The words don't seem vertically aligned like they normally
do by default, and if I select a cell and start editing it, the cursor
seems to line up horizontally with a big margin on the left inside the
cell like it's still leaving space for the checkbox.  I attached a
file that has a little selection box showing what I'm talking about.

Thanks, Josh

On Sat, Nov 20, 2010 at 9:59 AM, Robert Lebel <[email protected]> wrote:
> Hi,
>
> For the checkStateRole, I think you need to return null instead of a 
> QVariant()
>
> 2010/11/19 Josh Stratton <[email protected]>:
>> I have a simple QAbstractTableModel and set it as the model for a
>> QTableView.  However, I see every cell as a checkbox in it beside the
>> text.  This is unusual for me as I usually have to request it in the
>> flags method (in pyqt and C++).  However, reimplementing the flags
>> method and explicitly skipping the ItemCheckable flag, I still get
>> checkboxes in my cells.  I can catch the CheckStateRole in data and
>> return a check state, but I don't want any checks at all.  Where are
>> those checks being specified?
>>
>>    public HandleListModel(Object obj, String[] handleInfo) {
>>        super();
>>        props = handleInfo;
>>    }
>>    public int rowCount(QModelIndex parent) {
>>        return props.length;
>>    }
>>    public int columnCount(QModelIndex parent) {
>>        return 2;
>>    }
>>    public Object data(QModelIndex index, int role) {
>>        int row = index.row();
>>        int column = index.column();
>>
>>        if (role == Qt.ItemDataRole.DisplayRole) {
>>            if (column == 0)
>>                return props[row].split(":")[1];
>>            else
>>                return "ack";
>>        } else if (role == Qt.ItemDataRole.CheckStateRole) {
>>            return Qt.CheckState.Checked;
>>        } else
>>            return new QVariant();
>>    }
>>    public Qt.ItemFlags flags(QModelIndex index) {
>>
>>        return new Qt.ItemFlags(new Qt.ItemFlag[]{Qt.ItemFlag.ItemIsEnabled,
>>                    Qt.ItemFlag.ItemIsSelectable});
>>    }
>> _______________________________________________
>> Qt-jambi-interest mailing list
>> [email protected]
>> http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
>>
>

<<attachment: spreadsheet.png>>

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to