At first I thought that why don't you use QTabWidget::setTabToolTip but then I read your question again and I realised that you want to change the "Close Tab" text to something else. I did not find API method for that functionality and because of that I made a quick-and-dirty "workaround" and I tested it with my own application and it seems that it does the trick i.e. changes the text "Close Tab" to whatever you have defined. Here is my piece of code:
// "tabs" is an instance of QTabWidget
QList<QAbstractButton*> allPButtons = tabs->findChildren<QAbstractButton*>();
for (int ind = 0; ind < allPButtons.size(); ind++) {
if (item->inherits("CloseButton"))
item->setToolTip("Sulje"); // Default "Close Tab"
}
// "tabs" is an instance of QTabWidget
QList<QAbstractButton*> allPButtons = tabs->findChildren<QAbstractButton*>();
for (int ind = 0; ind < allPButtons.size(); ind++) {
QAbstractButton* item = allPButtons.at(ind);
if (item->inherits("CloseButton"))
item->setToolTip("Sulje"); // Default "Close Tab"
}
To copy to clipboard, switch view to plain text mode
There are also other buttons like QTableCornerButton and QToolButton inside of QTabWidget that is the reason to go through the whole list and select the ones that are inherits "CloseButton".
Please note that the code above is using internals of the Qt and because of that might not be portable, I tested it with Ubuntu 9.10 where it worked as expected.
Bookmarks