hi.
i want to create search results window, so i put QTextBrowsers in QTableWidget's cells using setCellWidget. there is a problem: horizontal scroll bar in QTableWidget is never appears in contrast to the vertical, which is appears when its needed. all scroll bar settings are default.
how can i get this scroll when its needed? and even when i set horizontalScrollBarPolicy in alwaysOn, there is no slider on it even when it should be.
and also how to adjust table's cell size to full browser's text size?
there is some sample code
// ui->tw is a QTableWidget
ui->tw->insertRow(0);
b->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
b->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
b->setHtml(tr("some <b>HTML</b> <i>marked</i> search result <u>that does not fit in table cell without scroll bar</u>"));
ui->tw->setCellWidget(0,0,b);
// ui->tw is a QTableWidget
ui->tw->insertRow(0);
b = new QTextBrowser(ui->tw);
b->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
b->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
b->setWordWrapMode(QTextOption::NoWrap);
b->setHtml(tr("some <b>HTML</b> <i>marked</i> search result <u>that does not fit in table cell without scroll bar</u>"));
ui->tw->setCellWidget(0,0,b);
To copy to clipboard, switch view to plain text mode
Bookmarks