Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我的 ui 文件中有一个 tabwidget,这就是我现在添加标签的方式:
QPlainTextEdit *tab = new QPlaintextEdit; int index = ui->tabWidget->addTab(tab, "changeme");
现在我想知道是否可以随时更改选项卡的名称,例如在类中子类化 QPLainTextEdit 并在文本更改时将信号连接到它时,我想在选项卡上添加一个小星星表示文件已被修改,甚至可能吗?
QTabWidet::setTabText做你想做的事。
QTabWidet::setTabText
例如:
ui->tabWidget->setTabText(index, "new text");