Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTableView::setIndexWidget ingored
Qt 6.11 is out! See what's new in the release blog

QTableView::setIndexWidget ingored

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 389 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Evgeny SiberiaE Offline
    Evgeny SiberiaE Offline
    Evgeny Siberia
    wrote on last edited by Evgeny Siberia
    #1

    Hi. Why this code may not works? QToolButton not inserted. The index is correct.

    QToolButton *xTB = new QToolButton(this);
    xTB->setIcon(QIcon(":/main/Sources/Images/minus_tool_button.png"));
    const QModelIndex &index = _model->index(row, column, QModelIndex());
    ui->_tableView->setIndexWidget(index, xTB);
    

    Can delegate affect this?

    if you see mistakes in English tell me about it

    1 Reply Last reply
    0
    • HansonH Offline
      HansonH Offline
      Hanson
      wrote on last edited by
      #2

      Maybe you can try this:
      QToolButton *xTB = new QToolButton(this);
      xTB->setIcon(QIcon(":/main/Sources/Images/minus_tool_button.png"));
      ui->_tableView->setItem(row, column, new QStandardItem(""));
      ui->_tableView->setIndexWidget(_model->indexFromItem(row, column), xTB);

      “Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.”
      —— Martin Golding

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved