visual studio - Set height of row of table in Qt -
i want create table, code in qtcreator:
ui->tablewidget->setselectionbehavior(qabstractitemview::selectrows); ui->tablewidget->setselectionmode(qabstractitemview::singleselection); ui->tablewidget->setcolumncount(5); ui->tablewidget->sethorizontalheaderlabels(qstringlist() << tr("first") << tr("second") << tr("third") << tr("fourth") << tr("fifth")); ui->tablewidget->setcolumnwidth(0, 80); ui->tablewidget->setcolumnwidth(1, 140); ui->tablewidget->setcolumnwidth(2, 80); ui->tablewidget->setcolumnwidth(3, 140); ui->tablewidget->setstylesheet("qheaderview::section { background-color: rgb(217,217,217)}"); ui->tablewidget->horizontalheader()->setstretchlastsection(true); (int c = 0; c < ui->tablewidget->horizontalheader()->count(); c++) { ui->tablewidget->horizontalheaderitem(c)->setsizehint(qsize(0, 50)); } (int j = 0; j < ui->tablewidget->columncount(); j++) { qtablewidgetitem *item = new qtablewidgetitem; if ((j == 0) || (j == 3) || (j == 4)) { item->setflags(item->flags() & ~qt::itemiseditable); } if (j!=0) { item->settextalignment(qt::aligncenter); } ui->tablewidget->setitem(0, j, item); }
there 1 row in table, designer, there no line number of row in code above. result:
with same code above, in visual studio , receive table:
the height of row vs height of table, large. how can receive small row in qtcreator ?
Comments
Post a Comment