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
Forum Updated to NodeBB v4.3 + New Features

Checkboxes in cells of QTableWidget are not coming correctly

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 272 Views 2 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on 8 Jan 2019, 19:25 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 8 Jan 2019, 19:36 last edited by mrjj 1 Aug 2019, 19:40
      #2

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

      1 Reply Last reply
      1

      1/2

      8 Jan 2019, 19:25

      • Login

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