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. how to pack a completely a widget in a cell of a QTableWidget
Forum Updated to NodeBB v4.3 + New Features

how to pack a completely a widget in a cell of a QTableWidget

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

    I have following code

    LabelButtonCellWidget::LabelButtonCellWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::LabelButtonCellWidget)
    {
    ui->setupUi(this);
    }

    LabelButtonCellWidget::~LabelButtonCellWidget()
    {
    delete ui;
    }

    Following ui file
    https://paste.ofcode.org/33qXZUWgf7eX4SdZpTKeqY4

    and Usage of LabelButton Widget

    col = 5;
    LabelButtonCellWidget* l1 = new LabelButtonCellWidget(this) ;
    l1->setStyleSheet("background-color: rgb(228,228,228)");
    t->setCellWidget(rowCount,col,l1);
    t->setColumnWidth(col,15);

    but the cell widget is not coming properly

    Is it possible to remove the space and pack the text + completely in the cell

    0_1547021165843_Option.PNG

    jsulmJ 1 Reply Last reply
    0
    • Q Qt Enthusiast

      I have following code

      LabelButtonCellWidget::LabelButtonCellWidget(QWidget *parent) :
      QWidget(parent),
      ui(new Ui::LabelButtonCellWidget)
      {
      ui->setupUi(this);
      }

      LabelButtonCellWidget::~LabelButtonCellWidget()
      {
      delete ui;
      }

      Following ui file
      https://paste.ofcode.org/33qXZUWgf7eX4SdZpTKeqY4

      and Usage of LabelButton Widget

      col = 5;
      LabelButtonCellWidget* l1 = new LabelButtonCellWidget(this) ;
      l1->setStyleSheet("background-color: rgb(228,228,228)");
      t->setCellWidget(rowCount,col,l1);
      t->setColumnWidth(col,15);

      but the cell widget is not coming properly

      Is it possible to remove the space and pack the text + completely in the cell

      0_1547021165843_Option.PNG

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @Qt-Enthusiast said in how to pack a completely a widget in a cell of a QTableWidget:

      Is it possible to remove the space and pack the text + completely in the cell

      What do you mean? What should happen with the extra space if the cell is wider than the content of your widget?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      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 Extensions
      • Unsolved