diff options
author | Oleg Yadrov <oleg.yadrov@qt.io> | 2017-03-13 16:23:05 -0700 |
---|---|---|
committer | Oleg Yadrov <oleg.yadrov@qt.io> | 2017-03-16 16:49:21 +0000 |
commit | 4fac31015fcbff4e287e1fc2e2f4c470bff91346 (patch) | |
tree | f6ea62b7aff54518672ff0ed3d47983e1c031da8 | |
parent | 883492c13536694f5565295ce87ce17a5a42444f (diff) |
ManhattanStyle: remove QTabBar position adjustment
QTabBar style was recently updated in QMacStyle (see 175f33ed855b0).
New macOS style requires all tabs to be moved one pixel to the left, so
there's 1 pixel separator line visible between them which is always
left border of the tab with higher index. But once you start moving
a tab, you'll notice that each tab has both left and right borders.
ManhattanStyle is a proxy style what means it falls back on some other
style which can be either platform-specific ("Flat" is an example) or
cross-platform ("Dark" is based on QFusionStyle). Now, even though
ManhattanStyle does not implement a custom look of QTabBar, it does
this 1 pixel adjustment for the very first tab
(QStyleOptionTab::Beginning) and QStyleOptionTab::OnlyOneTab no matter
what style is actually used.
Unfortunately, QStyleOptionTab::TabPosition enumeration does not have a
specific value for the tab which is being moved, so it's painted as
OnlyOneTab. As a result of this additional adjustment left border of the
moving tab goes out of pixmap's geometry on macOS and it looks like it
does not have left border.
This is not right to modify QTabBar's geometry for any theme arguing
it as "otherwise it looks bad" because in general case this statement is
wrong: even Fusion style draws 2 pixel wide line on the left of each
tab. Proper solution would be to implement a custom look of QTabBar in
ManhattanStyle.
Change-Id: I9e110f3195d068c6101c412e142d3a1ff7e80852
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | src/plugins/coreplugin/manhattanstyle.cpp | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 63bdabb73ce..375d38afb5c 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -618,26 +618,6 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt return QProxyStyle::drawControl(element, option, painter, widget); switch (element) { - case CE_TabBarTabShape: - // Most styles draw a single dark outline. This looks rather ugly when combined with our - // single pixel dark separator so we adjust the first tab to compensate for this - - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - QStyleOptionTab adjustedTab = *tab; - if (tab->cornerWidgets == QStyleOptionTab::NoCornerWidgets && ( - tab->position == QStyleOptionTab::Beginning || - tab->position == QStyleOptionTab::OnlyOneTab)) - { - if (option->direction == Qt::LeftToRight) - adjustedTab.rect = adjustedTab.rect.adjusted(-1, 0, 0, 0); - else - adjustedTab.rect = adjustedTab.rect.adjusted(0, 0, 1 ,0); - } - QProxyStyle::drawControl(element, &adjustedTab, painter, widget); - return; - } - break; - case CE_MenuItem: painter->save(); if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { |