
Originally Posted by
darpan
1) I want to iterate through the each columns items.
for(int i=0;i<table->numRows();i++){
QTableItem *item = table->item(i, 0);
qDebug("Column 0 of item %d says '%s'", i, item->text().latin1());
}
for(int i=0;i<table->numRows();i++){
QTableItem *item = table->item(i, 0);
qDebug("Column 0 of item %d says '%s'", i, item->text().latin1());
}
To copy to clipboard, switch view to plain text mode
2) I want to get no. of Checked items in first col and item also.
uint itemschecked = 0;
for(int i=0;i<table->numRows();i++){
QTableItem *item = table->item(i, 0);
QCheckTableItem *checkitem = dynamic_cast<QCheckTableItem*>(item);
if(checkitem && checkitem->isChecked()) itemschecked++;
}
qDebug("Total of %d items checked", itemschecked);
uint itemschecked = 0;
for(int i=0;i<table->numRows();i++){
QTableItem *item = table->item(i, 0);
QCheckTableItem *checkitem = dynamic_cast<QCheckTableItem*>(item);
if(checkitem && checkitem->isChecked()) itemschecked++;
}
qDebug("Total of %d items checked", itemschecked);
To copy to clipboard, switch view to plain text mode
3) Third column is editable but when i double click on this column then only the cursor for editing appears, how i can do this on single click and give focus to edit.
connect(table,
SIGNAL(clicked
(int,
int,
int,
const QPoint &), table,
SLOT(editCell
(int,
int)));
connect(table, SIGNAL(clicked(int, int, int, const QPoint &), table, SLOT(editCell(int, int)));
To copy to clipboard, switch view to plain text mode
4) When i inserting using the above code then last row is inserted which only have checkbox.
I don't understand your question, sorry
Bookmarks