Unsolved Bold QStringlist
-
What is the preferred way to create a bold QStringlist?
-
Qstringlist doesn't care about attributes like bold. That is the responsbility of how you render the string in in a widget. I "think" that if you add markup to the string such as QWidget::SetText("<b>bold text</b>") it would have the desired effect when rendered.
-
I have a QTableWidget and when I call setHorizontalHeaderLabels(head), where head is a QStringList, I want the header text to be set to bold. But using QStringList is probably not a good approach?
-
@Buller
This has nothing to do with you setting the the labels from aQStringList
.There are various ways of achieving the bolding. You access the header labels via
QTableWidget::horizontalHeader()
. Then you could eitherQFont font = tableWidget->horizontalHeader()->font(); font.setBold(true); tableWidget->horizontalHeader()->setFont(font);
or
tableWidget->horizontalHeader()->setStyleSheet("QHeaderView { font-weight: bold; }")
There are also ways of accessing individual header columns if you want that.
-
The stylesheet option works fine. Thanks.
-
Hi @Buller,
thanks for the feedback. So please mark this topic as SOLVED now. Thanks!