diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2009-05-25 14:45:57 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2009-05-25 14:53:06 (GMT) |
commit | 0f0fc963a7f1691038ee36a27bb63ff3165eefba (patch) | |
tree | 93a471e01eca9e9eab5ef646d6a2d6851a59ba76 /src/gui/widgets/qtabbar.cpp | |
parent | 3d560a498803fadfec9163d7a9695aee60cca8d4 (diff) | |
download | Qt-0f0fc963a7f1691038ee36a27bb63ff3165eefba.zip Qt-0f0fc963a7f1691038ee36a27bb63ff3165eefba.tar.gz Qt-0f0fc963a7f1691038ee36a27bb63ff3165eefba.tar.bz2 |
BT:Fix a clipping issue in tabbar tabs
On XP and Vista where tabs use taboverlap, the currently
dragged would loose the outline. We need to compensate for the
taboverlap when creating the draggable widget, otherwise the
outline will be clipped.
Task-number: 254453
Reviewed-by: nrc
Diffstat (limited to 'src/gui/widgets/qtabbar.cpp')
-rw-r--r-- | src/gui/widgets/qtabbar.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 69221ba..785d772 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1536,9 +1536,10 @@ void QTabBar::paintEvent(QPaintEvent *) } if (!d->dragInProgress) p.drawControl(QStyle::CE_TabBarTab, tab); - else - d->movingTab->setGeometry(tab.rect); - + else { + int taboverlap = style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0, this); + d->movingTab->setGeometry(tab.rect.adjusted(-taboverlap, 0, taboverlap, 0)); + } } // Only draw the tear indicator if necessary. Most of the time we don't need too. @@ -1805,7 +1806,9 @@ void QTabBarPrivate::setupMovableTab() if (!movingTab) movingTab = new QWidget(q); + int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 ,q); QRect grabRect = q->tabRect(pressedIndex); + grabRect.adjust(-taboverlap, 0, taboverlap, 0); QPixmap grabImage(grabRect.size()); grabImage.fill(Qt::transparent); @@ -1813,7 +1816,7 @@ void QTabBarPrivate::setupMovableTab() QStyleOptionTabV3 tab; q->initStyleOption(&tab, pressedIndex); - tab.rect.moveTopLeft(QPoint(0, 0)); + tab.rect.moveTopLeft(QPoint(taboverlap, 0)); p.drawControl(QStyle::CE_TabBarTab, tab); p.end(); |