Workaround for #128.

This commit is contained in:
Martin Rotter 2017-07-10 08:11:32 +02:00
parent 6ede648ac8
commit c623da69f8
2 changed files with 27 additions and 3 deletions

@ -1 +1 @@
Subproject commit aea11879635d0d6b029a7f6d49d1f31dd95b3c05
Subproject commit 1bb36a305e8a23de1e4f3609d8fc4dfeb85ba6fe

View File

@ -238,16 +238,22 @@ int TabWidget::addBrowser(bool move_after_current, bool make_active, const QUrl
WebBrowser *browser = new WebBrowser(this);
int final_index;
#if defined (Q_OS_MACOS)
const QString browser_tab_name = tr(" Web browser");
#else
const QString browser_tab_name = tr("Web browser");
#endif
if (move_after_current) {
// Insert web browser after current tab.
final_index = insertTab(currentIndex() + 1, browser, qApp->icons()->fromTheme(QSL("text-html")),
tr("Web browser"), TabBar::Closable);
browser_tab_name, TabBar::Closable);
}
else {
// Add new browser as the last tab.
final_index = addTab(browser, qApp->icons()->fromTheme(QSL("text-html")),
//: Web browser default tab title.
tr("Web browser"),
browser_tab_name,
TabBar::Closable);
}
@ -318,11 +324,29 @@ int TabWidget::insertTab(int index, QWidget *widget, const QString &label, const
void TabWidget::changeIcon(int index, const QIcon &new_icon) {
setTabIcon(index, new_icon);
#if defined (Q_OS_MACOS)
if (tabBar()->tabType(index) != TabBar::FeedReader && !tabIcon(index).isNull()) {
// We have closable tab with some icon, fix the title.
if (!tabText(index).startsWith(QSL(" "))) {
setTabText(index, QSL(" ") + tabText(index));
}
}
#endif
}
void TabWidget::changeTitle(int index, const QString &new_title) {
setTabText(index, TextFactory::shorten(new_title));
setTabToolTip(index, new_title);
#if defined (Q_OS_MACOS)
if (tabBar()->tabType(index) != TabBar::FeedReader && !tabIcon(index).isNull()) {
// We have closable tab with some icon, fix the title.
if (!tabText(index).startsWith(QSL(" "))) {
setTabText(index, QSL(" ") + tabText(index));
}
}
#endif
}
void TabWidget::fixContentsAfterMove(int from, int to) {