Project

General

Profile

How to add checkbox to WStandardItemModel

Added by Tha J almost 11 years ago

I tried to add checkbox column to WTableView,

WStandardItemModel tableModel= new WStandardItemModel(10,3, this);

for (int i = 0; i < 10; i) {

tableModel.setData(i, 0, false,ItemDataRole.CheckStateRole);

tableModel.setData(i, 1, "name",ItemDataRole.DisplayRole);

tableModel.setData(i, 2, "address",ItemDataRole.DisplayRole);

}

This checkbox default state is disable.

How I add event listeners and change attributes of this checkbox?


Replies (1)

RE: How to add checkbox to WStandardItemModel - Added by Koen Deforche almost 11 years ago

Hey,

What attributes would you want to change of the checkbox?

Although there is no event signal for it, you can react to its events by overriding WStandardItemModel::setData() and checking for CheckStateRole data, by specializing the WStandardItemModel.

Regards,

koen

    (1-1/1)