Jha Sonakumar schreef op 23-2-2015 om 07:43:

Hi all,

Is there anyway to append checkbox in each row of the QListView?

Checkbox can be added using *QStandardItem*, but i want checkbox should be shown after the item .


code:

*QStandardItemModel *model = new QStandardItemModel(this);*
*for (int i = 0; i < rowCount; ++i) {*
*        QString sNo = QString::number(i+1);*
*        QString str  = dHandler.m_infoData.at(i).event;*
**
*        QStandardItem *item = new QStandardItem(str.prepend(sNo));*
*        item->setCheckable(true);*
**
*        model->appendRow(item);*
*    }*
*    ui->listView->setModel(model);*



General UX advice: don't put the checkbox after the label.

If you still want to do that:
You might experiment with setting RTL mode on your widget, but I'm not sure if that will do what you need. It would be a bit of hack anyway. The real solution is of course to implement a custom delegate for this. Or, use a QTableView instead, and put the checkbox in a separate column.

André


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to