Tab text gets cut off with a new line charater QTabWidget
Solved
General and Desktop
-
I am developing a chat application and need to display the name and id for each contact on a different tab. So, I am using a new line character to separate the name and the id and setting the result as the title of the tab as follows:
bool MessengerPage::addNewTab(const Contact& contact) { std::string tabTitle = contact.getName(); tabTitle.append("\n"); tabTitle.append(contact.getUid()); QListView* messengerListView = new QListView(); getListViewModel(messengerListView); this->tabs->addTab(messengerListView, QString::fromStdString(tabTitle)); contactsList.insert(std::pair<std::string, Contact>(contact.getUid(), contact)); return true; }
QListView is being used to display all the messages in the code above.
Now since this is a project for multiple platforms, I need this to work for all platforms.
Until now I had no problem for the display on Linux as can be seen:
But it is being displayed as follows on MacOS:
I have tried solutions which require fiddling with the CSS but to no avail.
Does anybody have any idea how to fix this? Any help would be appreciated. Thanks. -
Hi,
Did you try to set the elideMode property to
Qt::ElideNone
?