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. Checkboxes in cells of QTableWidget are not coming correctly

Checkboxes in cells of QTableWidget are not coming correctly

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 268 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    I have following code

    QTableWidget* t = new QTableWidget;
    t->setRowCount(2)l

    QCheckBox* chkbox0 = new QCheckBox;
    QCheckBox* chkbox1 = new QCheckBox;

    int col =0;
    QWidget* wdg = new QWidget;
    QHBoxLayout* layout = new QHBoxLayout(wdg);
    layout->addWidget(chkbox0);
    wdg->setLayout(layout);
    t->setCellWidget(0, col, wdg);

    QWidget* wdg1 = new QWidget;
    QHBoxLayout* layout1 = new QHBoxLayout(wdg1);
    layout1->addWidget(chkbox1);
    wdg1->setLayout(layout);
    t->setCellWidget(1, col, wdg1);

    The checkboxes are not correctly properly the image is not coming proper
    the boundaries of checkboxes in the cell are not coming proper

    0_1546975423936_1.png

    I tried to increase the row height setRowHeight , it did not work out .

    Any suggestions would help

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      layout ->setContentsMargins(0,0,0,0);
      is the cure.
      The default margins cuts the checkbox.

      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