Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. center checkbox in QTableWidgetItem
Qt 6.12 LTS is out! See what's new in the release blog

center checkbox in QTableWidgetItem

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 576 Views
  • 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.
  • canellasC Offline
    canellasC Offline
    canellas
    wrote on last edited by canellas
    #1

    In

    QTableWidgetItem *_item{new QTableWidgetItem()};
    _item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
    ui->tblWords->setItem(p_row, 0, _item);
    

    I would like to center the check box in column 0 , but I could not find documentation or example showing how to do that.

    Is is possible? Does anyone how or can point me a reference?

    TIA

    Christian EhrlicherC 1 Reply Last reply
    0
    • canellasC canellas

      In

      QTableWidgetItem *_item{new QTableWidgetItem()};
      _item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
      ui->tblWords->setItem(p_row, 0, _item);
      

      I would like to center the check box in column 0 , but I could not find documentation or example showing how to do that.

      Is is possible? Does anyone how or can point me a reference?

      TIA

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      That's currently the only way: https://wiki.qt.io/Center_a_QCheckBox_or_Decoration_in_an_Itemview

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0

      • Login

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