2

I have been able to resize the QTabWidget's QTabBar size, but the string inside is always limited to a fixed length.

QTabWidget *tabWidget = new QTabWidget;
tabWidget->setStyleSheet("QTabBar::tab { width: 100px; }");
tabWidget->addTab(imagesList, "abcdefghijklmnop");

The string shown is made of the central five/six characters only.

Thank you for any help,
Pietro

References: Qt Increase QTabWidget's QTabBar size

4

1 回答 1

1

当您使用样式表指定选项卡的宽度时,您也可以固定选项卡的宽度。如果文本比指定的宽度宽,您将只能看到文本中间适合的任何字符。尝试将选项卡宽度增加到 200 像素或 300 像素,或者如果它是您要设置的选项卡的最小宽度(如果需要,它仍然会变宽)使用以下样式表:

tabWidget->setStyleSheet("QTabBar::tab { min-width: 100px; }");
于 2013-01-02T19:28:08.570 回答