문제

I have QTabWidget on my form and two tabs on it. These tabs have standard text Tab1 and Tab2. How can I change it?

도움이 되었습니까?

해결책

It sounds like you're talking about Qt Designer, since it defaults to showing two tabs (called "Tab 1" and "Tab 2") when you add a QTabWidget through the interface.

If so, click on the tab you want to rename, then in the Property Editor (if you can't find it make sure it's visible by using the View->Property Editor menu item) scroll down to the bottom and look for the currentTabText property. You can change the tab's name right there.

다른 팁

You can use this at runtime:

ui->tabWidget->setTabText(index, "New tab title");

In Qt Creator/Designer (2.4.1), if you can't seem to find the currentTabText property, you have probably selected the tab itself in the the object tree.

Make sure to select the QTabWidget, which should happen automatically when selecting the tab in the form preview (see richardwb's answer).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top