Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

setSpan Qt5



  • Hello, got a little confused with QTableWidget. Need help

    Qt3: QTableItem*item = table->item(table->numRows()-2,0);
    item->setSpan(item->rowSpan()+1,1);

    Qt5: int row = table->rowCount()-2;
    table->setSpan(row, 0, rowSpan(row, 0)+1, 1);

    Got the message: qtableview::setspan span cannot overlap
    So I went for this types of essay to find a proper solution.

    Did it other way:

    QTableWidgetItem*item = table->item(table->rowCount()-2,0);
    table->setSpan(item->row(), item->column(),
    table->rowSpan(item->row(), item->column())+1,
    table->columnSpan(item->row(), item->column()));

    Error - value()->column() -1


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you explain (maybe show with an image) the result you want to achieve ?


Log in to reply